Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update pre-commit hooks #690

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 11 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
ci:
autoupdate_commit_msg: "chore: update pre-commit hooks"
autoupdate_schedule: weekly
autofix_commit_msg: "style: pre-commit fixes"

repos:
- repo: https://github.com/psf/black
rev: "22.10.0"
rev: "23.1.0"
hooks:
- id: black
args:
- "--preview"

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -25,24 +26,24 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
args: ["-a", "from __future__ import annotations"]

- repo: https://github.com/asottile/pyupgrade
rev: v3.0.0
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py37-plus]

- repo: https://github.com/tox-dev/pyproject-fmt
rev: "0.3.5"
rev: "0.7.0"
hooks:
- id: pyproject-fmt

- repo: https://github.com/hadialqattan/pycln
rev: v2.1.1
rev: v2.1.3
hooks:
- id: pycln
args: [--all]
Expand All @@ -56,14 +57,14 @@ repos:
- flake8-bugbear

- repo: https://github.com/pycqa/flake8
rev: 5.0.4
rev: 6.0.0
hooks:
- id: flake8
exclude: docs/conf.py
additional_dependencies: *flake8-dependencies

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.982
rev: v1.0.0
hooks:
- id: mypy
files: ^nox/
Expand All @@ -74,12 +75,12 @@ repos:
- importlib_metadata

- repo: https://github.com/codespell-project/codespell
rev: v2.2.1
rev: v2.2.2
hooks:
- id: codespell

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
Expand Down
6 changes: 3 additions & 3 deletions nox/_option_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
self.parser_args = args
self.parser_kwargs = kwargs
self.options: collections.OrderedDict[str, Option] = collections.OrderedDict()
self.groups: collections.OrderedDict[
str, OptionGroup
] = collections.OrderedDict()
self.groups: collections.OrderedDict[str, OptionGroup] = (
collections.OrderedDict()
)

def add_options(self, *args: Option) -> None:
"""Adds a sequence of Options to the OptionSet.
Expand Down
6 changes: 4 additions & 2 deletions nox/_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@
_option_set.OptionGroup(
"environment",
"Environment options",
"These arguments are used to control Nox's creation and usage of virtual"
" environments.",
(
"These arguments are used to control Nox's creation and usage of virtual"
" environments."
),
),
_option_set.OptionGroup(
"execution",
Expand Down
2 changes: 1 addition & 1 deletion nox/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def make_session(

# Since this function is parametrized, we need to add a distinct
# session for each permutation.
parametrize = func.parametrize # type: ignore[attr-defined]
parametrize = func.parametrize
calls = Call.generate_calls(func, parametrize)
for call in calls:
long_names = []
Expand Down
6 changes: 2 additions & 4 deletions nox/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ def env(self) -> dict[str, str]:

@property
def posargs(self) -> list[str]:
"""Any extra arguments from the ``nox`` commandline or :class:`Session.notify`.
"""
"""Any extra arguments from the ``nox`` commandline or :class:`Session.notify`."""
return self._runner.posargs

@property
Expand Down Expand Up @@ -225,8 +224,7 @@ def cache_dir(self) -> pathlib.Path:

@property
def interactive(self) -> bool:
"""Returns True if Nox is being run in an interactive session or False otherwise.
"""
"""Returns True if Nox is being run in an interactive session or False otherwise."""
return not self._runner.global_config.non_interactive and sys.stdin.isatty()

@property
Expand Down
6 changes: 4 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,10 @@ def _check_python_version(session: nox.Session) -> None:
session.run(
"python",
"-c",
"import sys; assert '.'.join(str(v) for v in sys.version_info[:2]) =="
f" '{python_version}'",
(
"import sys; assert '.'.join(str(v) for v in sys.version_info[:2]) =="
f" '{python_version}'"
),
)
if python_version[:2] != "2.":
session.run(
Expand Down
16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ authors = [
{ email = "me@thea.codes" },
]
requires-python = ">=3.7"
dependencies = [
"argcomplete<3.0,>=1.9.4",
"colorlog<7.0.0,>=2.6.1",
'importlib-metadata; python_version < "3.8"',
"packaging>=20.9",
'typing-extensions>=3.7.4; python_version < "3.8"',
"virtualenv>=14",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
Expand All @@ -47,6 +39,14 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Topic :: Software Development :: Testing",
]
dependencies = [
"argcomplete<3.0,>=1.9.4",
"colorlog<7.0.0,>=2.6.1",
'importlib-metadata; python_version < "3.8"',
"packaging>=20.9",
'typing-extensions>=3.7.4; python_version < "3.8"',
"virtualenv>=14",
]
[project.optional-dependencies]
tox_to_nox = [
"jinja2",
Expand Down
14 changes: 8 additions & 6 deletions tests/test_action_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ def test_filter_version_invalid_minor():
"interpreter_2=3.8",
"interpreter_3=3.11",
],
",".join(f"3.{minor}" for minor in range(20)): ["interpreter_count=20"]
+ [
f"interpreter_{i}=3.{minor}"
for i, minor in enumerate(minor_ for minor_ in range(20) if minor_ != 11)
]
+ ["interpreter_19=3.11"],
",".join(f"3.{minor}" for minor in range(20)): (
["interpreter_count=20"]
+ [
f"interpreter_{i}=3.{minor}"
for i, minor in enumerate(minor_ for minor_ in range(20) if minor_ != 11)
]
+ ["interpreter_19=3.11"]
),
}


Expand Down
6 changes: 4 additions & 2 deletions tests/test_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1026,8 +1026,10 @@ def func(session):
session.run(
sys.executable,
"-c",
'import os; raise SystemExit(0 if os.environ["NOX_CURRENT_SESSION"] =='
f" {session.name!r} else 0)",
(
"import os; raise SystemExit(0 if"
f' os.environ["NOX_CURRENT_SESSION"] == {session.name!r} else 0)'
),
)

runner.func = func
Expand Down