From 56dfb70dfe731334e191cf2e9b84478a2118976d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=A9=20L=C3=BCck?= Date: Thu, 29 Jan 2026 13:04:43 +0100 Subject: [PATCH 1/2] Replace setup.cfg and setup.py with the more modern pyproject.toml --- pyproject.toml | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 82 ------------------------------------------- setup.py | 4 --- 3 files changed, 94 insertions(+), 86 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..e2797d96 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,94 @@ +[build-system] +requires = ["setuptools>=61.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "pre_commit_hooks" +version = "6.0.0" +description = "Some out-of-the-box hooks for pre-commit." +authors = [{name = "Anthony Sottile", email = "asottile@umich.edu"}] +license = {text = "MIT"} +classifiers = [ + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", +] +requires-python = ">=3.10" +dependencies = [ + "ruamel.yaml>=0.15", + 'tomli>=1.1.0;python_version<"3.11"', +] + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[project.urls] +Homepage = "https://github.com/pre-commit/pre-commit-hooks" + +[project.scripts] +check-added-large-files = "pre_commit_hooks.check_added_large_files:main" +check-ast = "pre_commit_hooks.check_ast:main" +check-builtin-literals = "pre_commit_hooks.check_builtin_literals:main" +check-case-conflict = "pre_commit_hooks.check_case_conflict:main" +check-docstring-first = "pre_commit_hooks.check_docstring_first:main" +check-executables-have-shebangs = "pre_commit_hooks.check_executables_have_shebangs:main" +check-json = "pre_commit_hooks.check_json:main" +check-merge-conflict = "pre_commit_hooks.check_merge_conflict:main" +check-shebang-scripts-are-executable = "pre_commit_hooks.check_shebang_scripts_are_executable:main" +check-symlinks = "pre_commit_hooks.check_symlinks:main" +check-toml = "pre_commit_hooks.check_toml:main" +check-vcs-permalinks = "pre_commit_hooks.check_vcs_permalinks:main" +check-xml = "pre_commit_hooks.check_xml:main" +check-yaml = "pre_commit_hooks.check_yaml:main" +debug-statement-hook = "pre_commit_hooks.debug_statement_hook:main" +destroyed-symlinks = "pre_commit_hooks.destroyed_symlinks:main" +detect-aws-credentials = "pre_commit_hooks.detect_aws_credentials:main" +detect-private-key = "pre_commit_hooks.detect_private_key:main" +double-quote-string-fixer = "pre_commit_hooks.string_fixer:main" +end-of-file-fixer = "pre_commit_hooks.end_of_file_fixer:main" +file-contents-sorter = "pre_commit_hooks.file_contents_sorter:main" +fix-byte-order-marker = "pre_commit_hooks.fix_byte_order_marker:main" +forbid-new-submodules = "pre_commit_hooks.forbid_new_submodules:main" +mixed-line-ending = "pre_commit_hooks.mixed_line_ending:main" +name-tests-test = "pre_commit_hooks.tests_should_end_in_test:main" +no-commit-to-branch = "pre_commit_hooks.no_commit_to_branch:main" +pre-commit-hooks-removed = "pre_commit_hooks.removed:main" +pretty-format-json = "pre_commit_hooks.pretty_format_json:main" +requirements-txt-fixer = "pre_commit_hooks.requirements_txt_fixer:main" +sort-simple-yaml = "pre_commit_hooks.sort_simple_yaml:main" +trailing-whitespace-fixer = "pre_commit_hooks.trailing_whitespace_fixer:main" + +[tool.setuptools] +license-files = ["LICENSE"] +include-package-data = false + +[tool.setuptools.packages.find] +exclude = [ + "tests*", + "testing*", +] +namespaces = false + +[tool.distutils.bdist_wheel] +universal = true + +[tool.coverage.run] +plugins = ["covdefaults"] + +[tool.mypy] +check_untyped_defs = true +disallow_any_generics = true +disallow_incomplete_defs = true +disallow_untyped_defs = true +warn_redundant_casts = true +warn_unused_ignores = true + +[[tool.mypy.overrides]] +module = ["testing.*"] +disallow_untyped_defs = false + +[[tool.mypy.overrides]] +module = ["tests.*"] +disallow_untyped_defs = false diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index d91f4399..00000000 --- a/setup.cfg +++ /dev/null @@ -1,82 +0,0 @@ -[metadata] -name = pre_commit_hooks -version = 6.0.0 -description = Some out-of-the-box hooks for pre-commit. -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/pre-commit/pre-commit-hooks -author = Anthony Sottile -author_email = asottile@umich.edu -license = MIT -license_files = LICENSE -classifiers = - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: Implementation :: CPython - Programming Language :: Python :: Implementation :: PyPy - -[options] -packages = find: -install_requires = - ruamel.yaml>=0.15 - tomli>=1.1.0;python_version<"3.11" -python_requires = >=3.10 - -[options.packages.find] -exclude = - tests* - testing* - -[options.entry_points] -console_scripts = - check-added-large-files = pre_commit_hooks.check_added_large_files:main - check-ast = pre_commit_hooks.check_ast:main - check-builtin-literals = pre_commit_hooks.check_builtin_literals:main - check-case-conflict = pre_commit_hooks.check_case_conflict:main - check-docstring-first = pre_commit_hooks.check_docstring_first:main - check-executables-have-shebangs = pre_commit_hooks.check_executables_have_shebangs:main - check-json = pre_commit_hooks.check_json:main - check-merge-conflict = pre_commit_hooks.check_merge_conflict:main - check-shebang-scripts-are-executable = pre_commit_hooks.check_shebang_scripts_are_executable:main - check-symlinks = pre_commit_hooks.check_symlinks:main - check-toml = pre_commit_hooks.check_toml:main - check-vcs-permalinks = pre_commit_hooks.check_vcs_permalinks:main - check-xml = pre_commit_hooks.check_xml:main - check-yaml = pre_commit_hooks.check_yaml:main - debug-statement-hook = pre_commit_hooks.debug_statement_hook:main - destroyed-symlinks = pre_commit_hooks.destroyed_symlinks:main - detect-aws-credentials = pre_commit_hooks.detect_aws_credentials:main - detect-private-key = pre_commit_hooks.detect_private_key:main - double-quote-string-fixer = pre_commit_hooks.string_fixer:main - end-of-file-fixer = pre_commit_hooks.end_of_file_fixer:main - file-contents-sorter = pre_commit_hooks.file_contents_sorter:main - fix-byte-order-marker = pre_commit_hooks.fix_byte_order_marker:main - forbid-new-submodules = pre_commit_hooks.forbid_new_submodules:main - mixed-line-ending = pre_commit_hooks.mixed_line_ending:main - name-tests-test = pre_commit_hooks.tests_should_end_in_test:main - no-commit-to-branch = pre_commit_hooks.no_commit_to_branch:main - pre-commit-hooks-removed = pre_commit_hooks.removed:main - pretty-format-json = pre_commit_hooks.pretty_format_json:main - requirements-txt-fixer = pre_commit_hooks.requirements_txt_fixer:main - sort-simple-yaml = pre_commit_hooks.sort_simple_yaml:main - trailing-whitespace-fixer = pre_commit_hooks.trailing_whitespace_fixer:main - -[bdist_wheel] -universal = True - -[coverage:run] -plugins = covdefaults - -[mypy] -check_untyped_defs = true -disallow_any_generics = true -disallow_incomplete_defs = true -disallow_untyped_defs = true -warn_redundant_casts = true -warn_unused_ignores = true - -[mypy-testing.*] -disallow_untyped_defs = false - -[mypy-tests.*] -disallow_untyped_defs = false diff --git a/setup.py b/setup.py deleted file mode 100644 index 3d93aefb..00000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -from __future__ import annotations - -from setuptools import setup -setup() From 9e2bc6ad341cab28ffb77ddc3936bf195c6774f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=A9=20L=C3=BCck?= Date: Thu, 29 Jan 2026 13:18:28 +0100 Subject: [PATCH 2/2] Replace requirement-dev.txt with section in pyproject.toml, amend tox.ini accordingly --- pyproject.toml | 7 +++++++ requirements-dev.txt | 3 --- tox.ini | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) delete mode 100644 requirements-dev.txt diff --git a/pyproject.toml b/pyproject.toml index e2797d96..55353742 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,13 @@ dependencies = [ 'tomli>=1.1.0;python_version<"3.11"', ] +[project.optional-dependencies] +dev = [ + "covdefaults", + "coverage", + "pytest", +] + [project.readme] file = "README.md" content-type = "text/markdown" diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index 0c5a37eb..00000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,3 +0,0 @@ -covdefaults -coverage -pytest diff --git a/tox.ini b/tox.ini index 11340f4d..b9b0c764 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,7 @@ envlist = py,pre-commit [testenv] -deps = -rrequirements-dev.txt +extras = dev setenv = GIT_AUTHOR_NAME = "test" GIT_COMMITTER_NAME = "test"