Skip to content

Commit a890514

Browse files
nat-ncetanu
authored andcommitted
Update deps & add generate_lib task
- Remove plugin dependency on protobuf since it's no longer required. - Update poethepoet to for better pyproject toml syntax support - Add handy generate_lib poe task for maintaining generated libs
1 parent fe1e712 commit a890514

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

poetry.lock

Lines changed: 19 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ black = { version = ">=19.3b0", optional = true }
1717
dataclasses = { version = "^0.7", python = ">=3.6, <3.7" }
1818
grpclib = "^0.4.1"
1919
jinja2 = { version = "^2.11.2", optional = true }
20-
protobuf = { version = "^3.12.2", optional = true }
2120
python-dateutil = "^2.8"
2221

2322
[tool.poetry.dev-dependencies]
@@ -26,7 +25,7 @@ bpython = "^0.19"
2625
grpcio-tools = "^1.30.0"
2726
jinja2 = "^2.11.2"
2827
mypy = "^0.770"
29-
poethepoet = "^0.5.0"
28+
poethepoet = ">=0.9.0"
3029
protobuf = "^3.12.2"
3130
pytest = "^5.4.2"
3231
pytest-asyncio = "^0.12.0"
@@ -43,7 +42,7 @@ asv = "^0.4.2"
4342
protoc-gen-python_betterproto = "betterproto.plugin:main"
4443

4544
[tool.poetry.extras]
46-
compiler = ["black", "jinja2", "protobuf"]
45+
compiler = ["black", "jinja2"]
4746

4847
[tool.poe.tasks]
4948
# Dev workflow tasks
@@ -55,6 +54,16 @@ docs = { cmd = "sphinx-build docs docs/build", help = "Build the sphinx d
5554
bench = { shell = "asv run master^! && asv run HEAD^! && asv compare master HEAD", help = "Benchmark current commit vs. master branch"}
5655
clean = { cmd = "rm -rf .asv .coverage .mypy_cache .pytest_cache dist betterproto.egg-info **/__pycache__ tests/output_*", help = "Clean out generated files from the workspace" }
5756

57+
generate_lib.cmd = """
58+
protoc
59+
--plugin=protoc-gen-custom=src/betterproto/plugin/main.py
60+
--custom_opt=INCLUDE_GOOGLE
61+
--custom_out=src/betterproto/lib
62+
-I /usr/local/include/
63+
/usr/local/include/google/protobuf/**/*.proto
64+
"""
65+
generate_lib.help = "Regenerate the types in betterproto.lib.google"
66+
5867
# CI tasks
5968
full-test = { shell = "poe generate && tox", help = "Run tests with multiple pythons" }
6069
check-style = { cmd = "black . --check --diff --exclude tests/output_", help = "Check if code style is correct"}

tests/inputs/oneof/test_oneof.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
def test_which_count():
77
message = Test()
88
message.from_json(get_test_case_json_data("oneof")[0])
9-
assert betterproto.which_one_of(message, "foo") == ("count", 100)
9+
assert betterproto.which_one_of(message, "foo") == ("pitied", 100)
1010

1111

1212
def test_which_name():
1313
message = Test()
1414
message.from_json(get_test_case_json_data("oneof", "oneof_name.json")[0])
15-
assert betterproto.which_one_of(message, "foo") == ("name", "foobar")
15+
assert betterproto.which_one_of(message, "foo") == ("pitier", "Mr. T")

0 commit comments

Comments
 (0)