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

Provide __version__ attribute #31

Closed
shoyer opened this issue Nov 11, 2018 · 6 comments
Closed

Provide __version__ attribute #31

shoyer opened this issue Nov 11, 2018 · 6 comments
Assignees

Comments

@shoyer
Copy link
Contributor

shoyer commented Nov 11, 2018

It's a convention for Python projects to set the __version__ attribute to a string representing the current version. This facilitates debugging and version checking by downstream projects (e.g., xarray).

@alexamici
Copy link
Contributor

@shoyer I'm using zest.releaser for version management and they suggest adding this snippet to cfgrib/__init__.py:

import pkg_resources

__version__ = pkg_resources.get_distribution('cfgib').version

in order to still keep one single master version in setup.py. Would that work for you?

@alexamici alexamici self-assigned this Nov 12, 2018
@shoyer
Copy link
Contributor Author

shoyer commented Nov 12, 2018 via email

@alexamici
Copy link
Contributor

alexamici commented Nov 12, 2018

Ok, things got a bit more complicated than that, but now cfgrib.__version__ return the currently installed version.

Will be in the next release.

@alexamici
Copy link
Contributor

That was too fast. Current master has a circular import problem that prevents setting __version__.

@alexamici alexamici reopened this Nov 12, 2018
@shoyer
Copy link
Contributor Author

shoyer commented Nov 12, 2018

versioneer is one commonly used tool for this: https://github.com/warner/python-versioneer

(We use it in xarray, pandas and dask)

@alexamici
Copy link
Contributor

Looks like I could implement the single-sourcing the package version using method 1 of: https://packaging.python.org/guides/single-sourcing-package-version/

Trying to close again.

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