From 99a97b2513fcd6b02ac8838144938e2ab7b383be Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Thu, 26 Oct 2023 23:21:54 +0100 Subject: [PATCH] Migrate setuptools to use pyproject.toml (#396) --- .pre-commit-config.yaml | 9 ----- pyproject.toml | 60 +++++++++++++++++++++++++++++++ requirements/py310.txt | 6 ++-- requirements/py311.txt | 2 +- requirements/py312.txt | 2 +- requirements/py38.txt | 6 ++-- requirements/py39.txt | 6 ++-- requirements/requirements.in | 2 +- setup.cfg | 68 ------------------------------------ tox.ini | 4 +++ 10 files changed, 79 insertions(+), 86 deletions(-) delete mode 100644 setup.cfg diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5a8fecb0..d79d0368 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,14 +17,6 @@ repos: rev: 1.2.0 hooks: - id: pyproject-fmt -- repo: https://github.com/asottile/setup-cfg-fmt - rev: v2.5.0 - hooks: - - id: setup-cfg-fmt - args: - - --include-version-classifiers - - --max-py-version - - '3.12' - repo: https://github.com/tox-dev/tox-ini-fmt rev: 1.3.1 hooks: @@ -68,7 +60,6 @@ repos: - flake8-bugbear - flake8-comprehensions - flake8-tidy-imports - - flake8-typing-imports - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.6.1 hooks: diff --git a/pyproject.toml b/pyproject.toml index 74a500d3..afe2be67 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,49 @@ requires = [ "setuptools", ] +[project] +name = "time-machine" +version = "2.13.0" +description = "Travel through time in your tests." +readme = {file = "README.rst", content-type = "text/x-rst"} +keywords = [ + "date", + "datetime", + "mock", + "test", + "testing", + "tests", + "time", + "warp", +] +license = {text = "MIT"} +authors = [{name = "Adam Johnson", email = "me@adamj.eu"}] +requires-python = ">=3.8" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Framework :: Pytest", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Typing :: Typed", +] +dependencies = [ + "python-dateutil", +] +[project.urls] +Changelog = "https://github.com/adamchainz/time-machine/blob/main/CHANGELOG.rst" +Funding = "https://adamj.eu/books/" +Repository = "https://github.com/adamchainz/time-machine" +[project.entry-points.pytest11] +time_machine = "time_machine" + [tool.black] target-version = ['py38'] @@ -13,6 +56,23 @@ addopts = """\ --strict-markers """ +[tool.coverage.run] +branch = true +parallel = true +source = [ + "src/_time_machine.c", + "tests", +] + +[tool.coverage.paths] +source = [ + "src", + ".tox/**/site-packages", +] + +[tool.coverage.report] +show_missing = true + [tool.mypy] mypy_path = "src/" namespace_packages = false diff --git a/requirements/py310.txt b/requirements/py310.txt index f385bb8b..2b9bb5ce 100644 --- a/requirements/py310.txt +++ b/requirements/py310.txt @@ -4,7 +4,7 @@ # # requirements/compile.py # -coverage==7.3.2 \ +coverage[toml]==7.3.2 \ --hash=sha256:0cbf38419fb1a347aaf63481c00f0bdc86889d9fbf3f25109cf96c26b403fda1 \ --hash=sha256:12d15ab5833a997716d76f2ac1e4b4d536814fc213c85ca72756c19e5a6b3d63 \ --hash=sha256:149de1d2401ae4655c436a3dced6dd153f4c3309f599c3d4bd97ab172eaf02d9 \ @@ -95,4 +95,6 @@ six==1.16.0 \ tomli==2.0.1 \ --hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \ --hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f - # via pytest + # via + # coverage + # pytest diff --git a/requirements/py311.txt b/requirements/py311.txt index 66166d46..94d2e83f 100644 --- a/requirements/py311.txt +++ b/requirements/py311.txt @@ -4,7 +4,7 @@ # # requirements/compile.py # -coverage==7.3.2 \ +coverage[toml]==7.3.2 \ --hash=sha256:0cbf38419fb1a347aaf63481c00f0bdc86889d9fbf3f25109cf96c26b403fda1 \ --hash=sha256:12d15ab5833a997716d76f2ac1e4b4d536814fc213c85ca72756c19e5a6b3d63 \ --hash=sha256:149de1d2401ae4655c436a3dced6dd153f4c3309f599c3d4bd97ab172eaf02d9 \ diff --git a/requirements/py312.txt b/requirements/py312.txt index 052cb561..4e5ef905 100644 --- a/requirements/py312.txt +++ b/requirements/py312.txt @@ -4,7 +4,7 @@ # # requirements/compile.py # -coverage==7.3.2 \ +coverage[toml]==7.3.2 \ --hash=sha256:0cbf38419fb1a347aaf63481c00f0bdc86889d9fbf3f25109cf96c26b403fda1 \ --hash=sha256:12d15ab5833a997716d76f2ac1e4b4d536814fc213c85ca72756c19e5a6b3d63 \ --hash=sha256:149de1d2401ae4655c436a3dced6dd153f4c3309f599c3d4bd97ab172eaf02d9 \ diff --git a/requirements/py38.txt b/requirements/py38.txt index 44ea0f38..0c8f2cbf 100644 --- a/requirements/py38.txt +++ b/requirements/py38.txt @@ -22,7 +22,7 @@ backports-zoneinfo==0.2.1 ; python_version < "3.9" \ --hash=sha256:f04e857b59d9d1ccc39ce2da1021d196e47234873820cbeaad210724b1ee28ac \ --hash=sha256:fadbfe37f74051d024037f223b8e001611eac868b5c5b06144ef4d8b799862f2 # via -r requirements.in -coverage==7.3.2 \ +coverage[toml]==7.3.2 \ --hash=sha256:0cbf38419fb1a347aaf63481c00f0bdc86889d9fbf3f25109cf96c26b403fda1 \ --hash=sha256:12d15ab5833a997716d76f2ac1e4b4d536814fc213c85ca72756c19e5a6b3d63 \ --hash=sha256:149de1d2401ae4655c436a3dced6dd153f4c3309f599c3d4bd97ab172eaf02d9 \ @@ -117,7 +117,9 @@ six==1.16.0 \ tomli==2.0.1 \ --hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \ --hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f - # via pytest + # via + # coverage + # pytest zipp==3.17.0 \ --hash=sha256:0e923e726174922dce09c53c59ad483ff7bbb8e572e00c7f7c46b88556409f31 \ --hash=sha256:84e64a1c28cf7e91ed2078bb8cc8c259cb19b76942096c8d7b84947690cabaf0 diff --git a/requirements/py39.txt b/requirements/py39.txt index 8e46b3cf..ffa52d25 100644 --- a/requirements/py39.txt +++ b/requirements/py39.txt @@ -4,7 +4,7 @@ # # requirements/compile.py # -coverage==7.3.2 \ +coverage[toml]==7.3.2 \ --hash=sha256:0cbf38419fb1a347aaf63481c00f0bdc86889d9fbf3f25109cf96c26b403fda1 \ --hash=sha256:12d15ab5833a997716d76f2ac1e4b4d536814fc213c85ca72756c19e5a6b3d63 \ --hash=sha256:149de1d2401ae4655c436a3dced6dd153f4c3309f599c3d4bd97ab172eaf02d9 \ @@ -99,7 +99,9 @@ six==1.16.0 \ tomli==2.0.1 \ --hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \ --hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f - # via pytest + # via + # coverage + # pytest zipp==3.17.0 \ --hash=sha256:0e923e726174922dce09c53c59ad483ff7bbb8e572e00c7f7c46b88556409f31 \ --hash=sha256:84e64a1c28cf7e91ed2078bb8cc8c259cb19b76942096c8d7b84947690cabaf0 diff --git a/requirements/requirements.in b/requirements/requirements.in index d08aec26..6fb88331 100644 --- a/requirements/requirements.in +++ b/requirements/requirements.in @@ -1,5 +1,5 @@ backports.zoneinfo ; python_version < "3.9" -coverage +coverage[toml] pytest pytest-randomly python-dateutil diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index d76d2e7c..00000000 --- a/setup.cfg +++ /dev/null @@ -1,68 +0,0 @@ -[metadata] -name = time_machine -version = 2.13.0 -description = Travel through time in your tests. -long_description = file: README.rst -long_description_content_type = text/x-rst -url = https://github.com/adamchainz/time-machine -author = Adam Johnson -author_email = me@adamj.eu -license = MIT -license_files = LICENSE -classifiers = - Development Status :: 5 - Production/Stable - Framework :: Pytest - Intended Audience :: Developers - License :: OSI Approved :: MIT License - Natural Language :: English - Operating System :: OS Independent - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - Typing :: Typed -keywords = time, warp, date, datetime, mock, test, tests, testing -project_urls = - Changelog = https://github.com/adamchainz/time-machine/blob/main/CHANGELOG.rst - Funding = https://adamj.eu/books/ - Mastodon = https://fosstodon.org/@adamchainz - Twitter = https://twitter.com/adamchainz - -[options] -packages = find: -install_requires = - python-dateutil -python_requires = >=3.8 -include_package_data = True -package_dir = - =src -zip_safe = False - -[options.packages.find] -where = src - -[options.entry_points] -pytest11 = - time_machine = time_machine - -[coverage:run] -branch = True -parallel = True -source = - time_machine - tests - -[coverage:paths] -source = - src - .tox/**/site-packages - -[coverage:report] -show_missing = True - -[flake8] -max-line-length = 88 -extend-ignore = E203 diff --git a/tox.ini b/tox.ini index b16ef751..f617b48d 100644 --- a/tox.ini +++ b/tox.ini @@ -19,3 +19,7 @@ commands = -W ignore:datetime.datetime.utcnow:DeprecationWarning \ -m coverage run \ -m pytest {posargs:tests} + +[flake8] +max-line-length = 88 +extend-ignore = E203