You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Guide for "Single sourcing the package version" refers to setup.py #1260
Since setup.py is deprecated in favour of pyproject.toml, I wonder what to do with this document. Single sourcing the version should be a non-issue. We could either strip the whole document down to pyproject.toml which would make the document very small, or move the relevant paragraph into the packaging tutorial:
[project]
name = "package"dynamic = ["version"]
[tool.setuptools.dynamic]
version = {attr = "package.__version__"}
FWIW setup.py isn't deprecated at all. What's discouraged is calling it directly as a script. Using it through the standard PEP 517 interface is perfectly valid use.
It would be nice, however, to swap the preference in the document. I'd still go for setup.cfg, though, as my personal preference is to keep the metadata in a dedicated file. Besides, pyproject.toml is still labeled as beta in setuptools.
pyproject.toml is not labelled as beta in setuptools. It is support for declaring configurations not standardized by PEP 621 that is still in beta stage. version is not one of those fields.
The plan from setuptools is to eventually deprecate setup.cfg, so its use should not be recommended in the packaging guide.
+1 for moving pyproject.toml example to the top, the existing setup.py example is quite crufty and hacky.
Activity
chrysle commentedon May 23, 2023
setup.pyisn't deprecated that long, and many projects are still using it. I'm for keeping the page as-is.webknjaz commentedon May 23, 2023
FWIW
setup.pyisn't deprecated at all. What's discouraged is calling it directly as a script. Using it through the standard PEP 517 interface is perfectly valid use.webknjaz commentedon May 23, 2023
It would be nice, however, to swap the preference in the document. I'd still go for
setup.cfg, though, as my personal preference is to keep the metadata in a dedicated file. Besides,pyproject.tomlis still labeled as beta insetuptools.chrysle commentedon May 23, 2023
There's some excellent lecture about this, maybe this can be linked?
Preference for what do you mean?
webknjaz commentedon May 23, 2023
For the main article contents to feature
setup.cfg, movingsetup.pyto the "note" blocks.wimglenn commentedon Jun 8, 2023
@webknjaz To correct some misconceptions:
pyproject.tomlis not labelled as beta in setuptools. It is support for declaring configurations not standardized by PEP 621 that is still in beta stage. version is not one of those fields.The plan from setuptools is to eventually deprecate
setup.cfg, so its use should not be recommended in the packaging guide.+1 for moving
pyproject.tomlexample to the top, the existingsetup.pyexample is quite crufty and hacky.ChrisBarker-NOAA commentedon Jul 10, 2023
thin the page needs updating:
See #1273
Please comment / edit that so we can get a nicer page together.
ncoghlan commentedon Oct 15, 2024
Resolved in #1612