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

testfixtures.__version__ doesn't exist #94

Closed
asqui opened this issue Nov 28, 2018 · 7 comments
Closed

testfixtures.__version__ doesn't exist #94

asqui opened this issue Nov 28, 2018 · 7 comments

Comments

@asqui
Copy link
Contributor

asqui commented Nov 28, 2018

Is there any other easy way to see what version of the package you are using?

Should we add __version__ to __init__.py, as is typically done for other packages?

@cjw296
Copy link
Member

cjw296 commented Nov 28, 2018

I what context are you looking to find the version?

$ python setup.py --version
6.3.0

That's the standard way, AFAIK.

@cjw296
Copy link
Member

cjw296 commented Nov 28, 2018

@asqui
Copy link
Contributor Author

asqui commented Nov 28, 2018

The context is I've got the module imported and want an easy way to double-check what version I'm running.

For example: https://github.com/zzzeek/sqlalchemy/blob/576b33d46a9418424e94926bf9f02bdad3fc593f/lib/sqlalchemy/__init__.py#L133

@cjw296
Copy link
Member

cjw296 commented Nov 28, 2018

Why do you want to check the module at import time? There's a version.txt inside the module you could look at, but I'm likely to switch testfixtures to poetry at some stage, in which case that file will go away..

@cjw296
Copy link
Member

cjw296 commented Dec 12, 2018

No followup in a couple of weeks, so let's close until python-poetry/poetry#144 takes care of this.

@cjw296 cjw296 closed this as completed Dec 12, 2018
@fabiencelier
Copy link

Hello @cjw296

According to PEP 396 it is a good practice to include the version of your package in a __version__ variable.

This is useful if you want to check the module version at import time, for instance because different version have different API so you will do different calls.

Also there should be a single source of truth for both __version__ and the version in setup.py, here it can be your "version.txt" which is perfect for that.

I'd be happy to make you a PR if you want !

@cjw296
Copy link
Member

cjw296 commented Nov 7, 2019

Sure, PR welcome :-)

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

3 participants