Skip to content

Commit

Permalink
Speed up pre-commit pyright execution
Browse files Browse the repository at this point in the history
  • Loading branch information
object-Object committed Apr 7, 2024
1 parent e533bc4 commit 11d7d2a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ repos:
hooks:
- id: pyright
name: pyright
entry: nox -s precommit_pyright --
entry: nox -s pyright --
language: python
language_version: '3.11'
additional_dependencies: [nox]
additional_dependencies:
- nox>=2024.03.02
types_or: [python, pyi]
require_serial: true
21 changes: 5 additions & 16 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
def pyright(session: nox.Session):
session.install("-e", ".[test]")

if os.getenv("RUNNER_DEBUG") == "1" or "--verbose" in session.posargs:
session.run("pyright", "--version")
session.run("pyright", "--warnings", "--verbose")
else:
session.run("pyright", "--warnings")
args = ["--warnings", *session.posargs]
if os.getenv("RUNNER_DEBUG") == "1" and "--verbose" not in args:
args.append("--verbose")

session.run("pyright", *args)


@nox.session(tags=["test"])
Expand Down Expand Up @@ -116,17 +116,6 @@ def test_copier(session: nox.Session):
)


# pre-commit


@nox.session(python=False)
def precommit_pyright(session: nox.Session):
session.run("pip", "install", "--upgrade", "pyright")
session.run("pip", "install", "-e", ".[test]")

session.run("pyright", "--warnings", *session.posargs)


# CI/CD


Expand Down

0 comments on commit 11d7d2a

Please sign in to comment.