Skip to content

Commit 61e42e7

Browse files
authored
build: setup mypy for each package independently (#116)
setup mypy for each package independently Signed-off-by: gruebel <[email protected]>
1 parent 5adc68a commit 61e42e7

File tree

4 files changed

+51
-23
lines changed

4 files changed

+51
-23
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
package:
3030
- "hooks/openfeature-hooks-opentelemetry"
3131
- "providers/openfeature-provider-flagd"
32+
- "providers/openfeature-provider-ofrep"
3233

3334
steps:
3435
- uses: actions/checkout@v4
@@ -49,8 +50,7 @@ jobs:
4950
working-directory: ${{ matrix.package }}
5051

5152
- name: Type checking
52-
# TODO: migrate other packages to use their own 'mypy' setup
53-
if: matrix.python-version == '3.11' && matrix.package == 'providers/openfeature-provider-flagd'
53+
if: matrix.python-version == '3.11'
5454
working-directory: ${{ matrix.package }}
5555
run: hatch run mypy:run
5656

.pre-commit-config.yaml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,3 @@ repos:
1414
- id: check-yaml
1515
- id: trailing-whitespace
1616
- id: check-merge-conflict
17-
18-
- repo: https://github.com/pre-commit/mirrors-mypy
19-
rev: v1.11.2
20-
hooks:
21-
- id: mypy
22-
args: [--python-version=3.8]
23-
additional_dependencies:
24-
- openfeature-sdk>=0.4.0
25-
- opentelemetry-api
26-
- types-protobuf
27-
- types-PyYAML
28-
- types-requests
29-
- mmh3
30-
- semver
31-
- panzi-json-logic
32-
exclude: providers/openfeature-provider-flagd|tests

hooks/openfeature-hooks-opentelemetry/pyproject.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,31 @@ cov = [
5050
"cov-report",
5151
]
5252

53+
[tool.hatch.envs.mypy]
54+
dependencies = [
55+
"mypy[faster-cache]>=1.13.0",
56+
]
57+
58+
[tool.hatch.envs.mypy.scripts]
59+
run = "mypy"
60+
5361
[tool.hatch.build.targets.sdist]
5462
exclude = [
5563
".gitignore",
5664
]
5765

5866
[tool.hatch.build.targets.wheel]
5967
packages = ["src/openfeature"]
68+
69+
[tool.mypy]
70+
mypy_path = "src"
71+
files = "src"
72+
73+
python_version = "3.8" # should be identical to the minimum supported version
74+
namespace_packages = true
75+
explicit_package_bases = true
76+
local_partial_types = true
77+
pretty = true
78+
79+
strict = true
80+
disallow_any_generics = false

providers/openfeature-provider-ofrep/pyproject.toml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,36 @@ Homepage = "https://github.com/open-feature/python-sdk-contrib"
2727

2828
[tool.hatch]
2929

30-
[tool.hatch.envs.default]
30+
[tool.hatch.envs.hatch-test]
3131
dependencies = [
3232
"coverage[toml]>=6.5",
3333
"pytest",
3434
"requests-mock",
35-
"types-requests",
3635
]
3736

38-
[tool.hatch.envs.default.scripts]
39-
test = "pytest {args:tests}"
40-
test-cov = "coverage run -m pytest {args:tests}"
37+
[tool.hatch.envs.hatch-test.scripts]
38+
run = "pytest {args:tests}"
39+
run-cov = "coverage run -m pytest {args:tests}"
40+
cov-combine = "coverage combine"
4141
cov-report = [
4242
"coverage xml",
4343
"coverage html",
44+
"coverage report",
4445
]
4546
cov = [
4647
"test-cov",
4748
"cov-report",
4849
]
4950

51+
[tool.hatch.envs.mypy]
52+
dependencies = [
53+
"mypy[faster-cache]>=1.13.0",
54+
"types-requests",
55+
]
56+
57+
[tool.hatch.envs.mypy.scripts]
58+
run = "mypy"
59+
5060
[tool.hatch.build.targets.sdist]
5161
exclude = [
5262
".gitignore",
@@ -60,3 +70,16 @@ packages = ["src/openfeature"]
6070
omit = [
6171
"tests/**",
6272
]
73+
74+
[tool.mypy]
75+
mypy_path = "src"
76+
files = "src"
77+
78+
python_version = "3.8" # should be identical to the minimum supported version
79+
namespace_packages = true
80+
explicit_package_bases = true
81+
local_partial_types = true
82+
pretty = true
83+
84+
strict = true
85+
disallow_any_generics = false

0 commit comments

Comments
 (0)