colour-science / flask-compress

Compress responses of your Flask application.
MIT License
117 stars 27 forks source link

fetching version from __version__ attribute #23

Closed europa502 closed 3 years ago

europa502 commented 3 years ago

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 commented 3 years ago

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

europa502 commented 3 years ago

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

europa502 commented 3 years ago

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

alexprengere commented 3 years ago

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 commented 3 years ago

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