Skip to content

fetching version from __version__ attribute #23

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

Closed
europa502 opened this issue Apr 27, 2021 · 5 comments
Closed

fetching version from __version__ attribute #23

europa502 opened this issue Apr 27, 2021 · 5 comments

Comments

@europa502
Copy link

If I'm not wrong version attribute is not being set which makes it difficult to fetch the version of flask-compress.
Is there any other attribute which would provide this package's version info?

@alexprengere
Copy link
Collaborator

Looking at the linked issue from plotly/dash#1606, this is not related to flask-compress, and is a duplicate #22

@europa502
Copy link
Author

europa502 commented Apr 27, 2021

Can you add __ version __ attribute for this package? It'd make it easier to fetch version info then.

@europa502
Copy link
Author

Looking at the linked issue from plotly/dash#1606, this is not related to flask-compress, and is a duplicate #22

@europa502 europa502 reopened this Apr 27, 2021
@alexprengere
Copy link
Collaborator

I agree that sometimes it is nice to have a version attribute to read in the sources, but nevertheless the preferred way to get the version of an installed package is:

>>> import pkg_resources
>>> pkg_resources.get_distribution('flask-compress').version
'1.9.0'

I do not mind adding the __version__ attribute, but I think this would be best served by using setuptools_scm here, so it would automatically generate the version.py containing __version__, when building the sdist, based on the git tag. So, instead of manually maintaining the version in 3 places (git tags, setup.py, version.py), only one place is needed.
It would also require to migrate to PEP517 beforehand.

@alexprengere
Copy link
Collaborator

alexprengere commented Jun 14, 2021

I implemented the migration to setuptools_scm, so now a _version.py file is automatically generated when building the packages, based on the latest git tags. Once the release is published (or using the master branch), you should be able to access it with flask_compress.__version__.

Edit: 1.10.0 is now available on PyPI

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

2 participants