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
- repo: local
hooks:
- id: nox
name: nox
description: Run nox fixers and linters.
entry: nox -t fix style lint --no-install
- id: nox (python)
name: nox (python)
description: Run nox fixers and linters for Python
entry: nox -t python
language: system
pass_filenames: false
types_or:
- rust
types:
- 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")
@nox.session(tags=["style", "fix"], python=False)
@nox.session(tags=["style", "fix", "rust"], python=False)
def rustfmt(session: nox.Session):
if len(session.posargs) > 0:
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)
@nox.session(tags=["lint", "fix"], python=False)
@nox.session(tags=["lint", "fix", "rust"], python=False)
def cargo_check(session: nox.Session):
session.run("cargo", "check", "--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):
session.conda_install("black")
session.run("black", str(__file__))
@ -59,14 +59,14 @@ def black(session: nox.Session):
session.run("black", ".")
@nox.session(tags=["style", "fix"])
@nox.session(tags=["style", "fix", "python"])
def isort(session: nox.Session):
session.conda_install("isort")
with session.chdir(CURRENT_DIR / "pyargus"):
session.run("isort", ".")
@nox.session(tags=["lint"])
@nox.session(tags=["lint", "python"])
def flake8(session: nox.Session):
session.conda_install(
"flake8",
@ -78,16 +78,16 @@ def flake8(session: nox.Session):
session.run("flake8")
@nox.session(tags=["lint", "fix"])
@nox.session(tags=["lint", "fix", "python"])
def ruff(session: nox.Session):
session.conda_install("ruff")
with session.chdir(CURRENT_DIR / "pyargus"):
session.run("ruff", "--fix", "--exit-non-zero-on-fix", ".")
@nox.session(tags=["lint"])
@nox.session(tags=["lint", "python"])
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)
with session.chdir(CURRENT_DIR / "pyargus"):

View file

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