{"id":29142398,"url":"https://github.com/bufbuild/protovalidate-python","last_synced_at":"2025-06-30T19:37:39.563Z","repository":{"id":180261884,"uuid":"648345109","full_name":"bufbuild/protovalidate-python","owner":"bufbuild","description":"Protocol Buffer Validation for Python.","archived":false,"fork":false,"pushed_at":"2025-06-30T13:15:17.000Z","size":9622,"stargazers_count":46,"open_issues_count":4,"forks_count":7,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-06-30T14:24:36.196Z","etag":null,"topics":["cel","common-expression-language","protobuf","protocol-buffers","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/protovalidate","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bufbuild.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-06-01T18:55:32.000Z","updated_at":"2025-06-30T13:15:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"b9c0d1f2-a29a-483d-ab2a-993fdce52a46","html_url":"https://github.com/bufbuild/protovalidate-python","commit_stats":null,"previous_names":["bufbuild/protovalidate-python"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/bufbuild/protovalidate-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Fprotovalidate-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Fprotovalidate-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Fprotovalidate-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Fprotovalidate-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bufbuild","download_url":"https://codeload.github.com/bufbuild/protovalidate-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufbuild%2Fprotovalidate-python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262790486,"owners_count":23364747,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cel","common-expression-language","protobuf","protocol-buffers","python"],"created_at":"2025-06-30T19:37:31.059Z","updated_at":"2025-06-30T19:37:39.546Z","avatar_url":"https://github.com/bufbuild.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![The Buf logo](.github/buf-logo.svg)][buf] \n\n# protovalidate-python\n\n[![CI](https://github.com/bufbuild/protovalidate-python/actions/workflows/ci.yaml/badge.svg)](https://github.com/bufbuild/protovalidate-python/actions/workflows/ci.yaml)\n[![Conformance](https://github.com/bufbuild/protovalidate-python/actions/workflows/conformance.yaml/badge.svg)](https://github.com/bufbuild/protovalidate-python/actions/workflows/conformance.yaml)\n[![PyPI version](https://badge.fury.io/py/protovalidate.svg)](https://badge.fury.io/py/protovalidate)\n\n[Protovalidate][protovalidate] provides standard annotations to validate common constraints on messages and fields, as well as the ability to use [CEL][cel] to write custom constraints. It's the next generation of [protoc-gen-validate][protoc-gen-validate], the only widely used validation library for Protobuf.\n\nWith Protovalidate, you can annotate your Protobuf messages with both standard and custom validation rules:\n\n```protobuf\nsyntax = \"proto3\";\n\npackage banking.v1;\n\nimport \"buf/validate/validate.proto\";\n\nmessage MoneyTransfer {\n  string to_account_id = 1 [\n    // Standard rule: `to_account_id` must be a UUID\n    (buf.validate.field).string.uuid = true\n  ];\n\n  string from_account_id = 2 [\n    // Standard rule: `from_account_id` must be a UUID\n    (buf.validate.field).string.uuid = true\n  ];\n\n  // Custom rule: `to_account_id` and `from_account_id` can't be the same.\n  option (buf.validate.message).cel = {\n    id: \"to_account_id.not.from_account_id\"\n    message: \"to_account_id and from_account_id should not be the same value\"\n    expression: \"this.to_account_id != this.from_account_id\"\n  };\n}\n```\n\nOnce you've added `protovalidate-python` to your project, validation is idiomatic Python:\n\n```python\ntry:\n    protovalidate.validate(message)\nexcept protovalidate.ValidationError as e:\n    # Handle failure.\n```\n\n## Installation\n\n\u003e [!TIP]\n\u003e The easiest way to get started with Protovalidate for RPC APIs are the quickstarts in Buf's documentation. There's one available for [Python and gRPC][grpc-python].\n\nTo install the package, use `pip`:\n\n```shell\npip install protovalidate\n```\n\n## Documentation\n\nComprehensive documentation for Protovalidate is available in [Buf's documentation library][protovalidate]. \n\nHighlights for Python developers include:\n\n* The [developer quickstart][quickstart]\n* A comprehensive RPC quickstart for [Python and gRPC][grpc-python]\n* A [migration guide for protoc-gen-validate][migration-guide] users\n\n## Additional Languages and Repositories\n\nProtovalidate isn't just for Python! You might be interested in sibling repositories for other languages: \n\n- [`protovalidate-go`][pv-go] (Go)\n- [`protovalidate-java`][pv-java] (Java)\n- [`protovalidate-cc`][pv-cc] (C++)\n- [`protovalidate-es`][pv-es] (TypeScript and JavaScript)\n\nAdditionally, [protovalidate's core repository](https://github.com/bufbuild/protovalidate) provides:\n\n- [Protovalidate's Protobuf API][validate-proto]\n- [Conformance testing utilities][conformance] for acceptance testing of `protovalidate` implementations\n\n## Contribution\n\nWe genuinely appreciate any help! If you'd like to contribute, check out these resources:\n\n- [Contributing Guidelines][contributing]: Guidelines to make your contribution process straightforward and meaningful\n- [Conformance testing utilities](https://github.com/bufbuild/protovalidate/tree/main/docs/conformance.md): Utilities providing acceptance testing of `protovalidate` implementations\n\n## Related Sites\n\n- [Buf][buf]: Enterprise-grade Kafka and gRPC for the modern age\n- [Common Expression Language (CEL)][cel]: The open-source technology at the core of Protovalidate\n\n## Legal\n\nOffered under the [Apache 2 license][license].\n\n[buf]: https://buf.build\n[cel]: https://cel.dev\n\n[pv-go]: https://github.com/bufbuild/protovalidate-go\n[pv-java]: https://github.com/bufbuild/protovalidate-java\n[pv-python]: https://github.com/bufbuild/protovalidate-python\n[pv-cc]: https://github.com/bufbuild/protovalidate-cc\n[pv-es]: https://github.com/bufbuild/protovalidate-es\n\n[buf-mod]: https://buf.build/bufbuild/protovalidate\n[license]: LICENSE\n[contributing]: .github/CONTRIBUTING.md\n\n[protoc-gen-validate]: https://github.com/bufbuild/protoc-gen-validate\n\n[protovalidate]: https://buf.build/docs/protovalidate\n[quickstart]: https://buf.build/docs/protovalidate/quickstart/\n[connect-go]: https://buf.build/docs/protovalidate/quickstart/connect-go/\n[grpc-go]: https://buf.build/docs/protovalidate/quickstart/grpc-go/\n[grpc-java]: https://buf.build/docs/protovalidate/quickstart/grpc-java/\n[grpc-python]: https://buf.build/docs/protovalidate/quickstart/grpc-python/\n[migration-guide]: https://buf.build/docs/migration-guides/migrate-from-protoc-gen-validate/\n[conformance-executable]: ./internal/cmd/protovalidate-conformance-go/README.md\n[pkg-go]: https://pkg.go.dev/github.com/bufbuild/protovalidate-go\n\n[validate-proto]: https://buf.build/bufbuild/protovalidate/docs/main:buf.validate\n[conformance]: https://github.com/bufbuild/protovalidate/blob/main/docs/conformance.md\n[examples]: https://github.com/bufbuild/protovalidate/tree/main/examples\n[migrate]: https://buf.build/docs/migration-guides/migrate-from-protoc-gen-validate/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbufbuild%2Fprotovalidate-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbufbuild%2Fprotovalidate-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbufbuild%2Fprotovalidate-python/lists"}