Clean top level parcels namespace
#1652
Merged
+6
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since Parcels uses wildcard imports in
__init__.pyfiles to bring items up to the top level namespace, the__all__variable becomes important to limit what items are available at this level.Some files which were wildcard imported didn't have this variable, leading to all variables not beginning with
_to bubble up to the parcels namespace.This PR adds these
__all__variables where missing, choosing contents based on expected usecase. This PR also excludes code generation utilities from the top level namespace.Now if we do
dir(parcels)we get:In v4 of parcels, we should consider whether to rework how we handle imports and what's available in this top level namespace (e.g., perhaps limiting whats available in the top level namespace to match how the tutorials use it).
Fixes #1643