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

add version() to access __version__ for the python 3 version #15

Merged
merged 2 commits into from
Mar 19, 2021

Conversation

piyueh
Copy link
Member

@piyueh piyueh commented Feb 26, 2021

Currently when __init__.py does from .imaplib2 import *, __version__ is not imported because it is not in __all__. However, offlineimap 3 requires this variable to under the top-level package name of imaplib2. See line 75 in offlineimap3/init.py: https://github.com/OfflineIMAP/offlineimap3/blob/1e7ef9e7e6952f5d29ef0f5c25fd062798de55f3/offlineimap/init.py#L75

This PR adds __version__ to __all__.

This PR adds a function version() to imaplib2.py3 to access __version__. The plan is to modify the offlineimap 3 to use this version() function.

@piyueh piyueh changed the title add __version__ to __all__ for pthe ython 3 version add __version__ to __all__ for the python 3 version Feb 26, 2021
@thekix
Copy link
Contributor

thekix commented Feb 26, 2021

Hello @piyueh

IMO the imaplib2 should include a method to retrieve the imaplib2 version. Something like imaplib2.version(). Accessing to the internal variable xxxxx IMO is not the right method. Then, we can use this function in offlineipam3.

OTOH, I think is better split your patch in two patches, one for the "style" (spaces, emtpy lines) and other for the version.

Best regards,
kix

@piyueh
Copy link
Member Author

piyueh commented Feb 26, 2021

Hi @thekix Yes I agree. I can probably do it later and push to this PR.

Ah, those removed spaces are automatically done by my editor. Not intentional...

@piyueh
Copy link
Member Author

piyueh commented Feb 26, 2021

@thekix Now there's a version function that returns the version string. It can also return the version number as a tuple of (major, minor). I didn't make the change to the Python 2 version (the imaplib2.py file) because Python 2 has already reached EOL.

@piyueh piyueh changed the title add __version__ to __all__ for the python 3 version add version() to access __version__ for the python 3 version Feb 26, 2021
@piyueh piyueh merged commit 7b9225a into jazzband:master Mar 19, 2021
@piyueh piyueh deleted the quick-fix-py3 branch March 19, 2021 20:11
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

Successfully merging this pull request may close these issues.

None yet

2 participants