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

circular imports with compute utils #1240

Closed
unalmis opened this issue Sep 2, 2024 · 0 comments · Fixed by #1241
Closed

circular imports with compute utils #1240

unalmis opened this issue Sep 2, 2024 · 0 comments · Fixed by #1241
Assignees
Labels
easy Short and simple to code or review

Comments

@unalmis
Copy link
Collaborator

unalmis commented Sep 2, 2024

Due to how we register things in data_index:

# just need to import all the submodules here to register everything in the
     27 # data_index
---> 29 from . import (
     30     _basis_vectors,
     31     _bootstrap,
     32     _core,
     33     _curve,
     34     _equil,
     35     _field,
     36     _geometry,
     37     _metric,
     38     _neoclassical,
     39     _omnigenity,
     40     _profiles,
     41     _stability,
     42     _surface,
     43 )
     44 from .data_index import all_kwargs, allowed_kwargs, data_index
     45 from .geom_utils import rpz2xyz, rpz2xyz_vec, xyz2rpz, xyz2rpz_vec

any function defined inside A = desc/compute, called inside some directory $B \notin A$, will generate a circular import error whenever something $b \in B$ is called in $A$. This is problematic because we have general utilities inside desc/compute such as all the safedivs. We should move anything from desc/compute/utils that isn't directly related to data_index stuff to desc/utils.

To reproduce, create a compute function that uses desc/integrals/singularities or bounce integrals which both call safediv.

@unalmis unalmis added the easy Short and simple to code or review label Sep 2, 2024
@unalmis unalmis linked a pull request Sep 2, 2024 that will close this issue
@dpanici dpanici closed this as completed in c4c4587 Sep 5, 2024
dpanici added a commit that referenced this issue Sep 5, 2024
@unalmis unalmis self-assigned this Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy Short and simple to code or review
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant