unifhy-org / unifhy

A Unified Framework for Hydrology
https://unifhy-org.github.io/unifhy
BSD 3-Clause "New" or "Revised" License
11 stars 5 forks source link

Separate science components from framework #45

Closed ThibHlln closed 2 years ago

ThibHlln commented 2 years ago

I suggest to split the framework functionalities and the science it holds by removing the science components from this repository, and by creating distinct repositories for each (set of) science component(s).

The main motivations are:

Note, the framework would keep its "dummy" components for testing purposes.

This may complicate slighly the installation instructions and the import statements, but I think it is really a minor inconvenience in comparison with the benefits listed above. However, see below comparisons between having everything in one repository and having separate repositories.

installation

one repository (current)

pip install cm4twc

separate repositories (proposed)

pip install cm4twc cm4twccontrib-artemis cm4twccontrib-rfm

usage

one repository (current)

import cm4twc

sl = cm4twc.components.surfacelayer.Artemis(...)
ss = cm4twc.components.subsurface.Artemis(...)
ow = cm4twc.components.openwater.RFM(...)

md = cm4twc.Model(sl, ss, ow, ...)

separate repositories (proposed)

import cm4twc
import cm4twccontrib.artemis
import cm4twccontrib.rfm

sl = cm4twccontrib.artemis.SurfaceLayerComponent(...)
ss = cm4twccontrib.artemis.SubSurfaceComponent(...)
ow = cm4twccontrib.rfm.OpenWaterComponent(...)

md = cm4twc.Model(sl, ss, ow, ...)

The science components would require to follow some packaging and naming conventions (as shown in the example above), namely:

Note, while PEP 423 has a "deferred" status, it is based on what sphinx is already doing for community contributions, and appears to be good practice.

In our case, Artemis and RFM projects (e.g. on PyPI) would be named cm4twccontrib-artemis and cm4twccontrib-rfm, respectively. And they would be imported as cm4twccontrib.artemis and cm4twccontrib.rfm, respectively. Repositories for these models have already been created https://github.com/cm4twc-org/cm4twccontrib-artemis, https://github.com/cm4twc-org/cm4twccontrib-rfm.

ThibHlln commented 2 years ago

I've also created a repo containing a template to package components into a Python package compliant with the framework https://github.com/cm4twc-org/cm4twccontrib-template.

Note, I've not committed anything to main yet, so have a look at the dev branch. I intend for this repo to get a new commit to main/a new release for every version of cm4twc released, to reflect any API changes, if any. The first released template will be for cm4twc==0.1.0.