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

Implement mypy #344

Merged
merged 10 commits into from
Oct 15, 2023
Merged
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
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
matrix:
include:
- { python: "3.11", os: "ubuntu-latest", session: "pre-commit" }
- { python: "3.11", os: "ubuntu-latest", session: "mypy" }
- { python: "3.10", os: "ubuntu-latest", session: "mypy" }
- { python: "3.9", os: "ubuntu-latest", session: "mypy" }
- { python: "3.11", os: "ubuntu-latest", session: "tests" }
- { python: "3.10", os: "ubuntu-latest", session: "tests" }
- { python: "3.9", os: "ubuntu-latest", session: "tests" }
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ __pycache__/

# benchmark results
.benchmarks/

# mypy cache
.mypy_cache/
16 changes: 16 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
nox.needs_version = ">= 2021.6.6"
nox.options.sessions = (
"pre-commit",
"mypy",
"tests",
"docs-build",
)
Expand Down Expand Up @@ -137,6 +138,21 @@ def precommit(session: Session) -> None:
activate_virtualenv_in_precommit_hooks(session)


@session(python=python_versions)
def mypy(session: Session) -> None:
"""Type-check using mypy.

Args:
session: Nox session
"""
args = session.posargs or ["src", "docs/conf.py"]
session.install(".")
session.install("mypy", "pytest")
session.run("mypy", *args)
if not session.posargs:
session.run("mypy", f"--python-executable={sys.executable}", "noxfile.py")


@session(python=python_versions)
def tests(session: Session) -> None:
"""Run the test suite.
Expand Down
48 changes: 47 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ ipykernel = "^6.25.2"
ipython = "^8.16.1"
ipywidgets = "^8.1.1"
isort = "^5.12.0"
mypy ="^1.6.0"
nbconvert = "^7.9.2"
nbsphinx = "^0.9.3"
notebook = "^7.0.4"
Expand Down Expand Up @@ -117,6 +118,26 @@ show_missing = true
profile = "black"
lines_after_imports = 2

[tool.mypy]
strict = true
# output formatting
pretty = true
show_column_numbers = true
show_error_context = true

[[tool.mypy.overrides]]
module = [
"cad_to_shapely.*",
"mpl_toolkits.*",
"numba.*",
"pypardiso.*",
"rhino_shapely_interop.*",
"scipy.*",
"shapely.*",
"triangle.*",
]
ignore_missing_imports = true

[tool.pytest.ini_options]
markers = [
"benchmark_suite: entire benchmark test suite (select with '-m benchmark_suite')",
Expand Down
Loading
Loading