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: bump linting versions to latest #528

Merged
merged 2 commits into from Dec 23, 2021
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
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -76,3 +76,6 @@ target/

# PyCharm
.idea/

# Standard venv location
.venv
4 changes: 2 additions & 2 deletions nox/_decorators.py
Expand Up @@ -16,7 +16,7 @@
import functools
import inspect
import types
from typing import Any, Callable, Dict, Iterable, List, Optional, cast
from typing import Any, Callable, Dict, Iterable, List, Optional

from . import _typing

Expand All @@ -29,7 +29,7 @@ def __new__(
cls, func: Callable[..., Any], *args: Any, **kwargs: Any
) -> "FunctionDecorator":
obj = super().__new__(cls)
return cast("FunctionDecorator", functools.wraps(func)(obj))
return functools.wraps(func)(obj)


def _copy_func(src: Callable, name: Optional[str] = None) -> Callable:
Expand Down
2 changes: 1 addition & 1 deletion nox/_parametrize.py
Expand Up @@ -155,7 +155,7 @@ def parametrize_decorator(


def update_param_specs(
param_specs: Iterable[Param], new_specs: List[Param]
param_specs: Optional[Iterable[Param]], new_specs: List[Param]
) -> List[Param]:
"""Produces all combinations of the given sets of specs."""
if not param_specs:
Expand Down
3 changes: 1 addition & 2 deletions nox/tasks.py
Expand Up @@ -63,8 +63,7 @@ def _load_and_exec_nox_module(global_config: Namespace) -> types.ModuleType:
if not loader: # pragma: no cover
raise IOError(f"Could not get module loader for {global_config.noxfile}")
# See https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
# unsure why mypy doesn't like this
loader.exec_module(module) # type: ignore
loader.exec_module(module)
return module


Expand Down
20 changes: 11 additions & 9 deletions noxfile.py
Expand Up @@ -90,34 +90,36 @@ def cover(session):
session.run("coverage", "erase")


@nox.session(python="3.8")
black_pins = ["black==21.12b0", "isort==5.10.1"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something we can do is having the linting dependencies on a requirements file, and enable Dependabot updates? That way, we don't have to stay alert for PyPI updates, and we can focus on checking what Dependabot suggests. Remember that Dependabot will only change pinned versions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two projects I know of using dependabot for Python (SciPy, manylinux) both dropped it gladly. I personally use it for actions updates, for which it works really well. I don't think I use it for Python anywhere, so I can't address why they didn't like it, though I think it partially was really finicky and not interested in accepting PRs to fix Python issues. I think pre-commit.ci is superior if you'd like to go that way. But not in this PR, I could whip up a pre-commit PR after this one if you'd like to see it.



@nox.session(python="3.9")
def blacken(session):
"""Run black code formatter."""
session.install("black==21.5b2", "isort==5.8.0")
session.install(*black_pins)
files = ["nox", "tests", "noxfile.py", "docs/conf.py"]
session.run("black", *files)
session.run("isort", *files)


@nox.session(python="3.8")
@nox.session(python="3.9")
def lint(session):
session.install(
"flake8==3.9.2",
"black==21.6b0",
"isort==5.8.0",
"mypy==0.902",
*black_pins,
"flake8==4.0.1",
"mypy==0.930",
"types-jinja2",
"packaging",
"importlib_metadata",
)
session.run("mypy")
session.run("mypy", "--show-error-codes")
files = ["nox", "tests", "noxfile.py", "docs/conf.py"]
session.run("black", "--check", *files)
session.run("isort", "--check", *files)
session.run("flake8", *files)


@nox.session(python="3.8")
@nox.session(python="3.9")
def docs(session):
"""Build the documentation."""
output_dir = os.path.join(session.create_tmp(), "output")
Expand Down