diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..06f31b5 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,21 @@ +version: 2 +updates: + + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: "weekly" + day: "friday" + + - package-ecosystem: pip + directory: "/" + schedule: + interval: "weekly" + day: "friday" + ignore: + - dependency-name: ruff + update-types: + # Cut the frequency of linter Dependabot PRs. + # Ruff is 0ver, so this ignores all non-"major" releases. + - "version-update:semver-patch" + diff --git a/README.rst b/README.rst index 7b728ea..089e0cd 100644 --- a/README.rst +++ b/README.rst @@ -202,7 +202,7 @@ Once the final version is made, it will become: .. |pypi| image:: http://img.shields.io/pypi/v/incremental.svg :alt: PyPI - :target: https://pypi.python.org/pypi/incremental + :target: https://pypi.org/project/incremental/ .. |calver| image:: https://img.shields.io/badge/calver-YY.MM.MICRO-22bfda.svg :alt: calver: YY.MM.MICRO diff --git a/pyproject.toml b/pyproject.toml index 97f3a1d..5055314 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ backend-path = [".", "./src"] # See _build_meta.py build-backend = "_build_meta:build_meta" [project] -name = "incremental" +name = "Incremental" dynamic = ["version"] maintainers = [ {name = "Amber Brown", email = "hawkowl@twistedmatrix.com"}, @@ -60,8 +60,16 @@ version = {attr = "incremental._setuptools_version"} [tool.incremental] -[tool.black] -target-version = ['py36', 'py37', 'py38'] +[tool.ruff.lint] +select = [ + "E", + "F", + "UP", + "I", +] +ignore = [ + "E501", +] [tool.towncrier] filename = "NEWS.rst" diff --git a/requirements_lint.in b/requirements_lint.in new file mode 100644 index 0000000..af3ee57 --- /dev/null +++ b/requirements_lint.in @@ -0,0 +1 @@ +ruff diff --git a/requirements_lint.txt b/requirements_lint.txt new file mode 100644 index 0000000..6548bf4 --- /dev/null +++ b/requirements_lint.txt @@ -0,0 +1,8 @@ +# +# This file is autogenerated by pip-compile with Python 3.10 +# by the following command: +# +# pip-compile --output-file=requirements_lint.txt requirements_lint.in +# +ruff==0.6.4 + # via -r requirements_lint.in diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 25e2512..0000000 --- a/setup.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[flake8] -max-line-length = 88 -extend-ignore = - E203, # whitespace before : is not PEP8 compliant (& conflicts with black) diff --git a/src/incremental/__init__.py b/src/incremental/__init__.py index aa960bb..7a0bc25 100644 --- a/src/incremental/__init__.py +++ b/src/incremental/__init__.py @@ -7,18 +7,13 @@ See L{Version}. """ -from __future__ import division, absolute_import - import os import sys import warnings -from typing import TYPE_CHECKING, Any, TypeVar, Union, Optional, Dict, BinaryIO from dataclasses import dataclass - +from typing import TYPE_CHECKING, Any, BinaryIO, Dict, Literal, Optional, Union if TYPE_CHECKING: - import io - from typing_extensions import Literal from distutils.dist import Distribution as _Distribution @@ -27,7 +22,7 @@ # -def _cmp(a, b): # type: (Any, Any) -> int +def _cmp(a: Any, b: Any) -> int: """ Compare two objects. @@ -47,33 +42,32 @@ def _cmp(a, b): # type: (Any, Any) -> int # -class _Inf(object): +class _Inf: """ An object that is bigger than all other objects. """ - def __cmp__(self, other): # type: (object) -> int + def __cmp__(self, other: object) -> int: """ @param other: Another object. @type other: any @return: 0 if other is inf, 1 otherwise. - @rtype: C{int} """ if other is _inf: return 0 return 1 - def __lt__(self, other): # type: (object) -> bool + def __lt__(self, other: object) -> bool: return self.__cmp__(other) < 0 - def __le__(self, other): # type: (object) -> bool + def __le__(self, other: object) -> bool: return self.__cmp__(other) <= 0 - def __gt__(self, other): # type: (object) -> bool + def __gt__(self, other: object) -> bool: return self.__cmp__(other) > 0 - def __ge__(self, other): # type: (object) -> bool + def __ge__(self, other: object) -> bool: return self.__cmp__(other) >= 0 @@ -86,7 +80,7 @@ class IncomparableVersions(TypeError): """ -class Version(object): +class Version: """ An encapsulation of a version for a project, with support for outputting PEP-440 compatible version strings. @@ -97,14 +91,14 @@ class Version(object): def __init__( self, - package, # type: str - major, # type: Union[Literal["NEXT"], int] - minor, # type: int - micro, # type: int - release_candidate=None, # type: Optional[int] - prerelease=None, # type: Optional[int] - post=None, # type: Optional[int] - dev=None, # type: Optional[int] + package: str, + major: Union[Literal["NEXT"], int], + minor: int, + micro: int, + release_candidate: Optional[int] = None, + prerelease: Optional[int] = None, + post: Optional[int] = None, + dev: Optional[int] = None, ): """ @param package: Name of the package that this is a version of. @@ -151,7 +145,7 @@ def __init__( self.dev = dev @property - def prerelease(self): # type: () -> Optional[int] + def prerelease(self) -> Optional[int]: warnings.warn( "Accessing incremental.Version.prerelease was " "deprecated in Incremental 16.9.0. Use " @@ -161,7 +155,7 @@ def prerelease(self): # type: () -> Optional[int] ) return self.release_candidate - def public(self): # type: () -> str + def public(self) -> str: """ Return a PEP440-compatible "public" representation of this L{Version}. @@ -178,55 +172,50 @@ def public(self): # type: () -> str if self.release_candidate is None: rc = "" else: - rc = "rc%s" % (self.release_candidate,) + rc = f"rc{self.release_candidate}" if self.post is None: post = "" else: - post = ".post%s" % (self.post,) + post = f".post{self.post}" if self.dev is None: dev = "" else: - dev = ".dev%s" % (self.dev,) + dev = f".dev{self.dev}" - return "%r.%d.%d%s%s%s" % (self.major, self.minor, self.micro, rc, post, dev) + return f"{self.major!r}.{self.minor:d}.{self.micro:d}{rc}{post}{dev}" base = public short = public local = public - def __repr__(self): # type: () -> str + def __repr__(self) -> str: if self.release_candidate is None: release_candidate = "" else: - release_candidate = ", release_candidate=%r" % (self.release_candidate,) + release_candidate = f", release_candidate={self.release_candidate!r}" if self.post is None: post = "" else: - post = ", post=%r" % (self.post,) + post = f", post={self.post!r}" if self.dev is None: dev = "" else: - dev = ", dev=%r" % (self.dev,) - - return "%s(%r, %r, %d, %d%s%s%s)" % ( - self.__class__.__name__, - self.package, - self.major, - self.minor, - self.micro, - release_candidate, - post, - dev, + dev = f", dev={self.dev!r}" + + return ( + f"{self.__class__.__name__}(" + f"{self.package!r}, {self.major!r}, {self.minor:d}, {self.micro:d}" + f"{release_candidate}{post}{dev})" ) - def __str__(self): # type: () -> str - return "[%s, version %s]" % (self.package, self.short()) + def __str__(self) -> str: + return f"[{self.package}, version {self.short()}]" - def __cmp__(self, other): # type: (object) -> int + def __cmp__(self, other: object) -> int: """ Compare two versions, considering major versions, minor versions, micro versions, then release candidates, then postreleases, then dev @@ -252,15 +241,15 @@ def __cmp__(self, other): # type: (object) -> int if not isinstance(other, self.__class__): return NotImplemented if self.package.lower() != other.package.lower(): - raise IncomparableVersions("%r != %r" % (self.package, other.package)) + raise IncomparableVersions(f"{self.package!r} != {other.package!r}") if self.major == "NEXT": - major = _inf # type: Union[int, _Inf] + major: Union[int, _Inf] = _inf else: major = self.major if self.release_candidate is None: - release_candidate = _inf # type: Union[int, _Inf] + release_candidate: Union[int, _Inf] = _inf else: release_candidate = self.release_candidate @@ -270,17 +259,17 @@ def __cmp__(self, other): # type: (object) -> int post = self.post if self.dev is None: - dev = _inf # type: Union[int, _Inf] + dev: Union[int, _Inf] = _inf else: dev = self.dev if other.major == "NEXT": - othermajor = _inf # type: Union[int, _Inf] + othermajor: Union[int, _Inf] = _inf else: othermajor = other.major if other.release_candidate is None: - otherrc = _inf # type: Union[int, _Inf] + otherrc: Union[int, _Inf] = _inf else: otherrc = other.release_candidate @@ -290,7 +279,7 @@ def __cmp__(self, other): # type: (object) -> int otherpost = other.post if other.dev is None: - otherdev = _inf # type: Union[int, _Inf] + otherdev: Union[int, _Inf] = _inf else: otherdev = other.dev @@ -300,55 +289,55 @@ def __cmp__(self, other): # type: (object) -> int ) return x - def __eq__(self, other): # type: (object) -> bool + def __eq__(self, other: object) -> bool: c = self.__cmp__(other) if c is NotImplemented: return c # type: ignore[return-value] return c == 0 - def __ne__(self, other): # type: (object) -> bool + def __ne__(self, other: object) -> bool: c = self.__cmp__(other) if c is NotImplemented: return c # type: ignore[return-value] return c != 0 - def __lt__(self, other): # type: (object) -> bool + def __lt__(self, other: object) -> bool: c = self.__cmp__(other) if c is NotImplemented: return c # type: ignore[return-value] return c < 0 - def __le__(self, other): # type: (object) -> bool + def __le__(self, other: object) -> bool: c = self.__cmp__(other) if c is NotImplemented: return c # type: ignore[return-value] return c <= 0 - def __gt__(self, other): # type: (object) -> bool + def __gt__(self, other: object) -> bool: c = self.__cmp__(other) if c is NotImplemented: return c # type: ignore[return-value] return c > 0 - def __ge__(self, other): # type: (object) -> bool + def __ge__(self, other: object) -> bool: c = self.__cmp__(other) if c is NotImplemented: return c # type: ignore[return-value] return c >= 0 -def getVersionString(version): # type: (Version) -> str +def getVersionString(version: Version) -> str: """ Get a friendly string for the given version object. @param version: A L{Version} object. @return: A string containing the package and short version number. """ - result = "%s %s" % (version.package, version.short()) + result = f"{version.package} {version.short()}" return result -def _findPath(path, package): # type: (str, str) -> str +def _findPath(path: str, package: str) -> str: """ Determine the package root directory. @@ -368,25 +357,23 @@ def _findPath(path, package): # type: (str, str) -> str return current_dir else: raise ValueError( - "Can't find the directory of project {}: I looked in {} and {}".format( - package, src_dir, current_dir - ) + f"Can't find the directory of project {package}: I looked in {src_dir} and {current_dir}" ) -def _existing_version(version_path): # type: (str) -> Version +def _existing_version(version_path: str) -> Version: """ Load the current version from a ``_version.py`` file. """ - version_info = {} # type: Dict[str, Version] + version_info: Dict[str, Version] = {} - with open(version_path, "r") as f: + with open(version_path) as f: exec(f.read(), version_info) return version_info["__version__"] -def _get_setuptools_version(dist): # type: (_Distribution) -> None +def _get_setuptools_version(dist: "_Distribution") -> None: """ Setuptools integration: load the version from the working directory @@ -421,7 +408,9 @@ def _get_setuptools_version(dist): # type: (_Distribution) -> None dist.metadata.version = version.public() -def _get_distutils_version(dist, keyword, value): # type: (_Distribution, object, object) -> None +def _get_distutils_version( + dist: "_Distribution", keyword: object, value: object +) -> None: """ Distutils integration: get the version from the package listed in the Distribution. @@ -446,7 +435,7 @@ def _get_distutils_version(dist, keyword, value): # type: (_Distribution, objec raise Exception("No _version.py found.") # pragma: no cover -def _load_toml(f): # type: (BinaryIO) -> Any +def _load_toml(f: BinaryIO) -> Any: """ Read the content of a TOML file. """ @@ -480,12 +469,12 @@ class _IncrementalConfig: """Path to the package root""" @property - def version_path(self): # type: () -> str + def version_path(self) -> str: """Path of the ``_version.py`` file. May not exist.""" return os.path.join(self.path, "_version.py") -def _load_pyproject_toml(toml_path): # type: (str) -> _IncrementalConfig +def _load_pyproject_toml(toml_path: str) -> _IncrementalConfig: """ Load Incremental configuration from a ``pyproject.toml`` @@ -527,9 +516,7 @@ def _load_pyproject_toml(toml_path): # type: (str) -> _IncrementalConfig """) if not isinstance(package, str): - raise TypeError( - "The project name must be a string, but found {}".format(type(package)) - ) + raise TypeError(f"The project name must be a string, but found {type(package)}") return _IncrementalConfig( opt_in=tool_incremental is not None, @@ -538,7 +525,7 @@ def _load_pyproject_toml(toml_path): # type: (str) -> _IncrementalConfig ) -def _extract_tool_incremental(data): # type: (Dict[str, object]) -> Optional[Dict[str, object]] +def _extract_tool_incremental(data: Dict[str, object]) -> Optional[Dict[str, object]]: if "tool" not in data: return None if not isinstance(data["tool"], dict): @@ -558,7 +545,7 @@ def _extract_tool_incremental(data): # type: (Dict[str, object]) -> Optional[Di from ._version import __version__ # noqa: E402 -def _setuptools_version(): # type: () -> str +def _setuptools_version() -> str: return __version__.public() # pragma: no cover diff --git a/src/incremental/_hatch.py b/src/incremental/_hatch.py index 5d6edac..f2feb54 100644 --- a/src/incremental/_hatch.py +++ b/src/incremental/_hatch.py @@ -5,10 +5,10 @@ import shlex from typing import Any, Dict, List, Type, TypedDict -from hatchling.version.source.plugin.interface import VersionSourceInterface from hatchling.plugin import hookimpl +from hatchling.version.source.plugin.interface import VersionSourceInterface -from incremental import _load_pyproject_toml, _existing_version +from incremental import _existing_version, _load_pyproject_toml class _VersionData(TypedDict): diff --git a/src/incremental/tests/test_pyproject.py b/src/incremental/tests/test_pyproject.py index 0d1f021..1f18bb4 100644 --- a/src/incremental/tests/test_pyproject.py +++ b/src/incremental/tests/test_pyproject.py @@ -4,11 +4,12 @@ """Test handling of ``pyproject.toml`` configuration""" import os -from typing import cast, Optional, Union from pathlib import Path +from typing import Optional, Union, cast + from twisted.trial.unittest import TestCase -from incremental import _load_pyproject_toml, _IncrementalConfig +from incremental import _IncrementalConfig, _load_pyproject_toml class VerifyPyprojectDotTomlTests(TestCase): diff --git a/src/incremental/tests/test_update.py b/src/incremental/tests/test_update.py index b0217f2..00e382a 100644 --- a/src/incremental/tests/test_update.py +++ b/src/incremental/tests/test_update.py @@ -5,17 +5,15 @@ Tests for L{incremental.update}. """ -from __future__ import division, absolute_import - -import sys -import os import datetime +import os +import sys from io import StringIO from twisted.python.filepath import FilePath from twisted.trial.unittest import TestCase -from incremental.update import _run, run, _main +from incremental.update import _main, _run, run class NonCreatedUpdateTests(TestCase): @@ -36,7 +34,7 @@ def setUp(self): self.getcwd = lambda: self.srcdir.path self.packagedir = packagedir - class Date(object): + class Date: year = 2016 month = 8 @@ -108,7 +106,7 @@ def setUp(self): self.getcwd = lambda: self.srcdir.path self.packagedir = packagedir - class Date(object): + class Date: year = 2016 month = 8 @@ -163,7 +161,7 @@ def setUp(self): self.getcwd = lambda: self.srcdir.path self.packagedir = packagedir - class Date(object): + class Date: year = 2016 month = 8 @@ -265,7 +263,7 @@ def setUp(self): self.getcwd = lambda: self.srcdir.path self.packagedir = packagedir - class Date(object): + class Date: year = 2016 month = 8 @@ -1192,11 +1190,11 @@ def setUp(self): self.getcwd = lambda: self.srcdir.path self.packagedir = packagedir - class Date(object): + class Date: year = 2016 month = 8 - class DateModule(object): + class DateModule: def today(self): return Date() diff --git a/src/incremental/tests/test_version.py b/src/incremental/tests/test_version.py index b9bd2a4..2a3189e 100644 --- a/src/incremental/tests/test_version.py +++ b/src/incremental/tests/test_version.py @@ -5,17 +5,14 @@ Tests for L{incremental}. """ -from __future__ import division, absolute_import - +import operator import sys import unittest -import operator - -from incremental import getVersionString, IncomparableVersions -from incremental import Version, _inf from twisted.trial.unittest import TestCase +from incremental import IncomparableVersions, Version, _inf, getVersionString + class VersionsTests(TestCase): def test_localIsShort(self): @@ -84,7 +81,7 @@ def test_comparingNEXTReleases(self): vb = Version("whatever", 1, 0, 0) self.assertTrue(va > vb) self.assertFalse(va < vb) - self.assertNotEquals(vb, va) + self.assertNotEqual(vb, va) def test_NEXTMustBeAlone(self): """ @@ -111,7 +108,7 @@ def test_comparingNEXTReleasesEqual(self): """ va = Version("whatever", "NEXT", 0, 0) vb = Version("whatever", "NEXT", 0, 0) - self.assertEquals(vb, va) + self.assertEqual(vb, va) def test_comparingPrereleasesWithReleases(self): """ @@ -121,7 +118,7 @@ def test_comparingPrereleasesWithReleases(self): vb = Version("whatever", 1, 0, 0) self.assertTrue(va < vb) self.assertFalse(va > vb) - self.assertNotEquals(vb, va) + self.assertNotEqual(vb, va) def test_prereleaseDeprecated(self): """ @@ -159,7 +156,7 @@ def test_comparingReleaseCandidatesWithReleases(self): vb = Version("whatever", 1, 0, 0) self.assertTrue(va < vb) self.assertFalse(va > vb) - self.assertNotEquals(vb, va) + self.assertNotEqual(vb, va) def test_comparingPostReleasesWithReleases(self): """ @@ -170,7 +167,7 @@ def test_comparingPostReleasesWithReleases(self): vb = Version("whatever", 1, 0, 0) self.assertTrue(va > vb) self.assertFalse(va < vb) - self.assertNotEquals(vb, va) + self.assertNotEqual(vb, va) def test_comparingDevReleasesWithPreviousPostReleases(self): """ @@ -181,7 +178,7 @@ def test_comparingDevReleasesWithPreviousPostReleases(self): vb = Version("whatever", 1, 0, 0, post=1) self.assertTrue(va > vb) self.assertFalse(va < vb) - self.assertNotEquals(vb, va) + self.assertNotEqual(vb, va) def test_comparingDevReleasesWithReleases(self): """ @@ -191,7 +188,7 @@ def test_comparingDevReleasesWithReleases(self): vb = Version("whatever", 1, 0, 0) self.assertTrue(va < vb) self.assertFalse(va > vb) - self.assertNotEquals(vb, va) + self.assertNotEqual(vb, va) def test_rcEqualspre(self): """ diff --git a/src/incremental/update.py b/src/incremental/update.py index dd11c3b..645d83e 100644 --- a/src/incremental/update.py +++ b/src/incremental/update.py @@ -1,14 +1,13 @@ # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. -from __future__ import absolute_import, division, print_function -from argparse import ArgumentParser -import os import datetime -from typing import Any, Callable, Dict, Optional, Sequence +import os +from argparse import ArgumentParser +from typing import Any, Callable, Optional, Sequence -from incremental import Version, _findPath, _existing_version +from incremental import Version, _existing_version, _findPath _VERSIONPY_TEMPLATE = '''""" Provides {package} version information. @@ -27,18 +26,18 @@ def _run( - package, # type: str - path, # type: Optional[str] - newversion, # type: Optional[str] - patch, # type: bool - rc, # type: bool - post, # type: bool - dev, # type: bool - create, # type: bool - _date=None, # type: Optional[datetime.date] - _getcwd=None, # type: Optional[Callable[[], str]] - _print=print, # type: Callable[[object], object] -): # type: (...) -> None + package: str, + path: Optional[str], + newversion: Optional[str], + patch: bool, + rc: bool, + post: bool, + dev: bool, + create: bool, + _date: Optional[datetime.date] = None, + _getcwd: Optional[Callable[[], str]] = None, + _print: Callable[[object], object] = print, +) -> None: if not _getcwd: _getcwd = os.getcwd @@ -177,7 +176,7 @@ def _run( existing_version_repr = repr(existing).split("#")[0].replace("'", '"') existing_version_repr_bytes = existing_version_repr.encode("utf8") - _print("Updating codebase to %s" % (v.public())) + _print(f"Updating codebase to {v.public()}") for dirpath, dirnames, filenames in os.walk(path): for filename in filenames: @@ -209,11 +208,11 @@ def _run( ) if content != original_content: - _print("Updating %s" % (filepath,)) + _print(f"Updating {filepath}") with open(filepath, "wb") as f: f.write(content) - _print("Updating %s" % (versionpath,)) + _print(f"Updating {versionpath}") with open(versionpath, "wb") as f: f.write( _VERSIONPY_TEMPLATE.format( @@ -222,7 +221,7 @@ def _run( ) -def _add_update_args(p): # type: (ArgumentParser) -> None +def _add_update_args(p: ArgumentParser) -> None: p.add_argument("package") p.add_argument("--path", default=None) p.add_argument("--newversion", default=None, metavar="VERSION") @@ -233,7 +232,7 @@ def _add_update_args(p): # type: (ArgumentParser) -> None p.add_argument("--create", default=False, action="store_true") -def _main(argv=None): # type: (Optional[Sequence[str]]) -> None +def _main(argv: Optional[Sequence[str]] = None) -> None: """ Entrypoint of the `incremental` script """ @@ -243,7 +242,7 @@ def _main(argv=None): # type: (Optional[Sequence[str]]) -> None update_p = subparsers.add_parser("update") _add_update_args(update_p) - args = p.parse_args(argv) # type: Any + args: Any = p.parse_args(argv) _run( package=args.package, path=args.path, @@ -256,13 +255,13 @@ def _main(argv=None): # type: (Optional[Sequence[str]]) -> None ) -def run(argv=None): # type: (Optional[Sequence[str]]) -> None +def run(argv: Optional[Sequence[str]] = None) -> None: """ Entrypoint for `python -m incremental.update` """ p = ArgumentParser() _add_update_args(p) - args = p.parse_args(argv) # type: Any + args: Any = p.parse_args(argv) _run( package=args.package, path=args.path, diff --git a/tests/example_setuppy/src/example_setuppy/__init__.py b/tests/example_setuppy/src/example_setuppy/__init__.py index cb566be..279c77b 100644 --- a/tests/example_setuppy/src/example_setuppy/__init__.py +++ b/tests/example_setuppy/src/example_setuppy/__init__.py @@ -5,6 +5,7 @@ """ from incremental import Version + from ._version import __version__ __all__ = ["__version__"] diff --git a/tests/example_setuptools/src/example_setuptools/__init__.py b/tests/example_setuptools/src/example_setuptools/__init__.py index b5f6ee2..00bb4d2 100644 --- a/tests/example_setuptools/src/example_setuptools/__init__.py +++ b/tests/example_setuptools/src/example_setuptools/__init__.py @@ -5,6 +5,7 @@ """ from incremental import Version + from ._version import __version__ __all__ = ["__version__"] diff --git a/tests/test_examples.py b/tests/test_examples.py index 5e6c09f..f2c332c 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -10,18 +10,17 @@ from subprocess import run from tempfile import TemporaryDirectory -from build import ProjectBuilder, BuildBackendException -from build.env import DefaultIsolatedEnv from twisted.python.filepath import FilePath from twisted.trial.unittest import TestCase +from build import BuildBackendException, ProjectBuilder +from build.env import DefaultIsolatedEnv from incremental import Version - TEST_DIR = FilePath(os.path.abspath(os.path.dirname(__file__))) -def build_and_install(path): # type: (FilePath) -> None +def build_and_install(path: FilePath) -> None: with TemporaryDirectory(prefix="dist") as dist_dir: with DefaultIsolatedEnv(installer="pip") as env: env.install( diff --git a/tox.ini b/tox.ini index d6437e2..a51ec04 100644 --- a/tox.ini +++ b/tox.ini @@ -1,13 +1,9 @@ [tox] -minversion = 3.23.0 -requires = - virtualenv >= 20.4.3 - tox < 4.0.0 - tox-wheel >= 0.6.0 -isolated_build = true +minversion = 4.0.0 envlist = - flake8, + lint, tests, + mypy, apidocs @@ -15,16 +11,16 @@ envlist = wheel = true wheel_build_env = build skip_install = + lint: true + mypy: true + apidocs: true pindeps: true deps = + lint: -rrequirements_lint.txt tests: -rrequirements_tests.txt mypy: -rrequirements_mypy.txt apidocs: pydoctor - lint: pre-commit pindeps: pip-tools -extras = - mypy: scripts - tests: scripts setenv = ; Suppress pointless chatter in the output. @@ -38,7 +34,7 @@ setenv = commands = python -V - lint: pre-commit run --all-files --show-diff-on-failure + lint: ruff check src/ tests/ {posargs} apidocs: pydoctor -q --project-name incremental src/incremental @@ -56,6 +52,7 @@ commands = pindeps: pip-compile -o requirements_tests.txt requirements_tests.in {posargs} pindeps: pip-compile -o requirements_mypy.txt requirements_mypy.in {posargs} + pindeps: pip-compile -o requirements_lint.txt requirements_lint.in {posargs} [testenv:build]