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

Store config in setup.cfg and update setuptools configuration #57

Closed
wants to merge 3 commits into from

Conversation

4383
Copy link

@4383 4383 commented Nov 1, 2017

Overview

Move setup configuration to setup.cfg insteadof setup.py.

Features

  • Using setup.cfg for configure setuptools
  • Sample module retrieve version from package informations or fron config file

@4383 4383 force-pushed the update/distribute branch 11 times, most recently from 8351971 to 850ae9c Compare November 1, 2017 20:35
@pfmoore
Copy link
Member

pfmoore commented Nov 1, 2017

There was a discussion about doing this in #56 and pypa/packaging.python.org#378 and the conclusion was that it's a bit too early to move to setup.cfg based metadata.

Personally, I like the feature, but I can see that we want to be cautious of making it the standard when there's likely to be plenty of people on older versions of tools.

BTW, it would be easier to manage this PR if you focused it just on the setup.cfg switch. You seem to have included changes to the tox config, a fix to MANIFEST.in, and some sort of change to the version handling in this PR as well :-(

@4383 4383 force-pushed the update/distribute branch 2 times, most recently from a3f30a9 to 1de805d Compare November 1, 2017 20:47
@4383
Copy link
Author

4383 commented Nov 1, 2017

@pfmoore Thanks for your comment.
We need to specify some packages data to include files and we need to specify them in MANIFEST.in.

travis modifications not introduce changes on tests just import python version specificaly.

@4383
Copy link
Author

4383 commented Nov 1, 2017

__version__ handling can be remove, do you want ?

Copy link
Member

@pfmoore pfmoore left a comment

Choose a reason for hiding this comment

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

First of all, as noted in the issues I referenced, I don't think this will be accepted in the short term. But if you want to prepare something that could be considered in the future, then there are a number of issues that I'd like to see addressed.

.travis.yml Outdated

script: tox
script:
- tox -e $(echo py$TRAVIS_PYTHON_VERSION | tr -d .)

Copy link
Member

Choose a reason for hiding this comment

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

The changes to this file are not related to switching to setup.cfg, so they should be split out into a separate PR (with an explanation of why the changes are needed - are the tests failing as things stand?).



def _extract_version(package_name):
try:
Copy link
Member

Choose a reason for hiding this comment

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

This is code that we're recommending everyone include in their projects - I don't think we want an _extract_version like this, or pkg_resources and setuptools dependencies, in such a recommendation.

The existing code doesn't offer a "get the package version" function, or try to address how the application should expose its version at runtime. I'd rather that remain the case, but even if we were to decide that we do that, it should be a separate PR (again!)

return _conf['metadata']['version']


__version__ = _extract_version('pipenv')
Copy link
Member

Choose a reason for hiding this comment

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

Why the reference to pipenv here?


def main():
"""Entry point for the application script"""
print("Sample version {}".format(__version__))
Copy link
Member

Choose a reason for hiding this comment

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

This is a stub for people to write their application code - why print the version here?



if __name__ == "__main__":
print(__version__)
Copy link
Member

Choose a reason for hiding this comment

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

__init__.py isn't typically executable. What's the point of this change?

MANIFEST.in Outdated
@@ -3,3 +3,6 @@ include LICENSE.txt

# Include the data files
recursive-include data *

# Include package data
include sample/package_data.dat
Copy link
Member

Choose a reason for hiding this comment

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

Is this just because of the "if you are using Python 2.6, it should be in MANIFEST.in comment below? If so, then (a) it's not specific to this PR, it's a change that applies to the existing code as well, but (b) we don't support Python 2.6 according to setup.py/setup.cfg, so we don't need it anyway.

@4383 4383 force-pushed the update/distribute branch 7 times, most recently from 09181c9 to 41825c6 Compare November 1, 2017 21:48
@4383
Copy link
Author

4383 commented Nov 1, 2017

@pfmoore changes applied!
CI exit with error on python 3.3 interpreter not found...

@4383
Copy link
Author

4383 commented Nov 5, 2017

https://packaging.python.org/tutorials/distributing-packages/#setup-cfg I think this documentation must be updated, it's reference setup.cfg on sampleproject but sampleproject don't use this practice at this moment

@pfmoore
Copy link
Member

pfmoore commented Nov 5, 2017

The docs refer to setup.cfg as an example of how to specify a universal wheel. That's both a valid usage, and good practice if your code is Pure Python and supports Python 2 and 3.

Just because we don't give an example of (or recommend) the relatively new setuptools extension to allow most of setup.py to be moved to setup.cfg, doesn't mean that the existing docs aren't accurate.

@4383
Copy link
Author

4383 commented Nov 5, 2017

@pfmoore ok thanks for response :)

Саша Черных and others added 2 commits January 19, 2018 10:49
@4383 4383 changed the title update setuptools configuration Store config in setup.cfg and update setuptools configuration Jul 4, 2019
Base automatically changed from master to main January 21, 2021 18:40
@pfmoore pfmoore closed this in #166 Dec 1, 2022
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.

None yet

2 participants