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

Guide for "Single sourcing the package version" refers to setup.py #1260

Closed
venthur opened this issue May 23, 2023 · 8 comments
Closed

Guide for "Single sourcing the package version" refers to setup.py #1260

venthur opened this issue May 23, 2023 · 8 comments

Comments

@venthur
Copy link
Contributor

venthur commented May 23, 2023

https://packaging.python.org/en/latest/guides/single-sourcing-package-version/ refers to setup.py and the many ways how to get the version into setup.py. pyproject.toml is mentioned only as a side note.

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__"}
@chrysle
Copy link
Contributor

chrysle commented May 23, 2023

https://packaging.python.org/en/latest/guides/single-sourcing-package-version/ refers to setup.py and the many ways how to get the version into setup.py. pyproject.toml is mentioned only as a side note.

Since setup.py is deprecated in favour of pyproject.toml, I wonder what to do with this document.

setup.py isn't deprecated that long, and many projects are still using it. I'm for keeping the page as-is.

@webknjaz
Copy link
Member

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.

@webknjaz
Copy link
Member

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.

@chrysle
Copy link
Contributor

chrysle commented May 23, 2023

FWIW setup.py isn't deprecated at all. What's discouraged is calling it directly as a script.

There's some excellent lecture about this, maybe this can be linked?

It would be nice, however, to swap the preference in the document.

Preference for what do you mean?

@webknjaz
Copy link
Member

For the main article contents to feature setup.cfg, moving setup.py to the "note" blocks.

@wimglenn
Copy link
Contributor

wimglenn commented Jun 8, 2023

@webknjaz To correct some misconceptions:

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.

@ChrisBarker-NOAA
Copy link
Contributor

thin the page needs updating:

See #1273

Please comment / edit that so we can get a nicer page together.

@ncoghlan
Copy link
Member

Resolved in #1612

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

No branches or pull requests

7 participants
@venthur @webknjaz @ChrisBarker-NOAA @ncoghlan @wimglenn @chrysle and others