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
8 changes: 6 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ git clone git@github.com:bufbuild/protovalidate-python.git
cd protovalidate-python
```

Then, make any changes you'd like. We use a Makefile to test and lint our code,
so you'll need a few non-Python tools:
Next, install dependencies. You will need:

* Python >=v3.9
* [Pipenv](https://pipenv.pypa.io/en/latest/index.html)

We use a Makefile to test and lint our code, so you'll also need a few non-Python tools:

* GNU Make (to use the Makefile): part of the `build-essential` package on
Debian-derived Linux distributions (including Ubuntu), and part of
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pipenv"
- run: ${{steps.python.outputs.python-path}} -m pip install --upgrade pip pipenv
- name: Execute tests
run: make test PYTHON=${{ steps.python.outputs.python-path }}
- name: Lint
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/conformance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pipenv"
- run: ${{steps.python.outputs.python-path}} -m pip install --upgrade pip pipenv
- name: Test conformance
run: make conformance PYTHON=${{ steps.python.outputs.python-path }}
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ lint: install ## Lint code

.PHONY: install
install: ## Install dependencies
$(PYTHON) -m pip install --upgrade pip pipenv
pipenv --python $(PYTHON) sync --dev

.PHONY: checkgenerate
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ protobuf = "==6.*"
pytest = "*"
mypy = "*"
ruff = "*"
types-protobuf = "*"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smaye81 did we have a reason for pinning to this version? Wasn't sure if we needed this for something or if newer types-protobuf versions were borked in some way.

I'm guessing it's because unpinning results in:

$ make lint
pipenv --python python3 sync --dev
Loading .env environment variables...
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
Installing dependencies from Pipfile.lock (8a53a8)...
Installing dependencies from Pipfile.lock (8a53a8)...
All dependencies are now up-to-date!
pipenv run ruff format --check --diff protovalidate tests
Loading .env environment variables...
16 files already formatted
pipenv run mypy protovalidate
Loading .env environment variables...
protovalidate/internal/rules.py:69: error: Incompatible types in assignment (expression has type "google.protobuf.descriptor.Descriptor | google._upb._message.Descriptor", variable has type "google.protobuf.descriptor.Descriptor")  [assignment]
protovalidate/validator.py:88: error: Argument 1 to "get" of "RuleFactory" has incompatible type "google.protobuf.descriptor.Descriptor | google._upb._message.Descriptor"; expected "google.protobuf.descriptor.Descriptor"  [arg-type]
Found 2 errors in 2 files (checked 9 source files)
make: *** [lint] Error 1

for when we want context in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that's why it's pinned. For some reason, that version is out of sync with the protobuf library and expects descriptors to be a union type.

types-protobuf = "==6.30.2.20250503"
exceptiongroup = "*"
tomli = "*"

Expand Down
38 changes: 19 additions & 19 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ build-backend = "hatchling.build"
name = "protovalidate"
description = "Protocol Buffer Validation for Python"
readme = "README.md"
license = { file = "LICENSE" }
license-expression = "Apache 2.0"
license-file = "LICENSE"
keywords = ["validate", "protobuf", "protocol buffer"]
requires-python = ">=3.9"
classifiers = [
Expand All @@ -15,7 +16,6 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Typing :: Typed",
]
Expand Down
Loading