AtlantisCmd Package Development
Continuous Integration |
|
Documentation |
|
Package |
|
Meta |
|
The AtlantisCmd package (atlantis_cmd) is a command-line tool for doing various operations associated with the Salish Sea Atlantis project version of the CSIRO Atlantis ecosystem model. AtlantisCmd is based on, and provides Atlantis-specific extensions for https://github.com/SalishSeaCast/NEMO-Cmd.
Python Versions
The atlantis_cmd package is developed and tested using Python 3.14. The Continuous Integration workflow on GitHub ensures that the package is tested whenever changes in the repository are pushed or merged.
Getting the Code
Clone the code and documentation repository from GitHub with:
$ git clone git@github.com:SS-Atlantis/AtlantisCmd.git
or copy the URI (the stuff after git clone above) from the Code button on the repository page.
Note
The git clone command above assumes that your are connecting to GitHub using SSH. If it fails, please follow the instructions in our Secure Remote Access docs to set up your SSH keys and Copy Your Public ssh Key to GitHub.
Development Environment
AtlantisCmd uses Pixi for package and environment management.
If you don’t already have Pixi installed,
please follow its installation instructions to do so.
Most commands are executed using pixi run in the AtlantisCmd/ directory
(or a sub-directory).
Dependencies will be downloaded and linked in to environments when you use pixi run
for the first time.
The
defaultenvironment has the packages installed that are required to run theAtlantisCmdcommand-line interface; e.g. pixi run atlantis helpOther environments used by commands in the sections below have addition packages for running the test suite, building and link checking the documentation, etc.
If you are using an integrated development environment like VSCode or PyCharm where you need a Python interpreter to support coding assistance features, run development tasks, etc., use the interpreter in the
devenvironment. You can get its full path with pixi run -e dev which python
To get detailed information about the environments, the packages installed in them, Pixi tasks that are defined for them, etc., :use command:pixi info.
AtlantisCmd is installed in editable install mode in all of the environments that
Pixi creates.
That means that changes you make to the code are immediately reflected in the environments.
Coding Style
The AtlantisCmd package uses the Git pre-commit hooks managed by pre-commit
to maintain consistent code style and and other aspects of code,
docs,
and repo QA.
To install the pre-commit hooks in a newly cloned repo,
run pre-commit install:
$ cd AtlantisCmd
$ pixi run -e dev pre-commit install
Note
You only need to install the hooks once immediately after you make a new clone of the AtlantisCmd repository.
Building the Documentation
The documentation for the AtlantisCmd package is written in reStructuredText and converted to HTML using Sphinx.
Building the documentation is driven by the docs/Makefile.
To do a clean build of the documentation use:
$ cd AtlantisCmd
$ pixi run docs
The output looks something like:
✨ Pixi task (docs in docs): make clean html
Removing everything under '_build'...
Running Sphinx v8.1.3
loading translations [en]... done
making output directory... done
loading intersphinx inventory 'moaddocs' from https://ubc-moad-docs.readthedocs.io/en/latest/objects.inv ...
loading intersphinx inventory 'nemocmd' from https://nemo-cmd.readthedocs.io/en/latest/objects.inv ...
building [mo]: targets for 0 po files that are out of date
writing output...
building [html]: targets for 7 source files that are out of date
updating environment: [new config] 7 added, 0 changed, 0 removed
reading sources... [100%] subcommands
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
copying assets...
copying static files...
Writing evaluated template result to /media/doug/warehouse/Atlantis/AtlantisCmd/docs/_build/html/_static/language_data.js
Writing evaluated template result to /media/doug/warehouse/Atlantis/AtlantisCmd/docs/_build/html/_static/documentation_options.js
Writing evaluated template result to /media/doug/warehouse/Atlantis/AtlantisCmd/docs/_build/html/_static/basic.css
Writing evaluated template result to /media/doug/warehouse/Atlantis/AtlantisCmd/docs/_build/html/_static/js/versions.js
copying static files: done
copying extra files...
copying extra files: done
copying assets: done
writing output... [100%] subcommands
generating indices... genindex done
writing additional pages... search done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.
The HTML pages are in _build/html.
The HTML rendering of the docs ends up in docs/_build/html/.
You can open the index.html file in that directory tree in your browser to preview the results of the build.
If you have write access to the repository on GitHub, whenever you push changes to GitHub the documentation is automatically re-built and rendered at https://atlantiscmd.readthedocs.io/en/latest/.
Link Checking the Documentation
Sphinx also provides a link checker utility which can be run to find broken or redirected links in the docs. Run the link checker with:
$ cd AtlantisCmd
$ pixi run linkcheck
The output looks something like:
✨ Pixi task (linkcheck in docs): make clean linkcheck
Removing everything under '_build'...
Running Sphinx v8.1.3
loading translations [en]... done
making output directory... done
loading intersphinx inventory 'moaddocs' from https://ubc-moad-docs.readthedocs.io/en/latest/objects.inv ...
loading intersphinx inventory 'nemocmd' from https://nemo-cmd.readthedocs.io/en/latest/objects.inv ...
building [mo]: targets for 0 po files that are out of date
writing output...
building [linkcheck]: targets for 7 source files that are out of date
updating environment: [new config] 7 added, 0 changed, 0 removed
reading sources... [100%] subcommands
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
copying assets...
copying assets: done
writing output... [100%] subcommands
( pkg_development: line 23) ok https://black.readthedocs.io/en/stable/
( pkg_development: line 23) ok https://atlantiscmd.readthedocs.io/en/latest/
( pkg_development: line 23) ok https://app.codecov.io/gh/SS-Atlantis/AtlantisCmd
( pkg_development: line 36) ok https://app.readthedocs.org/projects/atlantiscmd/badge/?version=latest
( subcommands: line 119) ok https://cookiecutter.readthedocs.io/en/latest/
( pkg_development: line 29) ok https://codecov.io/gh/SS-Atlantis/AtlantisCmd/branch/main/graph/badge.svg
(installation/atlantis_cmd: line 70) ok https://docs.conda.io/en/latest/miniconda.html
(installation/atlantis_cmd: line 70) ok https://docs.conda.io/en/latest/
( pkg_development: line 404) ok https://coverage.readthedocs.io/en/latest/
( pkg_development: line 374) ok https://docs.pytest.org/en/latest/
( index: line 30) ok https://docs.openstack.org/cliff/latest/
( pkg_development: line 77) ok https://docs.python.org/3
( pkg_development: line 23) ok https://docs.python.org/3/
( pkg_development: line 463) ok https://git-scm.com/
(installation/atlantis_cmd: line 60) ok https://docs.github.com/en/authentication/connecting-to-github-with-ssh
( pkg_development: line 32) ok https://github.com/SS-Atlantis/AtlantisCmd/actions/workflows/codeql-analysis.yaml/badge.svg
(run_description_file/index: line 30) redirect https://bitbucket.csiro.au/users/por07g/repos/salish-sea-atlantis-model/browse - with Found to https://bitbucket.csiro.au/login
( index: line 23) ok https://github.com/SS-Atlantis/AtlantisCmd
( pkg_development: line 26) ok https://github.com/SS-Atlantis/AtlantisCmd/actions/workflows/pytest-with-coverage.yaml/badge.svg
( pkg_development: line 438) ok https://github.com/SS-Atlantis/AtlantisCmd/actions
( pkg_development: line 39) ok https://github.com/SS-Atlantis/AtlantisCmd/actions/workflows/sphinx-linkcheck.yaml/badge.svg
( pkg_development: line 429) ok https://github.com/SS-Atlantis/AtlantisCmd/actions?query=workflow%3Apytest-with-coverage
( pkg_development: line 23) ok https://github.com/SS-Atlantis/AtlantisCmd/actions?query=workflow:CodeQL
( pkg_development: line 449) ok https://docs.github.com/en/actions
( pkg_development: line 267) ok https://github.com/SS-Atlantis/AtlantisCmd/actions?query=workflow%3Asphinx-linkcheck
( pkg_development: line 23) ok https://github.com/SS-Atlantis/AtlantisCmd/actions?query=workflow:pytest-with-coverage
( pkg_development: line 431) ok https://github.com/SS-Atlantis/AtlantisCmd/workflows/pytest-with-coverage/badge.svg
( pkg_development: line 269) ok https://github.com/SS-Atlantis/AtlantisCmd/workflows/sphinx-linkcheck/badge.svg
( pkg_development: line 438) ok https://github.com/SS-Atlantis/AtlantisCmd/commits/main
( pkg_development: line 23) ok https://github.com/SS-Atlantis/AtlantisCmd/releases
( pkg_development: line 23) ok https://github.com/SS-Atlantis/AtlantisCmd/issues
( pkg_development: line 63) ok https://img.shields.io/badge/code%20style-black-000000.svg
( pkg_development: line 66) ok https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg
( index: line 58) ok https://img.shields.io/badge/license-Apache%202-cb2533.svg
( pkg_development: line 60) ok https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
( pkg_development: line 56) ok https://img.shields.io/badge/version%20control-git-blue.svg?logo=github
( pkg_development: line 43) ok https://img.shields.io/github/v/release/SS-Atlantis/AtlantisCmd?logo=github
( index: line 30) ok https://github.com/SalishSeaCast/NEMO-Cmd
( pkg_development: line 49) ok https://img.shields.io/github/issues/SS-Atlantis/AtlantisCmd?logo=github
( pkg_development: line 23) ok https://github.com/pypa/hatch
( pkg_development: line 23) ok https://github.com/SS-Atlantis/AtlantisCmd/actions?query=workflow:sphinx-linkcheck
(installation/atlantis_cmd: line 46) ok https://nemo-cmd.readthedocs.io/en/latest/
( subcommands: line 181) ok https://nemo-cmd.readthedocs.io/en/latest/subcommands.html#nemo-gather
( pkg_development: line 46) ok https://img.shields.io/python/required-version-toml?tomlFilePath=https://raw.githubusercontent.com/SS-Atlantis/AtlantisCmd/main/pyproject.toml&logo=Python&logoColor=gold&label=Python
( pkg_development: line 404) ok https://pytest-cov.readthedocs.io/en/latest/
( pkg_development: line 23) ok https://pre-commit.com
(run_description_file/index: line 25) ok https://pyyaml.org/wiki/PyYAMLDocumentation
( pkg_development: line 172) ok https://pre-commit.com/
(installation/atlantis_cmd: line 60) ok https://ubc-moad-docs.readthedocs.io/en/latest/ssh_access.html#copyyourpublicsshkeytogithub
(installation/atlantis_cmd: line 60) ok https://ubc-moad-docs.readthedocs.io/en/latest/ssh_access.html#secureremoteaccess
( pkg_development: line 83) ok https://www.python.org/
( pkg_development: line 205) ok https://www.sphinx-doc.org/en/master/
( pkg_development: line 205) ok https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
( index: line 56) ok https://www.apache.org/licenses/LICENSE-2.0
build succeeded.
Look for any errors in the above output or in _build/linkcheck/output.txt
make linkcheck is run monthly via a scheduled GitHub Actions workflow
Running the Unit Tests
The test suite for the AtlantisCmd package is in AtlantisCmd/tests/.
The pytest tool is used for test parametrization and as the test runner for the suite.
Use:
$ cd AtlantisCmd/
$ pixi run pytest
to run the test suite. The output looks something like:
================================ test session starts =================================
platform linux -- Python 3.14.3, pytest-9.0.2, pluggy-1.6.0
Using --randomly-seed=2919284692
rootdir: /media/doug/warehouse/Atlantis/AtlantisCmd
configfile: pyproject.toml
plugins: randomly-3.15.0, cov-7.1.0
collected 49 items
tests/test_run.py ......................................... [ 83%]
tests/test_post_gen_project.py ........ [100%]
================================= 49 passed in 0.84s =================================
You can monitor what lines of code the test suite exercises using the coverage.py and pytest-cov tools with the command:
$ cd AtlantisCmd/
$ pixi run pytest-cov
The test coverage report will be displayed below the test suite run output.
Alternatively, you can use
$ pixi run pytest-cov-html
to produce an HTML report that you can view in your browser by opening AtlantisCmd/htmlcov/index.html.
Continuous Integration
The AtlantisCmd package unit test suite is run and a coverage report is generated whenever changes are pushed to GitHub.
The results are visible on the repo actions page,
from the green checkmarks beside commits on the repo commits page,
or from the green checkmark to the left of the “Latest commit” message on the repo code overview page .
The testing coverage report is uploaded to codecov.io
The GitHub Actions workflow configuration that defines the continuous integration tasks is in the .github/workflows/pytest-coverage.yaml file.
Version Control Repository
The AtlantisCmd package code and documentation source files are available as a Git repository at https://github.com/SS-Atlantis/AtlantisCmd.
Issue Tracker
Development tasks, bug reports, and enhancement ideas are recorded and managed in the issue tracker at https://github.com/SS-Atlantis/AtlantisCmd/issues.
License
The code and documentation of the Atlantis Command Processor project are copyright 2021 – present by the Salish Sea Atlantis project contributors, The University of British Columbia, and CSIRO.
They are licensed under the Apache License, Version 2.0. https://www.apache.org/licenses/LICENSE-2.0 Please see the LICENSE file for details of the license.
Release Process
Releases are done at Doug’s discretion when significant pieces of development work have been completed.
The release process steps are:
Use pixi run -e dev hatch version release to bump the version from
.devnto the next release version identifierUse pixi update ensure that the new version is reflected in the Pixi lock file
Commit the version bump
Create and annotated tag for the release with Git -> New Tag… in PyCharm or git tag -e -a vyy.n
Push the version bump commit and tag to GitHub
Use the GitHub web interface to create a release, editing the auto-generated release notes into sections:
Features
Bug Fixes
Documentation
Maintenance
Dependency Updates
Use the GitHub Issues -> Milestones web interface to edit the release milestone:
Change the Due date to the release date
Delete the “when it’s ready” comment in the Description
Use the GitHub Issues -> Milestones web interface to create a milestone for the next release:
Set the Title to the next release version, prepended with a
v; e.g.v25.1Set the Due date to the end of the year of the next release
Set the Description to something like
v25.1 release - when it's ready :-)Create the next release milestone
Review the open issues, especially any that are associated with the milestone for the just released version, and update their milestone.
Close the milestone for the just released version.
Use pixi run -e dev hatch version minor,dev to bump the version for the next development cycle, or use pixi run -e dev hatch version major,minor,dev for a year rollover version bump
Use pixi update ensure that the new version is reflected in the Pixi lock file
Commit the version bump
Push the version bump commit to GitHub