Skip to content

Commit

Permalink
Move most packaging metadata to pyproject.toml (#129)
Browse files Browse the repository at this point in the history
* move most metadata to pyproject.toml
* use environment marker for conditional pycparser dep

* fix version test
  • Loading branch information
nitzmahone authored Sep 6, 2024
1 parent e317b62 commit 22d4fd8
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 61 deletions.
43 changes: 43 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,46 @@ requires = [
"setuptools >= 66.1"
]
build-backend = "setuptools.build_meta"

[project]
name = "cffi"
version = "1.18.0.dev0"
dependencies = [
"pycparser; implementation_name != 'PyPy'",
]
requires-python = ">=3.8"

description = "Foreign Function Interface for Python calling C code."
readme = {file = "README.md", content-type = "text/markdown"}
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"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 :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"License :: OSI Approved :: MIT License",
]
authors = [
{name = "Armin Rigo"},
{name = "Maciej Fijalkowski"},
]
maintainers = [
{name = "Matt Davis"},
{name = "Matt Clay"},
]

[project.entry-points."distutils.setup_keywords"]
cffi_modules = "cffi.setuptools_ext:cffi_modules"

[project.urls]
Documentation = "https://cffi.readthedocs.io/"
Changelog = "https://cffi.readthedocs.io/en/latest/whatsnew.html"
Downloads = "https://github.com/python-cffi/cffi/releases"
Contact = "https://groups.google.com/forum/#!forum/python-cffi"
"Source Code" = "https://github.com/python-cffi/cffi"
"Issue Tracker" = "https://github.com/python-cffi/cffi/issues"
10 changes: 0 additions & 10 deletions setup.cfg

This file was deleted.

48 changes: 0 additions & 48 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,40 +176,14 @@ def has_ext_modules(self):
# arguments mostly empty in this case.
cpython = ('_cffi_backend' not in sys.builtin_module_names)

install_requires = []
if cpython:
install_requires.append('pycparser')

setup(
name='cffi',
description='Foreign Function Interface for Python calling C code.',
long_description="""
CFFI
====
Foreign Function Interface for Python calling C code.
Please see the `Documentation <http://cffi.readthedocs.org/>`_.
Contact
-------
`Mailing list <https://groups.google.com/forum/#!forum/python-cffi>`_
""",
version='1.18.0.dev0',
python_requires='>=3.8',
packages=['cffi'] if cpython else [],
package_dir={"": "src"},
package_data={'cffi': ['_cffi_include.h', 'parse_c_type.h',
'_embedding.h', '_cffi_errors.h']}
if cpython else {},
zip_safe=False,

url='http://cffi.readthedocs.org',
author='Armin Rigo, Maciej Fijalkowski',
author_email='python-cffi@googlegroups.com',

license='MIT',

distclass=CFFIDistribution,
ext_modules=[Extension(
name='_cffi_backend',
Expand All @@ -222,26 +196,4 @@ def has_ext_modules(self):
extra_link_args=extra_link_args,
extra_objects=forced_extra_objs,
)] if cpython else [],

install_requires=install_requires,

entry_points = {
"distutils.setup_keywords": [
"cffi_modules = cffi.setuptools_ext:cffi_modules",
],
},

classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'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 :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'License :: OSI Approved :: MIT License',
],
)
6 changes: 3 additions & 3 deletions testing/cffi0/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ def test_doc_version():
assert ("version = '%s'\n" % v[:4]) in content
assert ("release = '%s'\n" % v) in content

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

def test_c_version():
cffi_root = Path(os.path.dirname(__file__)).parent.parent
Expand Down

0 comments on commit 22d4fd8

Please sign in to comment.