Skip to content

Commit b5aa8a1

Browse files
committed
chore: continue migrating to hatch
Signed-off-by: Federico Bond <[email protected]>
1 parent 5936527 commit b5aa8a1

File tree

9 files changed

+91
-27
lines changed

9 files changed

+91
-27
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jobs:
2222
strategy:
2323
matrix:
2424
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
25+
package:
26+
- "hooks/openfeature-hooks-opentelemetry"
27+
- "providers/openfeature-provider-flagd"
2528

2629
steps:
2730
- uses: actions/checkout@v4
@@ -38,20 +41,19 @@ jobs:
3841
with:
3942
github_token: ${{ github.token }}
4043

41-
- name: Install dependencies
42-
run: make venv
43-
44-
- name: Generate flagd protobuf files
45-
run: make grpc
44+
- name: Install hatch
45+
run: pip install hatch
4646

4747
- name: Test with pytest
48-
run: make testcov
48+
run: hatch run cov
49+
working-directory: ${{ matrix.package }}
4950

5051
- name: Upload coverage to Codecov
51-
uses: codecov/codecov-action@e0fbd592d323cb2991fb586fdd260734fcb41fcb
52+
uses: codecov/codecov-action@v3
5253
with:
5354
flags: unittests # optional
5455
name: coverage # optional
56+
directory: ${{ matrix.package }}
5557
fail_ci_if_error: true # optional (default = false)
5658
verbose: true # optional (default = false)
5759

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# pyproject.toml
22
[build-system]
3-
requires = ["setuptools>=61.0.0", "wheel"]
4-
build-backend = "setuptools.build_meta"
3+
requires = ["hatchling"]
4+
build-backend = "hatchling.build"
55

66
[project]
77
name = "openfeature-hooks-opentelemetry"
88
version = "0.1.0"
99
description = "OpenTelemetry hooks for the OpenFeature Python SDK"
10-
readme = "readme.md"
10+
readme = "README.md"
1111
authors = [{ name = "OpenFeature", email = "[email protected]" }]
1212
license = { file = "LICENSE" }
1313
classifiers = [
@@ -16,13 +16,38 @@ classifiers = [
1616
"Programming Language :: Python :: 3",
1717
]
1818
keywords = []
19-
dependencies = []
20-
requires-python = ">=3.8"
21-
22-
[project.optional-dependencies]
23-
tests = [
24-
'pytest',
19+
dependencies = [
20+
"openfeature-sdk>=0.4.0",
21+
"opentelemetry-api",
2522
]
23+
requires-python = ">=3.8"
2624

2725
[project.urls]
2826
Homepage = "https://github.com/open-feature/python-sdk-contrib"
27+
28+
[tool.hatch]
29+
30+
[tool.hatch.envs.default]
31+
dependencies = [
32+
"coverage[toml]>=6.5",
33+
"pytest",
34+
]
35+
36+
[tool.hatch.envs.default.scripts]
37+
test = "pytest {args:tests}"
38+
test-cov = "coverage run -m pytest {args:tests}"
39+
cov-report = [
40+
"coverage report",
41+
]
42+
cov = [
43+
"test-cov",
44+
"cov-report",
45+
]
46+
47+
[tool.hatch.build.targets.sdist]
48+
exclude = [
49+
".gitignore",
50+
]
51+
52+
[tool.hatch.build.targets.wheel]
53+
packages = ["src/openfeature"]
Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# pyproject.toml
22
[build-system]
3-
requires = ["setuptools>=61.0.0", "wheel"]
4-
build-backend = "setuptools.build_meta"
3+
requires = ["hatchling"]
4+
build-backend = "hatchling.build"
55

66
[project]
77
name = "openfeature-provider-flagd"
88
version = "0.1.0"
99
description = "OpenFeature provider for the flagd flag evaluation engine"
10-
readme = "readme.md"
10+
readme = "README.md"
1111
authors = [{ name = "OpenFeature", email = "[email protected]" }]
1212
license = { file = "LICENSE" }
1313
classifiers = [
@@ -16,16 +16,43 @@ classifiers = [
1616
"Programming Language :: Python :: 3",
1717
]
1818
keywords = []
19-
dependencies = []
20-
requires-python = ">=3.8"
21-
22-
[project.optional-dependencies]
23-
tests = [
24-
'pytest',
19+
dependencies = [
20+
"openfeature-sdk>=0.4.0",
21+
"grpcio>=1.60.0",
22+
"protobuf>=4.25.2",
2523
]
24+
requires-python = ">=3.8"
2625

2726
[project.urls]
2827
Homepage = "https://github.com/open-feature/python-sdk-contrib"
2928

30-
[tool.setuptools.packages.find]
31-
exclude = ["schemas"]
29+
[tool.hatch]
30+
31+
[tool.hatch.envs.default]
32+
dependencies = [
33+
"coverage[toml]>=6.5",
34+
"pytest",
35+
]
36+
post-install-commands = [
37+
"./scripts/gen_protos.sh"
38+
]
39+
40+
[tool.hatch.envs.default.scripts]
41+
test = "pytest {args:tests}"
42+
test-cov = "coverage run -m pytest {args:tests}"
43+
cov-report = [
44+
"coverage report",
45+
]
46+
cov = [
47+
"test-cov",
48+
"cov-report",
49+
]
50+
51+
[tool.hatch.build.targets.sdist]
52+
exclude = [
53+
".gitignore",
54+
"schemas",
55+
]
56+
57+
[tool.hatch.build.targets.wheel]
58+
packages = ["src/openfeature"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
buf generate buf.build/open-feature/flagd --template schemas/protobuf/buf.gen.python.yaml --output schemas
6+
rm -rf openfeature/contrib/provider/flagd/proto
7+
sed -i.bak 's/^from schema.v1 import/from . import/' proto/python/schema/v1/*.py
8+
rm proto/python/schema/v1/*.bak
9+
mv proto/python src/openfeature/contrib/provider/flagd/proto
10+
rmdir proto

0 commit comments

Comments
 (0)