Skip to content

Commit 7609492

Browse files
authored
Merge pull request #2242 from mwtoews/pyproject-toml
Move project metadata to pyproject.toml
2 parents 92dfd89 + b7d8f1a commit 7609492

3 files changed

Lines changed: 58 additions & 53 deletions

File tree

pyproject.toml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,57 @@
11
[build-system]
2-
requires = ["setuptools"]
2+
requires = ["setuptools >= 62.6"]
33
build-backend = "setuptools.build_meta"
44

5+
[project]
6+
name = "GitPython"
7+
description = "GitPython is a Python library used to interact with Git repositories"
8+
authors = [
9+
{name = "Sebastian Thiel", email = "byronimo@gmail.com"},
10+
{name = "Michael Trier", email = "mtrier@gmail.com"},
11+
]
12+
readme = "README.md"
13+
requires-python = ">=3.7"
14+
keywords = ["git"]
15+
# license = "BSD-3-Clause" # not done until setuptools >= 77 (Python >= 3.9)
16+
classifiers = [
17+
"Development Status :: 5 - Production/Stable",
18+
"Environment :: Console",
19+
"Intended Audience :: Developers",
20+
"Operating System :: OS Independent",
21+
"Operating System :: POSIX",
22+
"Operating System :: Microsoft :: Windows",
23+
"Operating System :: MacOS :: MacOS X",
24+
"Typing :: Typed",
25+
"Programming Language :: Python",
26+
"Programming Language :: Python :: 3",
27+
"Programming Language :: Python :: 3.7",
28+
"Programming Language :: Python :: 3.8",
29+
"Programming Language :: Python :: 3.9",
30+
"Programming Language :: Python :: 3.10",
31+
"Programming Language :: Python :: 3.11",
32+
"Programming Language :: Python :: 3.12",
33+
"Programming Language :: Python :: 3.13",
34+
"Programming Language :: Python :: 3.14",
35+
"Programming Language :: Python :: 3.15",
36+
]
37+
dynamic = ["license", "version", "dependencies", "optional-dependencies"]
38+
39+
[project.urls]
40+
"Source code" = "https://github.com/gitpython-developers/GitPython"
41+
"Documentation" = "https://gitpython.readthedocs.io/en/stable/"
42+
43+
[tool.setuptools]
44+
include-package-data = true
45+
46+
[tool.setuptools.dynamic]
47+
version = {file = "VERSION"}
48+
dependencies = {file = "requirements.txt"}
49+
optional-dependencies."test" = {file = "test-requirements.txt"}
50+
optional-dependencies."doc" = {file = "doc/requirements.txt"}
51+
52+
[tool.setuptools.packages.find]
53+
include = ["git", "git.*"]
54+
555
[tool.pytest.ini_options]
656
addopts = "--cov=git --cov-report=term -rfEX"
757
filterwarnings = "ignore::DeprecationWarning"

setup.py

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import sys
66
from typing import Sequence
77

8-
from setuptools import setup, find_packages
8+
from setuptools import setup
99
from setuptools.command.build_py import build_py as _build_py
1010
from setuptools.command.sdist import sdist as _sdist
1111

@@ -15,10 +15,6 @@ def _read_content(path: str) -> str:
1515

1616

1717
version = _read_content("VERSION").strip()
18-
requirements = _read_content("requirements.txt").splitlines()
19-
test_requirements = _read_content("test-requirements.txt").splitlines()
20-
doc_requirements = _read_content("doc/requirements.txt").splitlines()
21-
long_description = _read_content("README.md")
2218

2319

2420
class build_py(_build_py):
@@ -62,54 +58,9 @@ def _stamp_version(filename: str) -> None:
6258
print("WARNING: Couldn't find version line in file %s" % filename, file=sys.stderr)
6359

6460

61+
# See pyproject.toml for project metadata
6562
setup(
6663
name="GitPython",
6764
cmdclass={"build_py": build_py, "sdist": sdist},
68-
version=version,
69-
description="GitPython is a Python library used to interact with Git repositories",
70-
author="Sebastian Thiel, Michael Trier",
71-
author_email="byronimo@gmail.com, mtrier@gmail.com",
7265
license="BSD-3-Clause",
73-
url="https://github.com/gitpython-developers/GitPython",
74-
packages=find_packages(include=["git", "git.*"]),
75-
include_package_data=True,
76-
package_dir={"git": "git"},
77-
python_requires=">=3.7",
78-
install_requires=requirements,
79-
extras_require={
80-
"test": test_requirements,
81-
"doc": doc_requirements,
82-
},
83-
zip_safe=False,
84-
long_description=long_description,
85-
long_description_content_type="text/markdown",
86-
classifiers=[
87-
# Picked from
88-
# http://pypi.python.org/pypi?:action=list_classifiers
89-
# "Development Status :: 1 - Planning",
90-
# "Development Status :: 2 - Pre-Alpha",
91-
# "Development Status :: 3 - Alpha",
92-
# "Development Status :: 4 - Beta",
93-
"Development Status :: 5 - Production/Stable",
94-
# "Development Status :: 6 - Mature",
95-
# "Development Status :: 7 - Inactive",
96-
"Environment :: Console",
97-
"Intended Audience :: Developers",
98-
"Operating System :: OS Independent",
99-
"Operating System :: POSIX",
100-
"Operating System :: Microsoft :: Windows",
101-
"Operating System :: MacOS :: MacOS X",
102-
"Typing :: Typed",
103-
"Programming Language :: Python",
104-
"Programming Language :: Python :: 3",
105-
"Programming Language :: Python :: 3.7",
106-
"Programming Language :: Python :: 3.8",
107-
"Programming Language :: Python :: 3.9",
108-
"Programming Language :: Python :: 3.10",
109-
"Programming Language :: Python :: 3.11",
110-
"Programming Language :: Python :: 3.12",
111-
"Programming Language :: Python :: 3.13",
112-
"Programming Language :: Python :: 3.14",
113-
"Programming Language :: Python :: 3.15",
114-
],
11566
)

test/test_installation.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import functools
66
import os
77
import subprocess
8+
import sys
89

910
from test.lib import TestBase, VirtualEnvironment, requires_symlinks, with_rw_directory
1011

@@ -49,14 +50,17 @@ def _set_up_venv(rw_dir):
4950
target_is_directory=True,
5051
)
5152

53+
# Turn warnings into exceptions except for Python 3.7
54+
pywarnings = "error" if tuple(sys.version_info)[0:2] > (3, 7) else "default"
55+
5256
# Create a convenience function to run commands in it.
5357
run = functools.partial(
5458
subprocess.run,
5559
stdout=subprocess.PIPE,
5660
stderr=subprocess.PIPE,
5761
universal_newlines=True,
5862
cwd=venv.sources,
59-
env={**os.environ, "PYTHONWARNINGS": "error"},
63+
env={**os.environ, "PYTHONWARNINGS": pywarnings},
6064
)
6165

6266
return venv, run

0 commit comments

Comments
 (0)