Skip to content

Conversation

@AndyTitu
Copy link
Contributor

@AndyTitu AndyTitu commented Jun 12, 2024

Summary

This PR fixes the Item types not being exported correctly.

Thought process

The problem occurred because of the logic for filling up the __all__ field in init.py. Fixed this by evaluating the types module and extracting the right types from it.

How to test

  1. pip install . - to install the current version

  2. python3 example/example.py to run the example.py file

@AndyTitu AndyTitu changed the title Export types correctly Export types correctly in wildcards Jun 12, 2024
Copy link
Member

@hculea hculea left a comment

Choose a reason for hiding this comment

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

Functionally tested - confirmed that this change translates in the statement

from onepassword import *

also importing the types.

I'm not aware whether this is the idiomatic way to do this in Python, though, but feel free to proceed only with my review if you're confident about it.

@AndyTitu
Copy link
Contributor Author

Functionally tested - confirmed that this change translates in the statement

from onepassword import *

also importing the types.

I'm not aware whether this is the idiomatic way to do this in Python, though, but feel free to proceed only with my review if you're confident about it.

Yes, I'm confident. Wildcards are used sometimes, and it's important to support those as well in addition to all other importing syntax we already support such as from onepassword import Client, Item or from onepassword.types import Item or from onepassword.types import *.

@AndyTitu AndyTitu merged commit cc322c1 into main Jun 14, 2024
@AndyTitu AndyTitu deleted the andi/fix-python-type-imports branch July 31, 2024 10:33
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.

3 participants