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

Simplify imports in pycatia with improved module structure #255

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

Conversation

HubertDomaros
Copy link

Problem
Currently, pycatia requires importing each class from its specific module, leading to lengthy import statements when building something more complex:

from pycatia.mec_mod_interfaces.part import Part
from pycatia.mec_mod_interfaces.body import Body
from pycatia.mec_mod_interfaces.hybrid_body import HybridBody
# ...many more imports

Solution
I autopopulated init.py files for each module with help of utility script (https://gist.github.com/HubertDomaros/9d1a03bf0ebc7080b40604712147b3ca) to expose all classes within that module. This allows for much cleaner imports:

from pycatia.mec_mod_interfaces import Part, Body, HybridBody

This change maintains backward compatibility while significantly improving developer experience by reducing import verbosity.

@evereux
Copy link
Owner

evereux commented Mar 2, 2025

This is something I attempted myself sometime back. But, as soon I entered the circular import error hell I gave up. It appears that this is also an issue here.

Have you tried running the tests?

pytest -v tests

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