From cdb1f08a875c81e107cf9c9061ea980e00729159 Mon Sep 17 00:00:00 2001 From: David A Roberts Date: Wed, 30 Oct 2024 18:33:08 +1000 Subject: [PATCH] Add CI job for mypy --- .github/workflows/mypy.yml | 40 ++++++++++++++++++++++++++++++++++++++ pyproject.toml | 6 +++++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/mypy.yml diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml new file mode 100644 index 000000000..54cbcd302 --- /dev/null +++ b/.github/workflows/mypy.yml @@ -0,0 +1,40 @@ +name: Mathics3 (Type checking) + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.12'] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + sudo apt update -qq && sudo apt install llvm-dev remake + python -m pip install --upgrade pip + # We can comment out after next Mathics-Scanner release + # python -m pip install -e git+https://github.com/Mathics3/mathics-scanner#egg=Mathics-Scanner[full] + git clone https://github.com/Mathics3/mathics-scanner.git + cd mathics-scanner/ + pip install -e . + cd .. + + - name: Install Mathics with minimum dependencies + run: | + make develop + - name: Run mypy + run: | + pip install mypy==1.13 sympy==1.12 + touch ./mathics-scanner/mathics_scanner/py.typed + pip install ./mathics-scanner/ + mypy --install-types --non-interactive mathics diff --git a/pyproject.toml b/pyproject.toml index dc2b9b2c1..f6731c766 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -118,5 +118,9 @@ version = {attr = "mathics.version.__version__"} force_union_syntax = true [[tool.mypy.overrides]] -module = ["mpmath", "llvmlite.*"] +module = ["mpmath", "llvmlite.*", "trepan.*"] ignore_missing_imports = true + +[[tool.mypy.overrides]] +module = ["mathics.benchmark", "mathics.builtin.*", "mathics.eval.*", "test.*"] +ignore_errors = true