Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mypy: Add type hints #477

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ source =
[report]
show_missing = true
precision = 2
omit =
src/webob/types.py
exclude_lines =
pragma: no cover
@overload
if TYPE_CHECKING:
if __name__ == .__main__.
raise NotImplementedError

[html]
show_contexts = True
4 changes: 2 additions & 2 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
- run: tox -e docs
lint:
runs-on: ubuntu-22.04
name: Lint the package
name: Lint and type check the package
steps:
- uses: actions/checkout@v4
- name: Setup python
Expand All @@ -129,4 +129,4 @@ jobs:
python-version: "3.13"
architecture: x64
- run: pip install tox
- run: tox -e lint
- run: tox -e lint,mypy
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ line_length = 88
force_sort_within_sections = true
default_section = "THIRDPARTY"
known_first_party = "webob"

[tool.mypy]
python_version = 3.9
strict = true
warn_unreachable = true
mypy_path = "$MYPY_CONFIG_FILE_DIR/src"
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@
license="MIT",
packages=find_packages("src", exclude=["tests"]),
package_dir={"": "src"},
include_package_data=True,
package_data={"webob": ["py.typed"]},
python_requires=">=3.9.0",
install_requires=[
"typing-extensions>=4.12.0",
"legacy-cgi>=2.6; python_version>='3.13'",
],
zip_safe=True,
Expand Down
Loading