Skip to content

Commit 1b504d9

Browse files
Cleanup repository
* Remove CEL_SPEC_VERSION from testdata file (we should only ever need one version of this) * Use direct `uv run <file>` instead of `uv -- run python -m <module>` * Consolidate workflows * Move conformance tests to CI workflow * Use shared buf PR Title workflow * Remove excess from .gitignore
1 parent c7e5074 commit 1b504d9

File tree

8 files changed

+32
-242
lines changed

8 files changed

+32
-242
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ jobs:
3737
python-version: ${{ matrix.python-version }}
3838
- name: Install dependencies
3939
run: make install
40-
- name: Execute tests
41-
run: make test
4240
- name: Lint
4341
run: make lint
42+
- name: Execute tests
43+
run: make test
44+
- name: Test conformance
45+
run: make conformance
4446
- name: Format
4547
run: make format
4648
# When running with matrix.resolution == highest, we expect uv.lock to change, but we don't want that file checked in.

.github/workflows/conformance.yaml

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

.github/workflows/pr-hygiene.yaml

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

.github/workflows/pr-title.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Lint PR Title
2+
# Prevent writing to the repository using the CI token.
3+
# Ref: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions
4+
permissions:
5+
pull-requests: read
6+
on:
7+
pull_request:
8+
# By default, a workflow only runs when a pull_request's activity type is opened,
9+
# synchronize, or reopened. We explicity override here so that PR titles are
10+
# re-linted when the PR text content is edited.
11+
types:
12+
- opened
13+
- edited
14+
- reopened
15+
- synchronize
16+
jobs:
17+
lint:
18+
uses: bufbuild/base-workflows/.github/workflows/pr-title.yaml@main

.gitignore

Lines changed: 6 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -1,162 +1,8 @@
1-
.tmp/
1+
# tools, see ./Makefile
2+
/.tmp/
23

3-
# Byte-compiled / optimized / DLL files
4-
__pycache__/
5-
*.py[cod]
6-
*$py.class
4+
# python writes compiled bytecode to .pyc files in __pycache__ directories
5+
__pycache__
76

8-
# C extensions
9-
*.so
10-
11-
# Distribution / packaging
12-
.Python
13-
build/
14-
develop-eggs/
15-
dist/
16-
downloads/
17-
eggs/
18-
.eggs/
19-
lib/
20-
lib64/
21-
parts/
22-
sdist/
23-
var/
24-
wheels/
25-
share/python-wheels/
26-
*.egg-info/
27-
.installed.cfg
28-
*.egg
29-
MANIFEST
30-
31-
# PyInstaller
32-
# Usually these files are written by a python script from a template
33-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
34-
*.manifest
35-
*.spec
36-
37-
# Installer logs
38-
pip-log.txt
39-
pip-delete-this-directory.txt
40-
41-
# Unit test / coverage reports
42-
htmlcov/
43-
.tox/
44-
.nox/
45-
.coverage
46-
.coverage.*
47-
.cache
48-
nosetests.xml
49-
coverage.xml
50-
*.cover
51-
*.py,cover
52-
.hypothesis/
53-
.pytest_cache/
54-
cover/
55-
56-
# Translations
57-
*.mo
58-
*.pot
59-
60-
# Django stuff:
61-
*.log
62-
local_settings.py
63-
db.sqlite3
64-
db.sqlite3-journal
65-
66-
# Flask stuff:
67-
instance/
68-
.webassets-cache
69-
70-
# Scrapy stuff:
71-
.scrapy
72-
73-
# Sphinx documentation
74-
docs/_build/
75-
76-
# PyBuilder
77-
.pybuilder/
78-
target/
79-
80-
# Jupyter Notebook
81-
.ipynb_checkpoints
82-
83-
# IPython
84-
profile_default/
85-
ipython_config.py
86-
87-
# pyenv
88-
# For a library or package, you might want to ignore these files since the code is
89-
# intended to run in multiple environments; otherwise, check them in:
90-
# .python-version
91-
92-
# pipenv
93-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
94-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
95-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
96-
# install all needed dependencies.
97-
#Pipfile.lock
98-
99-
# poetry
100-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
101-
# This is especially recommended for binary packages to ensure reproducibility, and is more
102-
# commonly ignored for libraries.
103-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
104-
#poetry.lock
105-
106-
# pdm
107-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
108-
#pdm.lock
109-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
110-
# in version control.
111-
# https://pdm.fming.dev/#use-with-ide
112-
.pdm.toml
113-
114-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115-
__pypackages__/
116-
117-
# Celery stuff
118-
celerybeat-schedule
119-
celerybeat.pid
120-
121-
# SageMath parsed files
122-
*.sage.py
123-
124-
# Environments
125-
.venv
126-
env/
127-
venv/
128-
ENV/
129-
env.bak/
130-
venv.bak/
131-
132-
# Spyder project settings
133-
.spyderproject
134-
.spyproject
135-
136-
# Rope project settings
137-
.ropeproject
138-
139-
# mkdocs documentation
140-
/site
141-
142-
# mypy
143-
.mypy_cache/
144-
.dmypy.json
145-
dmypy.json
146-
147-
# Pyre type checker
148-
.pyre/
149-
150-
# pytype static type analyzer
151-
.pytype/
152-
153-
# Cython debug symbols
154-
cython_debug/
155-
156-
# PyCharm
157-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
158-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
159-
# and can be added to the global gitignore or merged into this file. For a more nuclear
160-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
161-
#.idea/
162-
.vscode/
7+
# VS Code configuration
8+
/.vscode/

