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

Replace setup.py with declarative setup.cfg #292

Merged
merged 1 commit into from
Jul 2, 2021
Merged

Replace setup.py with declarative setup.cfg #292

merged 1 commit into from
Jul 2, 2021

Conversation

jdufresne
Copy link
Member

Avoid mixing code with configuration.

Running setuptools no longer runs arbitrary custom code, it is all
driven through a key/value configuration file, setup.cfg.

This also simplifies other tools interaction. For example, the Sphinx
config no longer needs to parse source code (and hope the format hasn't
changed). Now, it can use the configparser library to pull values from
setup.cfg.

docs/conf.py Outdated Show resolved Hide resolved
nir0s
nir0s previously approved these changes Jul 1, 2021
setup.cfg Outdated
@@ -1,3 +1,43 @@
[metadata]
name = distro
version = 1.5.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on closing #265 by using version = attr: distro.__version__?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I addressed the issue in PR #294.

We can't use version = attr: distro.__version__ as that would break the Sphinx configuration which parses setup.cfg to grab the version. I've taken the alternative approach of querying the installed version from distro.py. This is safer as other tools can continue to rely on setup.cfg as a source of truth.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sethmlarson I've applied this suggestion in the latest revision.

@hartwork This also fixes your suggestion from earlier. The docs can now be built with Python 2 again.

More review feedback welcome.

Avoid mixing code with configuration.

Running setuptools no longer runs arbitrary custom code, it is all
driven through a key/value configuration file, setup.cfg.

This also simplifies other tools interaction. For example, the Sphinx
config no longer needs to parse source code (and hope the format hasn't
changed). Now, it can use the configparser library to pull values from
setup.cfg.
Copy link
Contributor

@sethmlarson sethmlarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for this.

@jdufresne jdufresne merged commit a3da4d4 into python-distro:master Jul 2, 2021
@jdufresne jdufresne deleted the setup.cfg branch July 2, 2021 21:02
@hartwork hartwork added this to the 1.6.0 milestone Jul 10, 2021
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

Successfully merging this pull request may close these issues.

4 participants