Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
fetch-depth: 0
persist-credentials: false

- uses: hynek/build-and-inspect-python-package@fe0a0fb1925ca263d076ca4f2c13e93a6e92a33e # v2
- uses: hynek/build-and-inspect-python-package@fe0a0fb1925ca263d076ca4f2c13e93a6e92a33e # v2.17.0

publish:
needs: [dist]
Expand Down
51 changes: 25 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,29 +93,28 @@ jobs:
- name: Run zizmor
uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2


# typechecking:
# name: "TypeChecking: pixi run typing"
# runs-on: ubuntu-latest
# if: false
# needs: cache-pixi-lock
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - uses: Parcels-code/pixi-lock/restore@38495788b79a5ff26009aecc15daa9a8310b8832 # v0.1.0
# with:
# cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }}
# - uses: prefix-dev/setup-pixi@v0.9.4
# with:
# cache: true
# pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }}
# cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
# - name: Typechecking
# run: pixi run typing --non-interactive --html-report mypy-report
# - name: Upload test results
# if: ${{ always() }} # Upload even on mypy error
# uses: actions/upload-artifact@v4
# with:
# name: Mypy report
# path: mypy-report
typechecking:
name: "TypeChecking: pixi run typing"
runs-on: ubuntu-latest
needs: cache-pixi-lock
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
persist-credentials: false
- uses: Parcels-code/pixi-lock/restore@38495788b79a5ff26009aecc15daa9a8310b8832 # v0.1.0
with:
cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }}
- uses: prefix-dev/setup-pixi@a0af7a228712d6121d37aba47adf55c1332c9c2e # v0.9.4
with:
cache: true
pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }}
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
- name: Typechecking
run: pixi run typing --non-interactive --html-report mypy-report
- name: Upload test results
if: ${{ always() }} # Upload even on mypy error
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: Mypy report
path: mypy-report
11 changes: 10 additions & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,21 @@ lint = "pre-commit run --all-files"
[feature.typing.dependencies]
mypy = "*"
lxml = "*"
pandas-stubs="*"
types-PyYAML="*"
scipy-stubs="*"
types-openpyxl = "*"
types-psutil = "*"
types-python-dateutil = "*"

[feature.typing.pypi-dependencies]
types-xlrd = "*"

[feature.typing.tasks]
typing = "mypy src/virtualship --install-types"

[environments]
default = { features = ["test", "notebooks", "typing", "pre-commit", "analysis"] }
default = { features = ["test", "notebooks", "typing", "pre-commit", "analysis"] }
test-latest = { features = ["test"], solve-group = "test" }
test-py310 = { features = ["test", "py310"] }
test-py311 = { features = ["test", "py311"] }
Expand Down
30 changes: 30 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,33 @@ ignore = [
# TODO: Remove later
"D100", "D103"
]


[tool.mypy]
files = ['src']
disable_error_code = "import-untyped"
check_untyped_defs = true
show_error_context = true
warn_redundant_casts = true
warn_unused_configs = true
warn_unused_ignores = true

exclude = [
# Temporarily exclude files. As we improve typechecking across the codebase, remove these
"src/virtualship/cli/_plan.py",
"src/virtualship/cli/_run.py",
"src/virtualship/cli/commands.py",
"src/virtualship/cli/validator_utils.py",
"src/virtualship/expedition/simulate_schedule.py",
"src/virtualship/instruments/adcp.py",
"src/virtualship/instruments/argo_float.py",
"src/virtualship/instruments/base.py",
"src/virtualship/instruments/ctd.py",
"src/virtualship/instruments/drifter.py",
"src/virtualship/instruments/ship_underwater_st.py",
"src/virtualship/instruments/xbt.py",
"src/virtualship/make_realistic/problems/simulator.py",
"src/virtualship/models/checkpoint.py",
"src/virtualship/models/expedition.py",
"src/virtualship/utils.py",
Comment on lines +133 to +148
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gradually this list should become smaller as we become typesafe in virtualship

]
Loading