chore: clean up unnecessary numpy dependency (and better pre-commit)

This commit is contained in:
Anand Balakrishnan 2023-10-04 14:33:17 -07:00
parent 246f4704c3
commit f6b26b61ab
3 changed files with 22 additions and 16 deletions

View file

@ -8,12 +8,19 @@ repos:
- id: check-added-large-files - id: check-added-large-files
- repo: local - repo: local
hooks: hooks:
- id: nox - id: nox (python)
name: nox name: nox (python)
description: Run nox fixers and linters. description: Run nox fixers and linters for Python
entry: nox -t fix style lint --no-install entry: nox -t python
language: system language: system
pass_filenames: false pass_filenames: false
types_or: types:
- rust
- python - python
- id: nox (rust)
name: nox (rust)
description: Run nox fixers and linters for Rust
entry: nox -t rust
language: system
pass_filenames: false
types:
- rust

View file

@ -37,7 +37,7 @@ def dev(session: nox.Session):
session.run("pre-commit", "install") session.run("pre-commit", "install")
@nox.session(tags=["style", "fix"], python=False) @nox.session(tags=["style", "fix", "rust"], python=False)
def rustfmt(session: nox.Session): def rustfmt(session: nox.Session):
if len(session.posargs) > 0: if len(session.posargs) > 0:
session.run("cargo", "+nightly", "fmt", *session.posargs, external=True) session.run("cargo", "+nightly", "fmt", *session.posargs, external=True)
@ -45,13 +45,13 @@ def rustfmt(session: nox.Session):
session.run("cargo", "+nightly", "fmt", "--all", external=True) session.run("cargo", "+nightly", "fmt", "--all", external=True)
@nox.session(tags=["lint", "fix"], python=False) @nox.session(tags=["lint", "fix", "rust"], python=False)
def cargo_check(session: nox.Session): def cargo_check(session: nox.Session):
session.run("cargo", "check", "--workspace", external=True) session.run("cargo", "check", "--workspace", external=True)
session.run("cargo", "clippy", "--workspace", external=True) session.run("cargo", "clippy", "--workspace", external=True)
@nox.session(tags=["style", "fix"]) @nox.session(tags=["style", "fix", "python"])
def black(session: nox.Session): def black(session: nox.Session):
session.conda_install("black") session.conda_install("black")
session.run("black", str(__file__)) session.run("black", str(__file__))
@ -59,14 +59,14 @@ def black(session: nox.Session):
session.run("black", ".") session.run("black", ".")
@nox.session(tags=["style", "fix"]) @nox.session(tags=["style", "fix", "python"])
def isort(session: nox.Session): def isort(session: nox.Session):
session.conda_install("isort") session.conda_install("isort")
with session.chdir(CURRENT_DIR / "pyargus"): with session.chdir(CURRENT_DIR / "pyargus"):
session.run("isort", ".") session.run("isort", ".")
@nox.session(tags=["lint"]) @nox.session(tags=["lint", "python"])
def flake8(session: nox.Session): def flake8(session: nox.Session):
session.conda_install( session.conda_install(
"flake8", "flake8",
@ -78,16 +78,16 @@ def flake8(session: nox.Session):
session.run("flake8") session.run("flake8")
@nox.session(tags=["lint", "fix"]) @nox.session(tags=["lint", "fix", "python"])
def ruff(session: nox.Session): def ruff(session: nox.Session):
session.conda_install("ruff") session.conda_install("ruff")
with session.chdir(CURRENT_DIR / "pyargus"): with session.chdir(CURRENT_DIR / "pyargus"):
session.run("ruff", "--fix", "--exit-non-zero-on-fix", ".") session.run("ruff", "--fix", "--exit-non-zero-on-fix", ".")
@nox.session(tags=["lint"]) @nox.session(tags=["lint", "python"])
def mypy(session: nox.Session): def mypy(session: nox.Session):
session.conda_install("mypy", "typing-extensions", "pytest", "hypothesis", "numpy") session.conda_install("mypy", "typing-extensions", "pytest", "hypothesis")
session.env.update(ENV) session.env.update(ENV)
with session.chdir(CURRENT_DIR / "pyargus"): with session.chdir(CURRENT_DIR / "pyargus"):

View file

@ -25,7 +25,7 @@ dev = [
"black", "black",
] ]
test = ["pytest", "pytest-cov", "hypothesis", "numpy"] test = ["pytest", "pytest-cov", "hypothesis"]
[build-system] [build-system]
requires = ["maturin>=1.0,<2.0"] requires = ["maturin>=1.0,<2.0"]
@ -44,7 +44,6 @@ testpaths = ["tests"]
packages = ["argus"] packages = ["argus"]
# ignore_missing_imports = true # ignore_missing_imports = true
show_error_codes = true show_error_codes = true
plugins = ["numpy.typing.mypy_plugin"]
[tool.ruff] [tool.ruff]
line-length = 127 line-length = 127