diff --git a/.github/workflows/ty.yml b/.github/workflows/ty.yml new file mode 100644 index 00000000..5ddd2d9e --- /dev/null +++ b/.github/workflows/ty.yml @@ -0,0 +1,28 @@ +name: "ty CI" + +on: + push: + branches: [ "master", "development" ] + pull_request: + branches: [ "master" , "development" ] + +jobs: + type_checker: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.12" + + - name: Install uv + run: pip install uv + + - name: Install Dependencies + run: uv sync --all-extras + + - name: ty Type Checking + run: uv run ty check diff --git a/pyproject.toml b/pyproject.toml index ea45feb1..14e9bae0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ dependencies = [ ] [project.optional-dependencies] -dev = ["ruff>=0.14.2", "jupytext"] +dev = ["ruff>=0.14.2", "jupytext", "ty"] docs = ["sphinx>=8.2.3", "sphinx-autoapi>=3.6.1", "sphinx-rtd-theme>=3.0.2"] notebooks = ["ipykernel"] diff --git a/ty.toml b/ty.toml new file mode 100644 index 00000000..a4586b52 --- /dev/null +++ b/ty.toml @@ -0,0 +1,41 @@ +[src] +# Ignore files that haven't been typed yet. +# As files are typed, they can be removed from this list. +# DO NOT ADD NEW FILES TO THIS LIST, NEW FILES SHOULD BE TYPED. +exclude = [ + "notebooks/demo_data_driven.ipynb", + "notebooks/demo_data_driven.py", + "notebooks/demo_fcsa.ipynb", + "notebooks/demo_fcsa.py", + "notebooks/demo_problem.ipynb", + "notebooks/demo_problem.py", + "scripts/list_directories.py", + "scripts/run_experiment.py", + "simopt/directory.py", + "simopt/experiment_base.py", + "simopt/gui/data_farming_window.py", + "simopt/gui/new_experiment_window.py", + "simopt/gui/plot_window.py", + "simopt/model.py", + "simopt/models/amusementpark.py", + "simopt/models/chessmm.py", + "simopt/models/cntnv.py", + "simopt/models/dualsourcing.py", + "simopt/models/dynamnews.py", + "simopt/models/facilitysizing.py", + "simopt/models/ironore.py", + "simopt/models/network.py", + "simopt/models/tableallocation.py", + "simopt/problem.py", + "simopt/solvers/astrodf.py", + "simopt/solvers/fcsa.py", + "simopt/utils.py", + "test/test_experiments.py", +] + +# See https://docs.astral.sh/ty/reference/rules/ for Rules documentation. +# Rule options are ["error", "warn", "ignore"] +[rules] +division-by-zero = "warn" # Default is "ignore" +possibly-unresolved-reference = "warn" # Default is "ignore" +unused-ignore-comment = "warn" # Default is "ignore"