Skip to content

Import all classes in the toplevel __init__.py #287

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
andlaus opened this issue Apr 6, 2024 · 3 comments
Open

Import all classes in the toplevel __init__.py #287

andlaus opened this issue Apr 6, 2024 · 3 comments
Labels
good first contribution Good for newcomers help wanted Extra attention is needed

Comments

@andlaus
Copy link
Member

andlaus commented Apr 6, 2024

this would allow to import all classes directly in external code instead of having to know the sub-module where the class of interest is defined. example: With this,

from odxtools.diaglayer import DiagLayer

could be replaced by

from odxtools import DiagLayer

On the flipside, this increases the effort required for maintenance, because all classes provided by the project would need to be imported to __init__.py.

@andlaus andlaus added good first contribution Good for newcomers help wanted Extra attention is needed labels Apr 6, 2024
@vinothk-master
Copy link
Contributor

vinothk-master commented Apr 23, 2025

Hi @andlaus, Can i contribute this issue ?

@andlaus
Copy link
Member Author

andlaus commented Apr 25, 2025

I'm not sure anymore if this is a good idea: Whenever a new class is introduced, implementing this issue would require also adapting __init__.py. I suspect that this will be forgotten frequently. maybe @kayoub5 can chime in?

@kayoub5
Copy link
Collaborator

kayoub5 commented Apr 29, 2025

@andlaus it's possible to walk the API graph and record "all used types", then cross check them against what you have in init file.

Such algorithms are frequently used in documentation generators, so CHATGPT or simular could generate the base code necessary for this for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first contribution Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants