ESMCI / ESMCI/cime

[Proposal] CLI & packaging update

Open
#4,845 29 comments 1 reaction 0 assignees View on GitHub
Low Priority
Dominant language
Python
Stars
174
Forks
225
Avg merge
1d 16h
Merged PRs (30d)
14

Description

I'm circling back to this, which was originally part of the larger refactor effort.

The proposal is to add a new CLI to CIME and start packaging it via PyPI and conda, providing a modern way to interact with and manage CIME.

## Formalizing an API
CIME does not currently have an official API. While it’s possible to write Python code using the package, this is not straightforward.

Formalizing an API would encourage this use case and enable the creation of packages that utilize CIME. Packaging via PyPI and conda would further support this.

One idea is a tool that could manage cases for a user. While CIME already supports ensembles, this could be extracted into its own tool. Doing so would help keep CIME leaner and reduce feature creep. A possible vision for this tool would be a single YAML file describing the configuration for all ensemble members, paired with a single command to create, build, submit, and monitor the runs.

## Packaging
Utilizing CIME as a sub-module will still be supported (unless determined otherwise).

CIME will adopt continuous delivery and utilize SemVer to track API and backward compatibility changes. This will allow models to use the version constraining features of `pip` and `conda`, providing a more reliable way to track compatible CIME versions.

The packages will also provide users with new ways of working with CIME, whether by calling Python code directly or using it as a dependency.

## CLI
The CLI will condense all of CIME's tools into a single entrypoint. This will also remove the need for symlinked tools in a case directory, making cases more portable.

A potential new feature could be the ability to export/import a case. Exporting would capture a case while excluding build/run directories and machine-specific configuration. Importing would recreate the case and apply the appropriate machine-specific details.

The CLI could look like:
```sh
cime config show
cime config set

cime create_newcase
cime create_clone
cime create_test

cime case.setup
cime case.build
cime case.submit
cime xmlquery
cime xmlchange
```

Or in a cleaner form:

```sh
cime config show
cime config set

cime create
cime clone
cime test

cime setup
cime build
cime submit
cime preview
cime query
cime change
```

To support this, CIME will need to change how it finds a model's configuration, another step in decoupling the model from CIME. The `config_files.xml` file will need to be completely migrated from CIME to the model repositories. Then, CIME will implement a new method to determine a model's configuration by locating the correct `cime_config` in a model’s repository.

CIME will be able to find the source for a case using `SRCROOT`. A new `CIME_VERSION` variable will also be added to store the version used to create the case. These variables may then be used to set up the model source and CIME version from an imported case.

Feedback and suggestions are very welcome.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.