-
Notifications
You must be signed in to change notification settings - Fork 168
Package restructure #2247
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
Merged
VeckoTheGecko
merged 45 commits into
Parcels-code:v4-dev
from
VeckoTheGecko:package-restructure
Sep 29, 2025
Merged
Package restructure #2247
VeckoTheGecko
merged 45 commits into
Parcels-code:v4-dev
from
VeckoTheGecko:package-restructure
Sep 29, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1787edb to
193d387
Compare
Before it wasn't possible to do: from parcels.kernels import AdvectionRK4 but you could do import parcels.kernels parcels.kernels.AdvectionRK4 I think its because the former expects the subpackage to exist at that file location or something along those lines - not 100% sure. Taking kernels out of core (this is quite standalone anyway, which is similar to the other items outside of core)
Using `git checkout 7e7ff6a -- tests-v3/ parcels/interaction/`
193d387 to
825356a
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR restructures the Parcels package
Main changes:
parcels.kernelsfor all kernels that are shipped with parcelsparcels.interpolatorsfor all interpolators that are shipped with parcelsisinstance_noimportto avoid circular imports)parcels._python.isinstance_noimportto avoid a circular import - not sure what "best practice" is here, but I've seen code in production (in zarr iirc) so I don't think its too obscuresee commit log for full list of changes. @erikvansebille I think this is easiest to just review the end result, or one commit at a time (I don't think the diff is useful to look at). Let's review together f2f.
Fixes #1965
Note this doesn't fix. gh-2216 as it wasn't as straight forward as expected
Future work:
Structure with comments
After
Before
Style guidelines
from parcels._core.field import Fieldoverfrom parcels import Field). This is to make clear the import pathparcelsnamespace for public API (of course, import fromparcelsandparcels/kernelsare the only__init__.pyfiles we need to currate. We don't need to specify more__init__.pyfilesI think that these guidelines provide a consistent way of working with things that communicates package structure to developers (while also helping refactoring tools), while also communicating (i.e., via the tests) how we expect user to use the code and namespaces. Also somewhat mimicking what I've seen in the xarray codebase.
Should we document these guidelines somewhere?