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

Mark private functionalities with an underscore to separate better from public API #6636

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

Conversation

agoscinski
Copy link
Contributor

@agoscinski agoscinski commented Nov 25, 2024

The AiiDA public API has been defined in the documentation as every import that can be done from a secondary level. This is however not transparent to users and plugin developers as it is hidden in the doc resulting in a lot of misuse of private functionalities. The widespread use of these private functionalities blocks improvements in the code as we are more hesitant in changing functionalities for wrong backwards compatibility.

This PR marks clearly the internal functionalities with an underscore so a misuse only can happen intentionally. It only marks the third level of import with an underscore since any subsequent imports are automatically marked as internal. This gives us the opportunity to improve the public API as we can implement replacements for functionalities in the private API that are widely used.

This means the public API example changes to

from aiida import load_profile  # OK, top-level import
from aiida.orm import QueryBuilder  # OK, second-level import
from aiida.tools._importexport import Archive # NOT PUBLIC API

EDIT: Need to adapt imports in tests, and docs

The AiiDA public API has been defined in the documentation as every import that
can be done from a secondary level. This is however not transparent to users
and plugin developers as it is hidden in the doc resulting in a lot of misuse
of private functionalities. The widespread use of these private functionalities
blocks improvements in the code as we are more hesitant in changing
functionalities for wrong backwards compatibility.

This PR marks clearly the internal functioanlities with an underscore so a
misuse only can happen intentionally. This gives us the opportunity to improve
the public API as we can implement replacements for functionalities in the
private API that are widely used.
@agoscinski agoscinski changed the title Mark private API with an underscore Mark private functionalities with an underscore to separate better from public API Nov 25, 2024
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