Skip to content

Commit

Permalink
build: setup mypy for each package independently (#116)
Browse files Browse the repository at this point in the history
setup mypy for each package independently

Signed-off-by: gruebel <[email protected]>
  • Loading branch information
gruebel authored Nov 27, 2024
1 parent 5adc68a commit 61e42e7
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
package:
- "hooks/openfeature-hooks-opentelemetry"
- "providers/openfeature-provider-flagd"
- "providers/openfeature-provider-ofrep"

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

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

Expand Down
16 changes: 0 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,3 @@ repos:
- id: check-yaml
- id: trailing-whitespace
- id: check-merge-conflict

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
hooks:
- id: mypy
args: [--python-version=3.8]
additional_dependencies:
- openfeature-sdk>=0.4.0
- opentelemetry-api
- types-protobuf
- types-PyYAML
- types-requests
- mmh3
- semver
- panzi-json-logic
exclude: providers/openfeature-provider-flagd|tests
21 changes: 21 additions & 0 deletions hooks/openfeature-hooks-opentelemetry/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,31 @@ cov = [
"cov-report",
]

[tool.hatch.envs.mypy]
dependencies = [
"mypy[faster-cache]>=1.13.0",
]

[tool.hatch.envs.mypy.scripts]
run = "mypy"

[tool.hatch.build.targets.sdist]
exclude = [
".gitignore",
]

[tool.hatch.build.targets.wheel]
packages = ["src/openfeature"]

[tool.mypy]
mypy_path = "src"
files = "src"

python_version = "3.8" # should be identical to the minimum supported version
namespace_packages = true
explicit_package_bases = true
local_partial_types = true
pretty = true

strict = true
disallow_any_generics = false
33 changes: 28 additions & 5 deletions providers/openfeature-provider-ofrep/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,36 @@ Homepage = "https://github.com/open-feature/python-sdk-contrib"

[tool.hatch]

[tool.hatch.envs.default]
[tool.hatch.envs.hatch-test]
dependencies = [
"coverage[toml]>=6.5",
"pytest",
"requests-mock",
"types-requests",
]

[tool.hatch.envs.default.scripts]
test = "pytest {args:tests}"
test-cov = "coverage run -m pytest {args:tests}"
[tool.hatch.envs.hatch-test.scripts]
run = "pytest {args:tests}"
run-cov = "coverage run -m pytest {args:tests}"
cov-combine = "coverage combine"
cov-report = [
"coverage xml",
"coverage html",
"coverage report",
]
cov = [
"test-cov",
"cov-report",
]

[tool.hatch.envs.mypy]
dependencies = [
"mypy[faster-cache]>=1.13.0",
"types-requests",
]

[tool.hatch.envs.mypy.scripts]
run = "mypy"

[tool.hatch.build.targets.sdist]
exclude = [
".gitignore",
Expand All @@ -60,3 +70,16 @@ packages = ["src/openfeature"]
omit = [
"tests/**",
]

[tool.mypy]
mypy_path = "src"
files = "src"

python_version = "3.8" # should be identical to the minimum supported version
namespace_packages = true
explicit_package_bases = true
local_partial_types = true
pretty = true

strict = true
disallow_any_generics = false

0 comments on commit 61e42e7

Please sign in to comment.