Azure / azure-storage-python

Microsoft Azure Storage Library for Python
https://azure-storage.readthedocs.io
MIT License
339 stars 241 forks source link

Missing `__version__` attribute #535

Open enricorotundo opened 5 years ago

enricorotundo commented 5 years ago

Which version of the SDK was used? Please provide the output of pip freeze.

...
azure-common==1.1.16
azure-storage-blob==1.4.0
azure-storage-common==1.4.0
azure-storage-file==1.4.0
azure-storage-queue==1.4.0
...

What problem was encountered?

I cannot retrieve the module version because version is missing in both azure and azure.storage.blob (see below). I thought that was a pretty standard way to do it see PEP 396 and this issue

>>> import azure
>>> azure.__version__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'azure' has no attribute '__version__'
zezha-msft commented 5 years ago

Hi @enricorotundo, thanks for reaching out!

I vaguely remember discussing about this issue, but couldn't recall why we didn't do this. @lmazuel help? 😃

lmazuel commented 5 years ago

azure.storage.blob should indeed have a __version__ to respect common practices. Example:

>>> import azure.mgmt.compute
>>> azure.mgmt.compute.__version__
'4.3.1'

What I even do, is reading it to populate the version of my setup.py, to be sure they are in sync: https://github.com/Azure/azure-sdk-for-python/blob/376e691a352b7aeffc5593ec5e63b91f0e9161e0/azure-mgmt-cosmosdb/setup.py#L38-L41

However, azure itself is not a real package, it's an empty module that does not contain any code, and this should not have a __version__

zezha-msft commented 5 years ago

@lmazuel thank you! I've logged this item to be completed by the next release(targeting 7/12/2019). Close the issue currently, feel free to reopen this if you have further questions!

enricorotundo commented 5 years ago

I understand azure is not a real package but since I can pip install azure==4.0.0 and pip freeze | grep azure ---> azure==4.0.0, I'd expect it to have a __version__ attribute.

xiafu-msft commented 5 years ago

Hi @lmazuel

Would you like to provide some help about adding version to azure? We have added version to azure-storage-* packages. https://github.com/Azure/azure-storage-python/commit/8bb2c81c3058f78de00a29d538e444dd0a1a39dc

Thanks for your help

lmazuel commented 5 years ago

We do not have plan to add version for the azure package. That's a meta-package used to install more libraries. Also, on Python 3 the file azure/__init__.py doesn't even exist, I have no opportunity to add this information. The future of the azure package is in discussion, right now the recommendation is to depend on the set of services you need and not azure