Skip to content

Commit 4532182

Browse files
authored
fix: Implement typing check in run time with typeguard (#17)
1 parent bc2d02c commit 4532182

15 files changed

+293
-120
lines changed

.pre-commit-config.yaml

+17-9
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,23 @@ default_stages:
22
- commit
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.1.0
5+
rev: v4.6.0
66
hooks:
7+
- id: trailing-whitespace
78
- id: end-of-file-fixer
9+
- id: check-json
10+
- id: check-toml
11+
- id: check-xml
12+
- id: debug-statements
13+
- id: check-builtin-literals
14+
- id: check-case-conflict
15+
- id: check-docstring-first
16+
- id: detect-private-key
817

918
- repo: https://github.com/pre-commit/mirrors-prettier
1019
rev: "v3.0.2"
1120
hooks:
1221
- id: prettier
13-
exclude: ".makim.yaml"
1422

1523
- repo: local
1624
hooks:
@@ -38,13 +46,13 @@ repos:
3846
types:
3947
- python
4048

41-
- id: mypy
42-
name: mypy
43-
entry: mypy .
44-
language: system
45-
pass_filenames: false
46-
types:
47-
- python
49+
# - id: mypy
50+
# name: mypy
51+
# entry: mypy .
52+
# language: system
53+
# pass_filenames: false
54+
# types:
55+
# - python
4856

4957
- id: shellcheck
5058
name: shellcheck

poetry.lock

+58-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+21-13
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ requires-python = ">3.9,<4"
2020
dependencies = [
2121
"requests (>=2.20.0)",
2222
"lxml (>=5.1.0)",
23+
"types-lxml >=2023.10.21",
24+
"typeguard >= 4",
25+
"eval-type-backport >=0.2 ; python_version < '3.10'",
26+
"types-requests (>=2.32)",
27+
"typing-extensions (>=4.12)",
2328
]
2429

2530
[build-system]
@@ -51,7 +56,7 @@ mkdocstrings-python = ">=1.1.2"
5156
jupyterlab = ">=4.0.5"
5257
makim = "1.12.0"
5358
requests-cache = ">=1"
54-
types-lxml = "^2023.10.21"
59+
5560

5661
[tool.pytest.ini_options]
5762
testpaths = [
@@ -72,11 +77,14 @@ verbose = false
7277
line-length = 79
7378
force-exclude = true
7479
src = ["./"]
75-
ignore = ["PLR0913"]
7680
exclude = [
7781
'docs',
7882
'examples',
7983
]
84+
fix = true
85+
86+
[tool.ruff.lint]
87+
ignore = ["PLR0913"]
8088
select = [
8189
"E", # pycodestyle
8290
"F", # pyflakes
@@ -86,12 +94,11 @@ select = [
8694
"RUF", # Ruff-specific rules
8795
"I001", # isort
8896
]
89-
fix = true
9097

91-
[tool.ruff.pydocstyle]
98+
[tool.ruff.lint.pydocstyle]
9299
convention = "numpy"
93100

94-
[tool.ruff.isort]
101+
[tool.ruff.lint.isort]
95102
# Use a single line between direct and from import
96103
lines-between-types = 1
97104

@@ -100,14 +107,15 @@ quote-style = "double"
100107

101108

102109
[tool.mypy]
110+
python_version = "3.9"
103111
no_strict_optional = false
112+
# check_untyped_defs = true
113+
# strict = true
114+
# ignore_missing_imports = true
115+
# warn_unused_ignores = true
116+
# warn_redundant_casts = true
117+
# warn_unused_configs = true
104118
exclude = [
105-
'^docs/$',
106-
'^examples/$',
107-
]
108-
109-
[[tool.mypy.overrides]]
110-
module = [
111-
"requests",
119+
'^docs/$',
120+
'^examples/$',
112121
]
113-
ignore_missing_imports = true

0 commit comments

Comments
 (0)