Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ on:
permissions:
contents: read
jobs:
test:
name: Unit tests
ci:
name: CI
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -37,10 +37,12 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: make install
- name: Execute tests
run: make test
- name: Lint
run: make lint
- name: Execute tests
run: make test
- name: Test conformance
run: make conformance
- name: Format
run: make format
# When running with matrix.resolution == highest, we expect uv.lock to change, but we don't want that file checked in.
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/conformance.yaml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/pr-hygiene.yaml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/pr-title.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Lint PR Title
# Prevent writing to the repository using the CI token.
# Ref: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions
permissions:
pull-requests: read
on:
pull_request:
# By default, a workflow only runs when a pull_request's activity type is opened,
# synchronize, or reopened. We explicity override here so that PR titles are
# re-linted when the PR text content is edited.
types:
- opened
- edited
- reopened
- synchronize
jobs:
lint:
uses: bufbuild/base-workflows/.github/workflows/pr-title.yaml@main
166 changes: 6 additions & 160 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,162 +1,8 @@
.tmp/
# tools, see ./Makefile
/.tmp/

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

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.vscode/
# VS Code configuration
/.vscode/
10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ ADD_LICENSE_HEADER := $(BIN)/license-header \
# This version should be kept in sync with the version in buf.yaml
PROTOVALIDATE_VERSION ?= v1.0.0
# Version of the cel-spec that this implementation is conformant with
# This should be kept in sync with the version in test/test_format.py
CEL_SPEC_VERSION ?= v0.24.0
TESTDATA_FILE := test/testdata/string_ext_$(CEL_SPEC_VERSION).textproto
TESTDATA_FILE := test/testdata/string_ext.textproto

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

.PHONY: test
test: generate install gettestdata ## Run unit tests
test: generate install $(TESTDATA_FILE) ## Run unit tests
uv run -- pytest

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

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

.PHONY: gettestdata
gettestdata: $(TESTDATA_FILE)

$(TESTDATA_FILE):
mkdir -p $(dir @)
curl -fsSL -o $@ https://raw.githubusercontent.com/google/cel-spec/refs/tags/$(CEL_SPEC_VERSION)/tests/simple/testdata/string_ext.textproto
Expand Down
6 changes: 1 addition & 5 deletions test/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
from protovalidate.internal import extra_func
from protovalidate.internal.cel_field_presence import InterpretedRunner

# Version of the cel-spec that this implementation is conformant with.
# This should be kept in sync with the version in ../Makefile.
CEL_SPEC_VERSION = "v0.24.0"

skipped_tests = [
# cel-python seems to have a bug with ints and booleans in the same map which evaluate to the same value
# which the test data for this test has. For example: {1: 'value1', true: 'value2'}]).
Expand Down Expand Up @@ -83,7 +79,7 @@ def get_eval_error_message(test: simple_pb2.SimpleTest) -> Optional[str]:


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

Expand Down