Skip to content

Commit 34fb9de

Browse files
Remove compiler code (#34)
* Poe command to pull generated files * Update version in generated files * Delete useless file * Remove compiler code * Pull test files instead of generating them * Update lock file * Remove obsolete test files * Add back casing.py
1 parent ba014cb commit 34fb9de

21 files changed

+228
-2352
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ jobs:
5454

5555
- name: Install dependencies
5656
shell: bash
57-
run: poetry install -E compiler
57+
run: poetry install
5858

59-
- name: Generate code from proto files
59+
- name: Download compiled test files
6060
shell: bash
61-
run: poetry run python -m tests.generate -v
61+
run: poetry run poe pull-compiled-tests
6262

6363
- name: Execute test suite
6464
shell: bash

poetry.lock

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

pyproject.toml

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,22 @@ packages = [
1313

1414
[tool.poetry.dependencies]
1515
python = "^3.8"
16-
# The Ruff version is pinned. To update it, also update it in .pre-commit-config.yaml
17-
ruff = { version = "~0.7.4", optional = true }
1816
grpclib = "^0.4.1"
19-
jinja2 = { version = ">=3.0.3", optional = true }
2017
python-dateutil = "^2.8"
2118
typing-extensions = "^4.7.1"
2219
betterproto-rust-codec = { version = "0.1.1", optional = true }
2320

2421
[tool.poetry.group.dev.dependencies]
2522
asv = "^0.4.2"
2623
bpython = "^0.19"
27-
jinja2 = ">=3.0.3"
2824
mypy = "^1.11.2"
2925
pre-commit = "^2.17.0"
3026
grpcio-tools = "^1.54.2"
3127
tox = "^4.0.0"
3228
mkdocs-material = {version = "^9.5.49", python = ">=3.10"}
3329
mkdocstrings = {version = "^0.27.0", python = ">=3.10", extras = ["python"]}
30+
# The Ruff version is pinned. To update it, also update it in .pre-commit-config.yaml
31+
ruff = { version = "~0.7.4" }
3432

3533
[tool.poetry.group.test.dependencies]
3634
poethepoet = ">=0.9.0"
@@ -47,7 +45,6 @@ tomlkit = ">=0.7.0"
4745
protoc-gen-python_betterproto = "betterproto2.plugin:main"
4846

4947
[tool.poetry.extras]
50-
compiler = ["ruff", "jinja2"]
5148
rust-codec = ["betterproto-rust-codec"]
5249

5350
[tool.ruff]
@@ -75,10 +72,6 @@ combine-as-imports = true
7572

7673
# Dev workflow tasks
7774

78-
[tool.poe.tasks.generate]
79-
script = "tests.generate:main"
80-
help = "Generate test cases (do this once before running test)"
81-
8275
[tool.poe.tasks.test]
8376
cmd = "pytest"
8477
help = "Run tests"
@@ -127,32 +120,23 @@ rm -rf .asv .coverage .mypy_cache .pytest_cache
127120
"""
128121
help = "Clean out generated files from the workspace"
129122

130-
[tool.poe.tasks.generate_lib]
131-
cmd = """
132-
protoc
133-
--plugin=protoc-gen-custom=src/betterproto2/plugin/main.py
134-
--custom_opt=INCLUDE_GOOGLE
135-
--custom_out=src/betterproto/lib/std
136-
-I /usr/local/include/
137-
/usr/local/include/google/protobuf/**/*.proto
123+
[tool.poe.tasks.pull-compiled-tests]
124+
shell = """
125+
rm -rf tests/output_* &&
126+
git clone https://github.com/betterproto/python-betterproto2-compiler --branch compiled-test-files --single-branch compiled_files &&
127+
mv compiled_files/tests_betterproto tests/output_betterproto &&
128+
mv compiled_files/tests_betterproto_pydantic tests/output_betterproto_pydantic &&
129+
mv compiled_files/tests_reference tests/output_reference &&
130+
rm -rf compiled_files
138131
"""
139-
help = "Regenerate the types in betterproto.lib.std.google"
132+
help = "Pulls the compiled test files from the betterproto2-compiler repository"
140133

141134
# CI tasks
142135

143136
[tool.poe.tasks.full-test]
144137
shell = "poe generate && tox"
145138
help = "Run tests with multiple pythons"
146139

147-
[tool.doc8]
148-
paths = ["docs"]
149-
max_line_length = 88
150-
151-
[tool.doc8.ignore_path_errors]
152-
"docs/migrating.rst" = [
153-
"D001", # contains table which is longer than 88 characters long
154-
]
155-
156140
[tool.coverage.run]
157141
omit = ["betterproto/tests/*"]
158142

src/betterproto/_version.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/betterproto2/casing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import keyword
22
import re
33

4+
# TODO it should be possible to delete this file
5+
46
# Word delimiters and symbols that will not be preserved when re-casing.
57
# language=PythonRegExp
68
SYMBOLS = "[^a-zA-Z0-9]*"

src/betterproto2/compile/__init__.py

Whitespace-only changes.

src/betterproto2/compile/importing.py

Lines changed: 0 additions & 193 deletions
This file was deleted.

src/betterproto2/compile/naming.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/betterproto2/plugin/__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/betterproto2/plugin/__main__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)