This project has been archived by its maintainers, and is no longer receiving any updates.
Betterproto Setuptools plugin
Introduction
A modern setuptools plugin to generate Python
files from proto files using betterproto.
This plugin is based on
repo-config's
grpc_tools
plugin.
Supported Platforms
The following platforms are officially supported (tested):
- Python: 3.11
- Operating System: Ubuntu Linux 20.04
- Architectures: amd64, arm64
Quick Start
To add automatic betterproto code generation to your project, you need to add
this package to your build-dependencies in the pyproject.toml file, for
example:
[build-system]
requires = [
"setuptools == 68.1.0",
"setuptools-betterproto == 0.1.0",
]
build-backend = "setuptools.build_meta"
This uses a default configuration as follows:
proto_path: This is the root directory where the proto files are located. By default, it is set to..proto_glob: This is the glob pattern to match the proto files. The search is done recursively. By default, it is set to*.proto.include_paths: This is a list of paths to be added to the protobuf compiler's include path. By default, it is set to[], but theproto_pathdirectory is always automatically added.out_path: This is the directory where the generated Python files will be placed. By default, it is set to..
These defaults can be changed via the pypackage.toml file too. For example:
[tool.setuptools_betterproto]
proto_path = "proto"
include_paths = ["api-common-protos"]
out_path = "src"
You should add betterproto as a dependency too, for example:
dependencies = ["betterproto == 2.0.0b6"]
Once this is done, the conversion of the proto files to Python files should be automatic. Just try building the package with:
python -m pip install build
python -m build
A new command to generate the files will be also added to setuptools, you can
run it manually with:
python -c 'import setuptools; setuptools.setup()' compile_betterproto
You can also pass the configuration options via command line for quick testing,
try passing --help at the end of the command to see the available options.
Contributing
If you want to know how to build this project and contribute to it, please check out the Contributing Guide.
Similar projects
setuptools-proto: We didn't use this project because it seems a bit inactive and not widely used. It also seems to need some configuration as code, which we wanted to avoid.
Metadata
Release files for setuptools-betterproto 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| setuptools-betterproto-0.3.0.tar.gz | 11.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| setuptools_betterproto-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.3 kB
Release files / setuptools-betterproto-0.3.0.tar.gz
| Download URL | setuptools-betterproto-0.3.0.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
167c5f246a1446de727c790eda0c28645433d0732cc51b5fdaec87f3f6da73b7
|
|
BLAKE2b-256 checksum How to use checksums |
ed7183dcf9cba68e04573993914283c95486cad314416b229102cee3cee16edd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.4
|
Release files / setuptools_betterproto-0.3.0-py3-none-any.whl
| Download URL | setuptools_betterproto-0.3.0-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c155f808a451ab15b1d6ea80b52adc276956a1989f5e89b2e54260d2e66e2a1c
|
|
BLAKE2b-256 checksum How to use checksums |
15cbb4fdc979fe0980ac7060662e8840bc21451f4340ceff4f02310a56f47627
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.4
|
Security for setuptools-betterproto 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.