Skip to content

Commit 0ee6dc9

Browse files
authored
Move static project metadata to pyproject.toml (#18146)
Setuptools supports using `setup.py` and `pyproject.toml` simultaneously. This PR moves most of the static project metadata to `pyproject.toml`. Diff for **`.dist-info/METADATA`** ```diff Metadata-Version: 2.1 Name: mypy Version: 1.14.0+dev Summary: Optional static typing for Python -Home-page: https://www.mypy-lang.org/ +Author-email: Jukka Lehtosalo <[email protected]> -Author: Jukka Lehtosalo -Author-email: [email protected] License: MIT +Project-URL: Homepage, https://www.mypy-lang.org/ Project-URL: Documentation, https://mypy.readthedocs.io/en/stable/index.html ... ``` **`dist-info/RECORD`** is the same (except for the changed hash for `.dist-info/METADATA`). https://packaging.python.org/en/latest/specifications/core-metadata/
1 parent b137254 commit 0ee6dc9

File tree

2 files changed

+68
-71
lines changed

2 files changed

+68
-71
lines changed

pyproject.toml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,72 @@ requires = [
1414
]
1515
build-backend = "setuptools.build_meta"
1616

17+
[project]
18+
name = "mypy"
19+
description = "Optional static typing for Python"
20+
authors = [{name = "Jukka Lehtosalo", email = "[email protected]"}]
21+
license = {text = "MIT"}
22+
classifiers = [
23+
"Development Status :: 5 - Production/Stable",
24+
"Environment :: Console",
25+
"Intended Audience :: Developers",
26+
"License :: OSI Approved :: MIT License",
27+
"Programming Language :: Python :: 3",
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+
"Topic :: Software Development",
35+
"Typing :: Typed",
36+
]
37+
requires-python = ">=3.8"
38+
dependencies = [
39+
# When changing this, also update build-system.requires and mypy-requirements.txt
40+
"typing_extensions>=4.6.0",
41+
"mypy_extensions>=1.0.0",
42+
"tomli>=1.1.0; python_version<'3.11'",
43+
]
44+
dynamic = ["version", "readme"]
45+
46+
[project.optional-dependencies]
47+
dmypy = ["psutil>=4.0"]
48+
mypyc = ["setuptools>=50"]
49+
python2 = []
50+
reports = ["lxml"]
51+
install-types = ["pip"]
52+
faster-cache = ["orjson"]
53+
54+
[project.urls]
55+
Homepage = "https://www.mypy-lang.org/"
56+
Documentation = "https://mypy.readthedocs.io/en/stable/index.html"
57+
Repository = "https://github.com/python/mypy"
58+
Changelog = "https://github.com/python/mypy/blob/master/CHANGELOG.md"
59+
Issues = "https://github.com/python/mypy/issues"
60+
61+
[project.scripts]
62+
mypy = "mypy.__main__:console_entry"
63+
stubgen = "mypy.stubgen:main"
64+
stubtest = "mypy.stubtest:main"
65+
dmypy = "mypy.dmypy.client:console_entry"
66+
mypyc = "mypyc.__main__:main"
67+
68+
[tool.setuptools.packages.find]
69+
include = ["mypy*", "mypyc*", "*__mypyc*"]
70+
namespaces = false
71+
72+
[tool.setuptools.package-data]
73+
mypy = [
74+
"py.typed",
75+
"typeshed/**/*.py",
76+
"typeshed/**/*.pyi",
77+
"typeshed/stdlib/VERSIONS",
78+
"xml/*.xsd",
79+
"xml/*.xslt",
80+
"xml/*.css",
81+
]
82+
1783
[tool.black]
1884
line-length = 99
1985
target-version = ["py38", "py39", "py310", "py311", "py312"]

setup.py

Lines changed: 2 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@
1818
# This requires setuptools when building; setuptools is not needed
1919
# when installing from a wheel file (though it is still needed for
2020
# alternative forms of installing, as suggested by README.md).
21-
from setuptools import Extension, find_packages, setup
21+
from setuptools import Extension, setup
2222
from setuptools.command.build_py import build_py
2323

2424
from mypy.version import __version__ as version
2525

2626
if TYPE_CHECKING:
2727
from typing_extensions import TypeGuard
2828

29-
description = "Optional static typing for Python"
3029
long_description = """
3130
Mypy -- Optional Static Typing for Python
3231
=========================================
@@ -78,13 +77,6 @@ def run(self):
7877

7978
cmdclass = {"build_py": CustomPythonBuild}
8079

81-
package_data = ["py.typed"]
82-
83-
package_data += find_package_data(os.path.join("mypy", "typeshed"), ["*.py", "*.pyi"])
84-
package_data += [os.path.join("mypy", "typeshed", "stdlib", "VERSIONS")]
85-
86-
package_data += find_package_data(os.path.join("mypy", "xml"), ["*.xsd", "*.xslt", "*.css"])
87-
8880
USE_MYPYC = False
8981
# To compile with mypyc, a mypyc checkout must be present on the PYTHONPATH
9082
if len(sys.argv) > 1 and "--use-mypyc" in sys.argv:
@@ -179,67 +171,6 @@ def run(self):
179171
ext_modules = []
180172

181173

182-
classifiers = [
183-
"Development Status :: 5 - Production/Stable",
184-
"Environment :: Console",
185-
"Intended Audience :: Developers",
186-
"License :: OSI Approved :: MIT License",
187-
"Programming Language :: Python :: 3",
188-
"Programming Language :: Python :: 3.8",
189-
"Programming Language :: Python :: 3.9",
190-
"Programming Language :: Python :: 3.10",
191-
"Programming Language :: Python :: 3.11",
192-
"Programming Language :: Python :: 3.12",
193-
"Programming Language :: Python :: 3.13",
194-
"Topic :: Software Development",
195-
"Typing :: Typed",
196-
]
197-
198174
setup(
199-
name="mypy",
200-
version=version,
201-
description=description,
202-
long_description=long_description,
203-
author="Jukka Lehtosalo",
204-
author_email="[email protected]",
205-
url="https://www.mypy-lang.org/",
206-
license="MIT",
207-
py_modules=[],
208-
ext_modules=ext_modules,
209-
packages=find_packages(),
210-
package_data={"mypy": package_data},
211-
entry_points={
212-
"console_scripts": [
213-
"mypy=mypy.__main__:console_entry",
214-
"stubgen=mypy.stubgen:main",
215-
"stubtest=mypy.stubtest:main",
216-
"dmypy=mypy.dmypy.client:console_entry",
217-
"mypyc=mypyc.__main__:main",
218-
]
219-
},
220-
classifiers=classifiers,
221-
cmdclass=cmdclass,
222-
# When changing this, also update mypy-requirements.txt and pyproject.toml
223-
install_requires=[
224-
"typing_extensions>=4.6.0",
225-
"mypy_extensions >= 1.0.0",
226-
"tomli>=1.1.0; python_version<'3.11'",
227-
],
228-
# Same here.
229-
extras_require={
230-
"dmypy": "psutil >= 4.0",
231-
"mypyc": "setuptools >= 50",
232-
"python2": "",
233-
"reports": "lxml",
234-
"install-types": "pip",
235-
"faster-cache": "orjson",
236-
},
237-
python_requires=">=3.8",
238-
include_package_data=True,
239-
project_urls={
240-
"Documentation": "https://mypy.readthedocs.io/en/stable/index.html",
241-
"Repository": "https://github.com/python/mypy",
242-
"Changelog": "https://github.com/python/mypy/blob/master/CHANGELOG.md",
243-
"Issues": "https://github.com/python/mypy/issues",
244-
},
175+
version=version, long_description=long_description, ext_modules=ext_modules, cmdclass=cmdclass
245176
)

0 commit comments

Comments
 (0)