diff --git a/pyproject.toml b/pyproject.toml index fbcde3611..3e6dd21cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,57 @@ [build-system] -requires = ["setuptools"] +requires = ["setuptools >= 62.6"] build-backend = "setuptools.build_meta" +[project] +name = "GitPython" +description = "GitPython is a Python library used to interact with Git repositories" +authors = [ + {name = "Sebastian Thiel", email = "byronimo@gmail.com"}, + {name = "Michael Trier", email = "mtrier@gmail.com"}, +] +readme = "README.md" +requires-python = ">=3.7" +keywords = ["git"] +# license = "BSD-3-Clause" # not done until setuptools >= 77 (Python >= 3.9) +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Operating System :: POSIX", + "Operating System :: Microsoft :: Windows", + "Operating System :: MacOS :: MacOS X", + "Typing :: Typed", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "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", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", +] +dynamic = ["license", "version", "dependencies", "optional-dependencies"] + +[project.urls] +"Source code" = "https://github.com/gitpython-developers/GitPython" +"Documentation" = "https://gitpython.readthedocs.io/en/stable/" + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.dynamic] +version = {file = "VERSION"} +dependencies = {file = "requirements.txt"} +optional-dependencies."test" = {file = "test-requirements.txt"} +optional-dependencies."doc" = {file = "doc/requirements.txt"} + +[tool.setuptools.packages.find] +include = ["git", "git.*"] + [tool.pytest.ini_options] addopts = "--cov=git --cov-report=term -rfEX" filterwarnings = "ignore::DeprecationWarning" diff --git a/setup.py b/setup.py index 0b5293685..3b0ecc55e 100755 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ import sys from typing import Sequence -from setuptools import setup, find_packages +from setuptools import setup from setuptools.command.build_py import build_py as _build_py from setuptools.command.sdist import sdist as _sdist @@ -15,10 +15,6 @@ def _read_content(path: str) -> str: version = _read_content("VERSION").strip() -requirements = _read_content("requirements.txt").splitlines() -test_requirements = _read_content("test-requirements.txt").splitlines() -doc_requirements = _read_content("doc/requirements.txt").splitlines() -long_description = _read_content("README.md") class build_py(_build_py): @@ -62,54 +58,9 @@ def _stamp_version(filename: str) -> None: print("WARNING: Couldn't find version line in file %s" % filename, file=sys.stderr) +# See pyproject.toml for project metadata setup( name="GitPython", cmdclass={"build_py": build_py, "sdist": sdist}, - version=version, - description="GitPython is a Python library used to interact with Git repositories", - author="Sebastian Thiel, Michael Trier", - author_email="byronimo@gmail.com, mtrier@gmail.com", license="BSD-3-Clause", - url="https://github.com/gitpython-developers/GitPython", - packages=find_packages(include=["git", "git.*"]), - include_package_data=True, - package_dir={"git": "git"}, - python_requires=">=3.7", - install_requires=requirements, - extras_require={ - "test": test_requirements, - "doc": doc_requirements, - }, - zip_safe=False, - long_description=long_description, - long_description_content_type="text/markdown", - classifiers=[ - # Picked from - # http://pypi.python.org/pypi?:action=list_classifiers - # "Development Status :: 1 - Planning", - # "Development Status :: 2 - Pre-Alpha", - # "Development Status :: 3 - Alpha", - # "Development Status :: 4 - Beta", - "Development Status :: 5 - Production/Stable", - # "Development Status :: 6 - Mature", - # "Development Status :: 7 - Inactive", - "Environment :: Console", - "Intended Audience :: Developers", - "Operating System :: OS Independent", - "Operating System :: POSIX", - "Operating System :: Microsoft :: Windows", - "Operating System :: MacOS :: MacOS X", - "Typing :: Typed", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "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", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Programming Language :: Python :: 3.14", - "Programming Language :: Python :: 3.15", - ], ) diff --git a/test/test_installation.py b/test/test_installation.py index e8956d5cf..b8e970bdd 100644 --- a/test/test_installation.py +++ b/test/test_installation.py @@ -5,6 +5,7 @@ import functools import os import subprocess +import sys from test.lib import TestBase, VirtualEnvironment, requires_symlinks, with_rw_directory @@ -49,6 +50,9 @@ def _set_up_venv(rw_dir): target_is_directory=True, ) + # Turn warnings into exceptions except for Python 3.7 + pywarnings = "error" if tuple(sys.version_info)[0:2] > (3, 7) else "default" + # Create a convenience function to run commands in it. run = functools.partial( subprocess.run, @@ -56,7 +60,7 @@ def _set_up_venv(rw_dir): stderr=subprocess.PIPE, universal_newlines=True, cwd=venv.sources, - env={**os.environ, "PYTHONWARNINGS": "error"}, + env={**os.environ, "PYTHONWARNINGS": pywarnings}, ) return venv, run