Skip to content

chore: depend on authorizer-proto instead of vendored _grpc stubs#9

Merged
lakhansamani merged 1 commit into
mainfrom
chore/use-proto-python-package
Jul 24, 2026
Merged

chore: depend on authorizer-proto instead of vendored _grpc stubs#9
lakhansamani merged 1 commit into
mainfrom
chore/use-proto-python-package

Conversation

@lakhansamani

Copy link
Copy Markdown
Contributor

Summary

Replaces the hand-copied src/authorizer/_grpc protobuf/gRPC stubs with the versioned PyPI package authorizer-proto (import package authorizer_proto), mirroring the prometheus/client_model pattern. This removes the cross-repo copy step that let the vendored stubs go stale (the drift behind authorizerdev/authorizer#726 / #8).

⚠️ Merge ordering

authorizer-proto must be published to PyPI first (see below). Until then, pip install of this branch cannot resolve authorizer-proto>=0.1.0 and CI will fail at the install step. The package is tagged v0.1.0 and builds/imports clean; it needs a maintainer with PYPI_API_TOKEN to publish (push the v0.1.0 tag through its release workflow, or twine upload).

Changes

  • Remove src/authorizer/_grpc/ (vendored stubs, ~5k lines).
  • Add authorizer-proto>=0.1.0 to dependencies; [grpc] extra pulls authorizer-proto[grpc].
  • Repoint the two stub imports (_proto.py, _grpc_transport.py): ._grpc.authorizer.v1 -> authorizer_proto.authorizer.v1.
  • Drop the obsolete _grpc ruff/mypy excludes; ignore authorizer_proto.* in mypy (generated, untyped).
  • authorizer-proto regenerates itself directly from buf.build/authorizerdev/authorizer (BSR) — no manual copy to forget.
  • REST transport unaffected: grpc-gateway JSON reuses the same proto message types, now sourced from the package.

Testing (local, against authorizer-proto v0.1.0 installed from source)

  • ruff check src tests — All checks passed.
  • mypy src — Success, no issues in 12 source files.
  • pytest -m "not live"112 passed, 63 deselected.
  • pytest tests/integration -m live (graphql+rest+grpc) against quay.io/authorizer/authorizer:2.4.0-rc.963 passed.
  • uv build --wheel — builds clean.

Structural dependency change — leaving for human review, not self-merging.

Replace the hand-copied src/authorizer/_grpc stubs with the versioned PyPI
package authorizer-proto (import package authorizer_proto).

- Removes the fragile cross-repo copy step that let the vendored stubs go
  stale (the drift behind authorizer#726 / authorizer-py#8).
- authorizer-proto regenerates itself straight from
  buf.build/authorizerdev/authorizer, so there is no manual copy to forget.
- Repoint the two stub imports (_proto.py, _grpc_transport.py) from
  ._grpc.authorizer.v1 to authorizer_proto.authorizer.v1.
- Drop the _grpc ruff/mypy excludes; ignore authorizer_proto.* in mypy
  (generated, untyped).
- REST transport unaffected: grpc-gateway JSON uses the same proto message
  types, now sourced from the package.
@lakhansamani
lakhansamani merged commit f97fa60 into main Jul 24, 2026
6 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant