Skip to content

Commit 22d4fd8

Browse files
authored
Move most packaging metadata to pyproject.toml (#129)
* move most metadata to pyproject.toml * use environment marker for conditional pycparser dep * fix version test
1 parent e317b62 commit 22d4fd8

File tree

4 files changed

+46
-61
lines changed

4 files changed

+46
-61
lines changed

pyproject.toml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,46 @@ requires = [
55
"setuptools >= 66.1"
66
]
77
build-backend = "setuptools.build_meta"
8+
9+
[project]
10+
name = "cffi"
11+
version = "1.18.0.dev0"
12+
dependencies = [
13+
"pycparser; implementation_name != 'PyPy'",
14+
]
15+
requires-python = ">=3.8"
16+
17+
description = "Foreign Function Interface for Python calling C code."
18+
readme = {file = "README.md", content-type = "text/markdown"}
19+
classifiers = [
20+
"Programming Language :: Python",
21+
"Programming Language :: Python :: 3",
22+
"Programming Language :: Python :: 3.8",
23+
"Programming Language :: Python :: 3.9",
24+
"Programming Language :: Python :: 3.10",
25+
"Programming Language :: Python :: 3.11",
26+
"Programming Language :: Python :: 3.12",
27+
"Programming Language :: Python :: 3.13",
28+
"Programming Language :: Python :: Implementation :: CPython",
29+
"Programming Language :: Python :: Implementation :: PyPy",
30+
"License :: OSI Approved :: MIT License",
31+
]
32+
authors = [
33+
{name = "Armin Rigo"},
34+
{name = "Maciej Fijalkowski"},
35+
]
36+
maintainers = [
37+
{name = "Matt Davis"},
38+
{name = "Matt Clay"},
39+
]
40+
41+
[project.entry-points."distutils.setup_keywords"]
42+
cffi_modules = "cffi.setuptools_ext:cffi_modules"
43+
44+
[project.urls]
45+
Documentation = "https://cffi.readthedocs.io/"
46+
Changelog = "https://cffi.readthedocs.io/en/latest/whatsnew.html"
47+
Downloads = "https://github.com/python-cffi/cffi/releases"
48+
Contact = "https://groups.google.com/forum/#!forum/python-cffi"
49+
"Source Code" = "https://github.com/python-cffi/cffi"
50+
"Issue Tracker" = "https://github.com/python-cffi/cffi/issues"

setup.cfg

Lines changed: 0 additions & 10 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -176,40 +176,14 @@ def has_ext_modules(self):
176176
# arguments mostly empty in this case.
177177
cpython = ('_cffi_backend' not in sys.builtin_module_names)
178178

179-
install_requires = []
180-
if cpython:
181-
install_requires.append('pycparser')
182-
183179
setup(
184-
name='cffi',
185-
description='Foreign Function Interface for Python calling C code.',
186-
long_description="""
187-
CFFI
188-
====
189-
190-
Foreign Function Interface for Python calling C code.
191-
Please see the `Documentation <http://cffi.readthedocs.org/>`_.
192-
193-
Contact
194-
-------
195-
196-
`Mailing list <https://groups.google.com/forum/#!forum/python-cffi>`_
197-
""",
198-
version='1.18.0.dev0',
199-
python_requires='>=3.8',
200180
packages=['cffi'] if cpython else [],
201181
package_dir={"": "src"},
202182
package_data={'cffi': ['_cffi_include.h', 'parse_c_type.h',
203183
'_embedding.h', '_cffi_errors.h']}
204184
if cpython else {},
205185
zip_safe=False,
206186

207-
url='http://cffi.readthedocs.org',
208-
author='Armin Rigo, Maciej Fijalkowski',
209-
author_email='[email protected]',
210-
211-
license='MIT',
212-
213187
distclass=CFFIDistribution,
214188
ext_modules=[Extension(
215189
name='_cffi_backend',
@@ -222,26 +196,4 @@ def has_ext_modules(self):
222196
extra_link_args=extra_link_args,
223197
extra_objects=forced_extra_objs,
224198
)] if cpython else [],
225-
226-
install_requires=install_requires,
227-
228-
entry_points = {
229-
"distutils.setup_keywords": [
230-
"cffi_modules = cffi.setuptools_ext:cffi_modules",
231-
],
232-
},
233-
234-
classifiers=[
235-
'Programming Language :: Python',
236-
'Programming Language :: Python :: 3',
237-
'Programming Language :: Python :: 3.8',
238-
'Programming Language :: Python :: 3.9',
239-
'Programming Language :: Python :: 3.10',
240-
'Programming Language :: Python :: 3.11',
241-
'Programming Language :: Python :: 3.12',
242-
'Programming Language :: Python :: 3.13',
243-
'Programming Language :: Python :: Implementation :: CPython',
244-
'Programming Language :: Python :: Implementation :: PyPy',
245-
'License :: OSI Approved :: MIT License',
246-
],
247199
)

testing/cffi0/test_version.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ def test_doc_version():
3838
assert ("version = '%s'\n" % v[:4]) in content
3939
assert ("release = '%s'\n" % v) in content
4040

41-
def test_setup_version():
41+
def test_pyproject_version():
4242
cffi_root = Path(os.path.dirname(__file__)).parent.parent
43-
p = cffi_root / 'setup.py'
43+
p = cffi_root / 'pyproject.toml'
4444
content = _read(p)
4545
#
4646
v = cffi.__version__.replace('+', '')
47-
assert ("version='%s'" % v) in content
47+
assert f'version = "{v}"' in content
4848

4949
def test_c_version():
5050
cffi_root = Path(os.path.dirname(__file__)).parent.parent

0 commit comments

Comments
 (0)