Makefile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ ADD_LICENSE_HEADER := $(BIN)/license-header \
1818
# This version should be kept in sync with the version in buf.yaml
1919
PROTOVALIDATE_VERSION ?= v1.0.0
2020
# Version of the cel-spec that this implementation is conformant with
21-
# This should be kept in sync with the version in test/test_format.py
2221
CEL_SPEC_VERSION ?= v0.24.0
23-
TESTDATA_FILE := test/testdata/string_ext_$(CEL_SPEC_VERSION).textproto
22+
TESTDATA_FILE := test/testdata/string_ext.textproto
2423

2524
.PHONY: help
2625
help: ## Describe useful make targets
@@ -51,12 +50,12 @@ format: install $(BIN)/buf $(BIN)/license-header ## Format code
5150
uv run -- ruff check --fix protovalidate test
5251

5352
.PHONY: test
54-
test: generate install gettestdata ## Run unit tests
53+
test: generate install $(TESTDATA_FILE) ## Run unit tests
5554
uv run -- pytest
5655

5756
.PHONY: conformance
5857
conformance: $(BIN)/protovalidate-conformance generate install ## Run conformance tests
59-
protovalidate-conformance $(CONFORMANCE_ARGS) uv -- run python3 -m test.conformance.runner
58+
protovalidate-conformance $(CONFORMANCE_ARGS) uv run test/conformance/runner.py
6059

6160
.PHONY: lint
6261
lint: install $(BIN)/buf ## Lint code
@@ -75,9 +74,6 @@ checkgenerate: generate
7574
@# Used in CI to verify that `make generate` doesn't produce a diff.
7675
test -z "$$(git status --porcelain | tee /dev/stderr)"
7776

78-
.PHONY: gettestdata
79-
gettestdata: $(TESTDATA_FILE)
80-
8177
$(TESTDATA_FILE):
8278
mkdir -p $(dir @)
8379
curl -fsSL -o $@ https://raw.githubusercontent.com/google/cel-spec/refs/tags/$(CEL_SPEC_VERSION)/tests/simple/testdata/string_ext.textproto

test/test_format.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
from protovalidate.internal import extra_func
2727
from protovalidate.internal.cel_field_presence import InterpretedRunner
2828

29-
# Version of the cel-spec that this implementation is conformant with.
30-
# This should be kept in sync with the version in ../Makefile.
31-
CEL_SPEC_VERSION = "v0.24.0"
32-
3329
skipped_tests = [
3430
# cel-python seems to have a bug with ints and booleans in the same map which evaluate to the same value
3531
# which the test data for this test has. For example: {1: 'value1', true: 'value2'}]).
@@ -83,7 +79,7 @@ def get_eval_error_message(test: simple_pb2.SimpleTest) -> Optional[str]:
8379

8480

8581
# The test data from the cel-spec conformance tests
86-
cel_test_data = load_test_data(f"test/testdata/string_ext_{CEL_SPEC_VERSION}.textproto")
82+
cel_test_data = load_test_data("test/testdata/string_ext.textproto")
8783
# Our supplemental tests of functionality not in the cel conformance file, but defined in the spec.
8884
supplemental_test_data = load_test_data("test/testdata/string_ext_supplemental.textproto")
8985

File renamed without changes.

0 commit comments

Comments
 (0)