harmonica icon indicating copy to clipboard operation
harmonica copied to clipboard

Enforce non-public subpackages as private modules?

Open santisoler opened this issue 2 years ago • 0 comments

Right now Harmonica has a several subpackages (forward, equivalent_sources, visualization), but only some of them are actually intended to be public. For instance, it's ok for users to do:

from harmonica.visualizations import prism_to_pyvista

But not ok for them to do:

from harmonica.equivalent_sources import EquivalentSources

That's why we import the EquivalentSources class in the __init__.py and encourage users to do:

import harmonica as hm

hm.EquivalentSources(...)

Currently, there's nothing enforcing users to not do the latter, besides documentation. But if anyone uses autocompletion tools (like in JupyterLab), every public module is listed.

🚨 Question: Should we enforce it by making private subpackages actually private? 🚨

This is done by renaming directories and files and putting a heading underscore, e.g. _equivalent_sources.


I think we should make a decision around this before the first major release of Harmonica.

santisoler avatar May 20 '22 18:05 santisoler