summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonny Pfannschmidt <opensource@ronnypfannschmidt.de>2023-02-12 21:50:17 +0100
committerRonny Pfannschmidt <opensource@ronnypfannschmidt.de>2023-02-12 21:51:07 +0100
commit1e224324604f910d20ef625e18a29b254305417f (patch)
tree9032a54385a95bcbfa683a0337bc18ff931c198e
parenta5fdfcf7ff83eeeb1e77a932536e865ef774afe8 (diff)
downloadsetuptools-scm-1e224324604f910d20ef625e18a29b254305417f.tar.gz
migrate setuptools config to pyproject.toml
-rw-r--r--pyproject.toml93
-rw-r--r--setup.cfg78
-rw-r--r--testing/test_regressions.py22
3 files changed, 111 insertions, 82 deletions
diff --git a/pyproject.toml b/pyproject.toml
index 1d11e4c..24dcf32 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,7 +1,92 @@
[build-system]
+build-backend = "setuptools.build_meta"
requires = [
- "setuptools>=45",
- "packaging>=20.0",
- "typing_extensions",
+ "packaging>=20",
+ "setuptools>=45",
+ "typing_extensions",
]
-build-backend = "setuptools.build_meta"
+
+[project]
+dynamic = ["version"]
+name = "setuptools-scm"
+description = "the blessed package to manage your versions by scm tags"
+readme = "README.rst"
+license.file = "LICENSE"
+authors = [
+ {name="Ronny Pfannschmidt", email="opensource@ronnypfannschmidt.de"}
+]
+requires-python = ">=3.7"
+classifiers = [
+ "Development Status :: 5 - Production/Stable",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: MIT License",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3 :: Only",
+ "Programming Language :: Python :: 3.7",
+ "Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
+ "Topic :: Software Development :: Libraries",
+ "Topic :: Software Development :: Version Control",
+ "Topic :: System :: Software Distribution",
+ "Topic :: Utilities",
+]
+dependencies = [
+ 'importlib-metadata; python_version < "3.8"',
+ "packaging>=20",
+ "setuptools",
+ 'tomli>=1; python_version < "3.11"',
+ "typing-extensions",
+]
+[project.urls]
+repository = "https://github.com/pypa/setuptools_scm/"
+
+[project.entry-points."distutils.setup_keywords"]
+use_scm_version = "setuptools_scm.integration:version_keyword"
+
+[project.entry-points."setuptools.file_finders"]
+setuptools_scm = "setuptools_scm.integration:find_files"
+
+[project.entry-points."setuptools.finalize_distribution_options"]
+setuptools_scm = "setuptools_scm.integration:infer_version"
+
+[project.entry-points."setuptools_scm.files_command"]
+".git" = "setuptools_scm.file_finder_git:git_find_files"
+".hg" = "setuptools_scm.file_finder_hg:hg_find_files"
+
+[project.entry-points."setuptools_scm.files_command_fallback"]
+".git_archival.txt" = "setuptools_scm.file_finder_git:git_archive_find_files"
+".hg_archival.txt" = "setuptools_scm.file_finder_hg:hg_archive_find_files"
+
+[project.entry-points."setuptools_scm.local_scheme"]
+dirty-tag = "setuptools_scm.version:get_local_dirty_tag"
+no-local-version = "setuptools_scm.version:get_no_local_node"
+node-and-date = "setuptools_scm.version:get_local_node_and_date"
+node-and-timestamp = "setuptools_scm.version:get_local_node_and_timestamp"
+
+[project.entry-points."setuptools_scm.parse_scm"]
+".git" = "setuptools_scm.git:parse"
+".hg" = "setuptools_scm.hg:parse"
+
+[project.entry-points."setuptools_scm.parse_scm_fallback"]
+".git_archival.txt" = "setuptools_scm.git:parse_archival"
+".hg_archival.txt" = "setuptools_scm.hg:parse_archival"
+PKG-INFO = "setuptools_scm.hacks:parse_pkginfo"
+pip-egg-info = "setuptools_scm.hacks:parse_pip_egg_info"
+"pyproject.toml" = "setuptools_scm.hacks:fallback_version"
+"setup.py" = "setuptools_scm.hacks:fallback_version"
+
+[project.entry-points."setuptools_scm.version_scheme"]
+"calver-by-date" = "setuptools_scm.version:calver_by_date"
+"guess-next-dev" = "setuptools_scm.version:guess_next_dev_version"
+"no-guess-dev" = "setuptools_scm.version:no_guess_dev_version"
+"post-release" = "setuptools_scm.version:postrelease_version"
+"python-simplified-semver" = "setuptools_scm.version:simplified_semver_version"
+"release-branch-semver" = "setuptools_scm.version:release_branch_semver_version"
+
+
+
+[tool.setuptools.packages.find]
+where = ["src"]
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index b69fc6f..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,78 +0,0 @@
-[metadata]
-name = setuptools_scm
-description = the blessed package to manage your versions by scm tags
-long_description = file: README.rst
-long_description_content_type = text/x-rst
-url = https://github.com/pypa/setuptools_scm/
-author = Ronny Pfannschmidt
-author_email = opensource@ronnypfannschmidt.de
-license = MIT
-license_files = LICENSE
-classifiers =
- Development Status :: 5 - Production/Stable
- Intended Audience :: Developers
- License :: OSI Approved :: MIT License
- Programming Language :: Python
- Programming Language :: Python :: 3
- Programming Language :: Python :: 3 :: Only
- Programming Language :: Python :: 3.7
- Programming Language :: Python :: 3.8
- Programming Language :: Python :: 3.9
- Programming Language :: Python :: 3.10
- Programming Language :: Python :: 3.11
- Topic :: Software Development :: Libraries
- Topic :: Software Development :: Version Control
- Topic :: System :: Software Distribution
- Topic :: Utilities
-
-[options]
-packages = find:
-install_requires =
- packaging>=20.0
- setuptools
- typing-extensions
- importlib-metadata;python_version < '3.8'
- tomli>=1.0.0;python_version < '3.11' # keep in sync
-python_requires = >=3.7
-package_dir =
- =src
-zip_safe = true
-
-[options.packages.find]
-where = src
-
-[options.entry_points]
-distutils.setup_keywords =
- use_scm_version = setuptools_scm.integration:version_keyword
-setuptools.file_finders =
- setuptools_scm = setuptools_scm.integration:find_files
-setuptools.finalize_distribution_options =
- setuptools_scm = setuptools_scm.integration:infer_version
-setuptools_scm.files_command =
- .hg = setuptools_scm.file_finder_hg:hg_find_files
- .git = setuptools_scm.file_finder_git:git_find_files
-setuptools_scm.files_command_fallback =
- .hg_archival.txt = setuptools_scm.file_finder_hg:hg_archive_find_files
- .git_archival.txt = setuptools_scm.file_finder_git:git_archive_find_files
-setuptools_scm.local_scheme =
- node-and-date = setuptools_scm.version:get_local_node_and_date
- node-and-timestamp = setuptools_scm.version:get_local_node_and_timestamp
- dirty-tag = setuptools_scm.version:get_local_dirty_tag
- no-local-version = setuptools_scm.version:get_no_local_node
-setuptools_scm.parse_scm =
- .hg = setuptools_scm.hg:parse
- .git = setuptools_scm.git:parse
-setuptools_scm.parse_scm_fallback =
- .hg_archival.txt = setuptools_scm.hg:parse_archival
- .git_archival.txt = setuptools_scm.git:parse_archival
- PKG-INFO = setuptools_scm.hacks:parse_pkginfo
- pip-egg-info = setuptools_scm.hacks:parse_pip_egg_info
- setup.py = setuptools_scm.hacks:fallback_version
- pyproject.toml = setuptools_scm.hacks:fallback_version
-setuptools_scm.version_scheme =
- guess-next-dev = setuptools_scm.version:guess_next_dev_version
- post-release = setuptools_scm.version:postrelease_version
- python-simplified-semver = setuptools_scm.version:simplified_semver_version
- release-branch-semver = setuptools_scm.version:release_branch_semver_version
- no-guess-dev = setuptools_scm.version:no_guess_dev_version
- calver-by-date = setuptools_scm.version:calver_by_date
diff --git a/testing/test_regressions.py b/testing/test_regressions.py
index bc378f5..6cbabcc 100644
--- a/testing/test_regressions.py
+++ b/testing/test_regressions.py
@@ -1,8 +1,16 @@
from __future__ import annotations
import os
+import pprint
import subprocess
import sys
+from typing import Callable
+
+if sys.version_info >= (3, 8):
+ distribution: Callable[[str], EntryPoint]
+ from importlib.metadata import distribution, EntryPoint
+else:
+ from importlib_metadata import distribution, EntryPoint
from pathlib import Path
import pytest
@@ -103,3 +111,17 @@ def test_case_mismatch_on_windows_git(tmp_path: Path) -> None:
do("git init", camel_case_path)
res = parse(str(camel_case_path).lower(), Configuration())
assert res is not None
+
+
+def test_entrypoints_load() -> None:
+ d = distribution("setuptools-scm") # type: ignore [no-untyped-call]
+
+ eps = d.entry_points
+ failed: list[tuple[EntryPoint, Exception]] = []
+ for ep in eps:
+ try:
+ ep.load()
+ except Exception as e:
+ failed.append((ep, e))
+ if failed:
+ pytest.fail(pprint.pformat(failed))