nanopb
Nanopb is a small code-size Protocol Buffers implementation in ansi C. It is especially suitable for use in microcontrollers, but fits any memory restricted system.
What it is and what it does
Nanopb is a Protocol Buffer compiler and runtime library designed for embedded systems and memory-constrained devices. It takes standard .proto files and generates minimal C code (pb_encode.c, pb_decode.c, pb_common.c) that can be compiled into your project. Unlike the full protobuf library, nanopb prioritizes small code size and low memory footprint, making it suitable for microcontrollers and other resource-limited environments.
The package provides a Python-based code generator that runs on your development machine to produce the C headers and source files from your .proto definitions. It integrates with common build systems (Make, CMake, SCons, Bazel, Conan) and platforms (Arduino, Zephyr, PlatformIO). The generated code depends only on protobuf as a runtime dependency for the generator itself, while the compiled C output has minimal external dependencies, making it ideal for bare-metal or deeply embedded applications.
Use it for:
- Generate compact C serialization code for IoT devices and microcontroller firmware that need to exchange structured data over limited bandwidth or storage.
- Build embedded systems that communicate with cloud services using Protocol Buffers without the overhead of a full protobuf runtime library.
- Integrate Protocol Buffer message definitions into Arduino or STM32 projects where code size and memory are critical constraints.
- Create firmware for devices running on Zephyr RTOS or other embedded operating systems that require efficient message serialization.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Nanopb is a code generator and runtime library that compiles Protocol Buffer definitions into minimal C code suitable for embedded systems and memory-constrained environments.
Yes, if you are building embedded C/C++ systems that need Protocol Buffer serialization. The active maintenance, permissive license, and wide integration with embedded platforms make it a solid choice. Install only if you have a C build system in place and need to generate code from .proto files; this is a build-time tool, not a runtime library for Python applications.
Install
nanopb on PyPI
pip
pip install nanopbuv
uv add nanopbpoetry
poetry add nanopbInstalling nanopb
Before you install
Low install friction with a single runtime dependency on protobuf. The package is actively maintained with a recent release and 5520 repository stars, indicating stable community adoption.
License in practice
Licensed under Zlib (permissive), allowing use in commercial and proprietary projects with minimal restrictions.
Quickstart
pip install nanopb
# Generate C code from a .proto file
python -m nanopb.generator myprotocol.proto
# Or use the generator directly
from nanopb import generator
# Integrate with your build system to compile .pb.c and .pb.h files
Requires protobuf as a runtime dependency; C compiler and build system (Make, CMake, SCons, or Bazel) needed to compile the generated .pb.c and .pb.h files into your embedded project.
Verify before relying
- Whether the PyPI package includes precompiled generator binaries or requires Python to run the generator
- Performance characteristics or code-size benchmarks compared to other embedded protobuf implementations
- Support status for Protocol Buffer versions beyond the current release cycle
Package facts
| License | Zlib (permissive) |
| Python support | supports the current Python release (>=2.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — protobuf |
| Maintenance | actively maintained — 621 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 422,615/month — #6,780 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: nanopb-0.4.9.1-py2.py3-none-any.whl
Keywords: protobuf, protoc
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
proto-plusProto Plus wraps protocol buffers to provide…
permissive · top 1,000 on PyPI
dbt-protosProvides Python Protocol Buffer bindings for…
permissive · top 1,000 on PyPI
hatch-protobufA Hatch build plugin that generates Python…
copyleft · top 15,000 on PyPI
pbtoolsGenerates C source code from Protocol Buffer…
permissive · top 15,000 on PyPI
barectfbarectf generates ANSI C tracers that output…
permissive · top 15,000 on PyPI
pioarduinopioarduino is a build system and embedded…
permissive · top 15,000 on PyPI
protoc-wheel-0Provides pre-built wheels of the Google…
permissive · top 15,000 on PyPI
setuptools-protobufA setuptools plugin that automates compilation…
permissive · top 15,000 on PyPI
aristaprotoGenerates Python gRPC stubs and message classes…
permissive · top 15,000 on PyPI