build: setup mypy for each package independently (#116)

setup mypy for each package independently

Signed-off-by: gruebel <anton.gruebel@gmail.com>
This commit is contained in:
Anton Grübel 2024-11-28 00:06:18 +01:00 committed by GitHub
parent 5adc68af00
commit 61e42e7bcf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 51 additions and 23 deletions

View File

@ -29,6 +29,7 @@ jobs:
package:
- "hooks/openfeature-hooks-opentelemetry"
- "providers/openfeature-provider-flagd"
- "providers/openfeature-provider-ofrep"
steps:
- uses: actions/checkout@v4
@ -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

View File

@ -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

View File

@ -50,6 +50,14 @@ 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",
@ -57,3 +65,16 @@ exclude = [
[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

View File

@ -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",
@ -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