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

Comments

Projects
None yet
2 participants
@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

This comment has been minimized.

Copy link
Collaborator

alexamici commented Nov 12, 2018

@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?

@shoyer

This comment has been minimized.

Copy link
Contributor Author

shoyer commented Nov 12, 2018

@alexamici

This comment has been minimized.

Copy link
Collaborator

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 alexamici closed this Nov 12, 2018

@alexamici

This comment has been minimized.

Copy link
Collaborator

alexamici commented Nov 12, 2018

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

@alexamici alexamici reopened this Nov 12, 2018

@shoyer

This comment has been minimized.

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

This comment has been minimized.

Copy link
Collaborator

alexamici commented Nov 12, 2018

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.

@alexamici alexamici closed this Nov 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.