-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish Python generated protobuf code to PyPI (#74)
**Public-Facing Changes** Published a new package to PyPI called `foxglove-schemas-protobuf`. Import classes as follows: ```py from foxglove_schemas_protobuf.RawImage_pb2 import RawImage ```
- Loading branch information
Showing
12 changed files
with
500 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
**/*.pyc | ||
build | ||
dist | ||
*.egg-info | ||
*_pb2* | ||
.pytest_cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
.PHONY: pipenv | ||
pipenv: | ||
SETUPTOOLS_ENABLE_FEATURES="legacy-editable" pipenv install --dev --deploy | ||
|
||
ifeq ($(shell uname),Darwin) | ||
SED_ARGS = -i '' | ||
else | ||
SED_ARGS = -i | ||
endif | ||
|
||
.PHONY: generate-protobuf | ||
generate-protobuf: | ||
rm -rf foxglove-schemas-protobuf/foxglove_schemas_protobuf/*_pb2* | ||
pipenv run protoc \ | ||
--python_out=foxglove-schemas-protobuf/foxglove_schemas_protobuf \ | ||
--mypy_out=foxglove-schemas-protobuf/foxglove_schemas_protobuf \ | ||
--proto_path ../schemas/proto \ | ||
../schemas/proto/foxglove/*.proto | ||
mv foxglove-schemas-protobuf/foxglove_schemas_protobuf/foxglove/* foxglove-schemas-protobuf/foxglove_schemas_protobuf | ||
rmdir foxglove-schemas-protobuf/foxglove_schemas_protobuf/foxglove | ||
sed -E $(SED_ARGS) 's/from foxglove import/from . import/g' foxglove-schemas-protobuf/foxglove_schemas_protobuf/*_pb2.py | ||
sed -E $(SED_ARGS) 's/import foxglove\.(.+)$$/from . import \1 as foxglove_\1/g' foxglove-schemas-protobuf/foxglove_schemas_protobuf/*_pb2.pyi | ||
sed -E $(SED_ARGS) 's/foxglove\./foxglove_/g' foxglove-schemas-protobuf/foxglove_schemas_protobuf/*_pb2.pyi | ||
|
||
.PHONY: build | ||
build: pipenv generate-protobuf | ||
pipenv run python -m build foxglove-schemas-protobuf | ||
|
||
.PHONY: test | ||
test: pipenv generate-protobuf | ||
pipenv run python -m pytest foxglove-schemas-protobuf | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf dist | ||
find . -name "build" -type d -exec rm -rf {} + | ||
find . -name "dist" -type d -exec rm -rf {} + | ||
find . -name "*.egg-info" -type d -exec rm -rf {} + | ||
find . -name "*_pb2*" -delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
protobuf = "*" | ||
foxglove-schemas-protobuf = {editable = true, path = "./foxglove-schemas-protobuf"} | ||
|
||
[dev-packages] | ||
build = "*" | ||
mypy-protobuf = "*" | ||
pipenv = "*" | ||
pytest = "*" | ||
|
||
[requires] | ||
python_version = "3" |
Oops, something went wrong.