diff --git a/template/.config/mypy.ini b/template/.config/mypy.ini deleted file mode 100644 index f6c48ee..0000000 --- a/template/.config/mypy.ini +++ /dev/null @@ -1,9 +0,0 @@ -[mypy] -python_version = 3.12 -strict = True - -[mypy-quartodoc.*] -ignore_missing_imports = True - -[mypy-tests.*] -disallow_untyped_defs = False diff --git a/template/.pre-commit-config.yaml b/template/.pre-commit-config.yaml index c5e4590..1d7e890 100644 --- a/template/.pre-commit-config.yaml +++ b/template/.pre-commit-config.yaml @@ -32,6 +32,7 @@ repos: rev: v1.46.2 hooks: - id: typos + args: [--config, .config/typos.toml, --force-exclude] - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. @@ -42,3 +43,13 @@ repos: args: [--fix] # Run the formatter. - id: ruff-format + + - repo: https://github.com/facebook/pyrefly-pre-commit + # Note: this is the version of the pre-commit hook, NOT the pyrefly version used for type checking. + rev: 1.2.0.dev1 + hooks: + - id: pyrefly-check + name: Pyrefly (type checking) + # Recommended to do full repo checks, not just on changed files. + pass_filenames: false + language: system diff --git a/template/.vscode/extensions.json b/template/.vscode/extensions.json index 877612b..c830a88 100644 --- a/template/.vscode/extensions.json +++ b/template/.vscode/extensions.json @@ -8,7 +8,7 @@ "GitHub.vscode-pull-request-github", "ms-python.python", "ms-python.vscode-pylance", - "matangover.mypy", + "meta.pyrefly", "njpwerner.autodocstring", "quarto.quarto", "ms-toolsai.jupyter", diff --git a/template/.vscode/settings.json b/template/.vscode/settings.json index 46d6c2e..41a8a63 100644 --- a/template/.vscode/settings.json +++ b/template/.vscode/settings.json @@ -28,8 +28,6 @@ "files.insertFinalNewline": true, "python.testing.pytestEnabled": true, "python.testing.pytestPath": "${workspaceFolder}/.venv/bin/pytest", - "mypy.runUsingActiveInterpreter": true, - "mypy.configFile": ".config/mypy.ini", "conventionalCommits.emojiFormat": "emoji", "conventionalCommits.promptScopes": false, "typos.config": ".config/typos.toml", diff --git a/template/CONTRIBUTING.md.jinja b/template/CONTRIBUTING.md.jinja index 31f7211..347a83c 100644 --- a/template/CONTRIBUTING.md.jinja +++ b/template/CONTRIBUTING.md.jinja @@ -28,7 +28,7 @@ It's easiest to install uv and justfile using install uv and justfile by running: ``` bash -pipx install uv rust-just +pipx install uv rust-just pyrefly ``` We keep all our development workflows in the `justfile`, so you can @@ -79,19 +79,15 @@ commit. such as: - `quartodoc.py`: Custom [`quartodoc`](https://machow.github.io/quartodoc/) renderer. - - `mypy.ini`: [`mypy`](https://mypy.readthedocs.io/en/stable/) - configuration file for type checking Python code. - `ruff.toml`: [Ruff](https://docs.astral.sh/ruff/) configuration file for linting and formatting Python code. - `rumdl.toml` and `panache.toml`: [rumdl](https://rumdl.dev) and [Panache](https://panache.bz) configuration file for formatting Markdown files in the project. - {% if for_seedcase -%} - `cog.toml`: [Cocogitto](https://docs.cocogitto.io) configuration file for managing versions. - `cliff.toml`: [git-cliff](https://git-cliff.org) configuration file for creating the changelog. - {%- endif %} - `.copier-answers.yml`: Contains the answers you gave when copying the package from the template. **You should not modify this file directly.** diff --git a/template/TODO.md b/template/TODO.md index c74d04d..8af94e6 100644 --- a/template/TODO.md +++ b/template/TODO.md @@ -4,7 +4,7 @@ project. - Run `git init -b main` to create the project as a Git repository. - Install these packages - `uv add --dev pytest genbadge jupyter pytest-cov quartodoc quarto types-tabulate mypy` + `uv add --dev pytest genbadge jupyter pytest-cov quartodoc quarto types-tabulate` - Run `just list-todos` and complete all the TODO items. - Run `just install-precommit` to install the pre-commit hooks. - Run `just build-readme` to build the Markdown version of the README. {%- if diff --git a/template/justfile.jinja b/template/justfile.jinja index 795f310..a9c661e 100644 --- a/template/justfile.jinja +++ b/template/justfile.jinja @@ -72,7 +72,7 @@ check-python: # Check formatting uvx ruff check . # Check types - uv run mypy --pretty . --config-file .config/mypy.ini + uvx pyrefly check # Run basic security checks on the package check-security: diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index d5b41a0..3ef8e0f 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -20,7 +20,7 @@ dependencies = [] classifiers = [ "License :: OSI Approved :: MIT License", - # Strict typing, checked via mypy + # Strict typing, checked via Pyrefly "Typing :: Typed", # How mature is this project? Common values are @@ -57,5 +57,11 @@ build-backend = "hatchling.build" # - Trigger failure if below 90% code coverage addopts = "--tb=short --import-mode=importlib --cov=src --no-cov-on-fail --cov-report=term --cov-report=xml --cov-report=html --cov-fail-under=90" +[tool.pyrefly] +project-includes = ["src/"] +min-severity = "warn" +python-version = "3.12.0" +preset = "strict" + [tool.ruff] extend = ".config/ruff.toml" diff --git a/template/tools/vulture-allowlist.py b/template/tools/vulture-allowlist.py index 44a7814..d65b8af 100644 --- a/template/tools/vulture-allowlist.py +++ b/template/tools/vulture-allowlist.py @@ -1,2 +1 @@ # ruff: noqa -# mypy: ignore-errors