Skip to content

Importing from .kernels and .interpolators namespaces #2309

@reint-fischer

Description

@reint-fischer

As of #2247 kernels shipped with parcels are no longer available to import using from parcels import AdvectionRK4, but instead using from parcels.kernels import AdvectionRK4. As discussed with @erikvansebille and @VeckoTheGecko, we like this as a feature, making it explicit for the users, and can do the same for interpolators. On the other hand it would add a step to the migration from v3 to v4.

@VeckoTheGecko you also wrote some style guidelines in #2247, but I was unclear whether you had finished these bullets or I am not understanding them correctly:

  • When writing package code, we import directly from the file (i.e., prefer from parcels._core.field import Field over from parcels import Field). This is to make clear the import path

  • When writing testing code, prefer to import from the parcels namespace for public API (of course, import from

  • The parcels and parcels/kernels are the only init.py files we need to currate. We don't need to specify more init.py files

If we agree this should be the syntax for users, I can start writing this into the notebooks I will work on, edit this in any tests, and include it in the migration guide.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions