Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add __version__ in __init__.py #382

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

Merged
merged 1 commit into from
Apr 8, 2023
Merged

Conversation

harupy
Copy link
Contributor

@harupy harupy commented Apr 6, 2023

Adds __version__ in __init__.py.

@hallacy
Copy link
Collaborator

hallacy commented Apr 8, 2023

Thanks for the PR @harupy. Can you tell me a bit more about why this is a helpful change for the repo?

@harupy
Copy link
Contributor Author

harupy commented Apr 8, 2023

@hallacy Thanks for the comment! Imaging the following case where you want to programmatically extract packages versions. Since openai doesnt' have a __version__ attribute, we need special handling:

import importlib

for package in ["pandas", "sklearn", "openai"]:
    print(importlib.import_module(package).__version__)
    # Doesn't work because openai doesn't have `__version__`

Copy link
Collaborator

@hallacy hallacy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it! Yep makes perfect sense

@hallacy hallacy merged commit aa133ce into openai:main Apr 8, 2023
@harupy harupy deleted the dunder-version branch April 8, 2023 05:16
davedittrich pushed a commit to davedittrich/openai-python that referenced this pull request Nov 14, 2023
cgayapr pushed a commit to cgayapr/openai-python that referenced this pull request Dec 14, 2024
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.

2 participants