diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index db8baf1..3e642ff 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -29,10 +29,8 @@ jobs: - name: Lint run: | set -euo pipefail - # Tell us what version we are using ruff version - # Check the source file, ignore type annotations (ANN) for now. - ruff check numpy_financial/ benchmarks/ --ignore F403 --select E,F,B,I + ruff check numpy_financial/ benchmarks/ - name: Build project run: | spin build -v diff --git a/.spin/cmds.py b/.spin/cmds.py new file mode 100644 index 0000000..ab34035 --- /dev/null +++ b/.spin/cmds.py @@ -0,0 +1,19 @@ +import click +import spin + +@click.command() +@click.option( + '--fix', + is_flag=True, + default=False, + required=False, +) +def lint(fix): + """🔦 Run lint and typing checks + + """ + ruff_flags = ["--fix"] if fix else [] + spin.util.run(["ruff", "check", "numpy_financial/", "benchmarks/"] + ruff_flags) + + spin.util.run(["pyright"]) + spin.util.run(["mypy", "--no-incremental", "."]) diff --git a/pyproject.toml b/pyproject.toml index af2eb18..31e03c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,6 +54,8 @@ doc = [ dev = [ "ruff>=0.11.5", "asv>=0.6.0", + "mypy", + "pyright" ] @@ -82,6 +84,8 @@ exclude = [ ] stubPath = "." typeCheckingMode = "standard" +# _cfinancial is a Cython extension, so we only have a .pyi stub +reportMissingModuleSource = "none" [tool.spin] @@ -103,3 +107,11 @@ package = 'numpy_financial' "spin.cmds.meson.python", "spin.cmds.meson.run" ] +"Lint" = [ + ".spin/cmds.py:lint" +] + + +[tool.ruff.lint] +ignore = ["F403"] +select = ["E", "F", "B", "I"]