Skip to content

Add __all__ symbol to the packaget __init__ file #6

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AAraKKe
Copy link

@AAraKKe AAraKKe commented Apr 29, 2025

Hi YNAB team!

I know this change is not something you might want to add since this SDK is automatically generated by the OpenApiGenerator but this is an open issue on the generator (see this issue) and it has been there fore 2 years and does not seem to get any tracktion.

The issue here is that while we are importing all packages to be importable by anyone using the SDK, type checkers will fail to understand these exist because the package is marked with the py.typed file. The pyright typechecker has a good description of the behavior in their documentation.

The issue here is that if we import these modules as

from ynab import ApiClient

Type checkers would mark ApiClient as private and raise an error unless:

  • We disable the check. In the case of pyright, the type checker used in VSCode Pylance language server, the reportPrivateImportUsage check.
  • We import the modules all from the module they are in which turns the code into a very verbose set of imports.

For example:

from ynab.models.transaction_detail import TransactionDetail
from ynab.models.transaction_cleared_status import TransactionClearedStatus

I would open a PR on the generator itself but their PR backlog is quite big and it might take me a while to setup a java project. Since it is unlikely you will be regenerating this soon (in 3 years I think the API spec in YNAB has been stable) I leave the PR here in case you want to consider adding it.

Thanks!

@AAraKKe
Copy link
Author

AAraKKe commented Apr 29, 2025

I opened a PR on the openapi-generator pacakge as well to fix this: OpenAPITools/openapi-generator#21185.

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.

1 participant