Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: include proto file in build for openfeature-provider-flagd #45

Merged
merged 2 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions providers/openfeature-provider-flagd/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
proto/
8 changes: 8 additions & 0 deletions providers/openfeature-provider-flagd/buf.gen.python.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: v1
managed:
enabled: true
plugins:
- plugin: buf.build/protocolbuffers/python:v23.4
out: proto
- plugin: buf.build/grpc/python:v1.56.0
out: proto
12 changes: 10 additions & 2 deletions providers/openfeature-provider-flagd/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pyproject.toml
[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-build-scripts"]
build-backend = "hatchling.build"

[project]
Expand Down Expand Up @@ -28,13 +28,21 @@ Homepage = "https://github.com/open-feature/python-sdk-contrib"

[tool.hatch]

[[tool.hatch.build.hooks.build-scripts.scripts]]
commands = [
"./scripts/gen_protos.sh",
federicobond marked this conversation as resolved.
Show resolved Hide resolved
]
artifacts = ["proto/**/*.py"]
out_dir = "src/openfeature/contrib/provider/flagd"

[tool.hatch.envs.default]
dependencies = [
"coverage[toml]>=6.5",
"pytest",
]
post-install-commands = [
"./scripts/gen_protos.sh"
"./scripts/gen_protos.sh",
"rm -r src/openfeature/contrib/provider/flagd/proto && mv proto src/openfeature/contrib/provider/flagd",
]

[tool.hatch.envs.default.scripts]
Expand Down
9 changes: 3 additions & 6 deletions providers/openfeature-provider-flagd/scripts/gen_protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

set -e

buf generate buf.build/open-feature/flagd --template schemas/protobuf/buf.gen.python.yaml --output schemas
rm -rf openfeature/contrib/provider/flagd/proto
sed -i.bak 's/^from schema.v1 import/from . import/' proto/python/schema/v1/*.py
rm proto/python/schema/v1/*.bak
mv proto/python src/openfeature/contrib/provider/flagd/proto
rmdir proto
buf generate buf.build/open-feature/flagd --template buf.gen.python.yaml
sed -i.bak 's/^from schema.v1 import/from . import/' proto/schema/v1/*.py
rm proto/schema/v1/*.bak
Loading