Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PEP 517/518? #16

Open
icemac opened this issue Apr 1, 2020 · 4 comments
Open

Use PEP 517/518? #16

icemac opened this issue Apr 1, 2020 · 4 comments
Labels
question Further information is requested

Comments

@icemac
Copy link
Member

icemac commented Apr 1, 2020

Has anyone gathered experience in projects using PEP 517/518 aka pyproject.toml instead of setup.py and other configuration files?

Would this be a way forward for the Zopefoundation projects aka #13.

See https://snarky.ca/what-the-heck-is-pyproject-toml/ for an introduction to the topic where I stumbled upon it.

@icemac icemac added the question Further information is requested label Apr 1, 2020
@dataflake
Copy link
Member

I have anecdotal evidence only from plone.recipe.plone2instance which uses it. It didn't replace any of the other files like setup.cfg and ended up being yet another file where package information is stored. I did not see any value, just the opposite.

@mgedmin
Copy link
Member

mgedmin commented Apr 1, 2020

Well, according to that blog post, if you want editable installs (e.g. you like tox's usedevelop = true), then you still need a (shim) setup.py.

Many ZF packages concatenate the contents of README.rst + '\n\n' + the contents of CHANGES.rst in their setup.py. I believe setuptools lets you specify long_description = file: README.rst or some such syntax in a setup.cfg, but I don't think it allows you to concatenate two files, which would also rule out dropping the setup.py for those packages.

One thing pyproject.toml gives us is the ability to specify setup_requires in a way that lets pip install them before running setup.py (which would install them using easy_install, causing all sorts of problems). I would say we want do do this for any package that needs setup_requires (but there are few of those).

For packages that don't use setup_requires, I'm not sure what pyproject.toml gets us, other than warm fuzzy feelings of "we're using the latest standards now", which is not enough for me personally.

@tseaver
Copy link
Member

tseaver commented Apr 18, 2024

FWIW, I added a pyproject.toml to persistent in this PR, because it seemed easier to spell the convoluted conditional cffi dependency there.

I didn't coalesce the other tooling files: .setup.cfg, tox.ini, .coveragerc, but it would have been trivial to do so. I don't really grok the meta machinery here, but would be willing to work on a POC for the changes. I will be sprinting a couple of days at PyCon US (May 20 - 21), and could get to it then, if not before.

@mgedmin that PR shows how to concatenate the README.rst and CHANGES.rst files:

[tool.setuptools.dynamic]
readme = {file = ["README.rst", "CHANGES.rst"]}

Interesingly, that PR still had to keep the setup.py file in order to build the C extensions. And it replaces the setup_requires via this bit:

[build-system]
requires = [
    "setuptools",
    "wheel",
    "cffi ; platform_python_implementation == 'CPython'",
    "cffi @ git+https://github.com/python-cffi/cffi.git ; platform_python_implementation == 'CPython' and python_version >= '3.13a0'",
]
build-backend = "setuptools.build_meta"

@dataflake
Copy link
Member

I'd be in favor of a separate template type for the configure script that does it the way Tres suggests plus moves all those other separate configurations into pyproject.toml. As @mgedmin said, the first targets could be packages using setup_requires, or packages with C extensions in general. I wonder if that would help with the macOS issues I keep seeing for those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants