Skip to main content

access-config-utils

CI codecov License Code style: black

About

access-config-utils is a Python package for working with the configurations of the climate models developed at ACCESS-NRI. It has two parts, which you can use independently of each other: parsers for configuration files, and a search for parallelisation layouts.

Key Features

Parsers:

  • Various parsers for configuration files used across ACCESS-NRI models:
    • Fortran namelists (FortranNMLParser)
    • MOM6 parameter files, MOM_input (MOM6InputParser)
    • NUOPC run configurations, nuopc.runconfig (NUOPCParser)
    • NUOPC run sequences, nuopc.runseq (NUOPCRunSeqParser)
    • FMS field tables in the legacy format, field_table (FieldTableParser)
    • Rose configurations, rose-suite.conf and rose-app.conf (RoseConfParser)
    • YAML (YAMLParser) and JSON (JSONParser)
  • Support for round-trip parsing, preserving comments and formatting
  • Simple API

Parallelisation layouts:

  • Enumeration of the layouts that a model can run on a number of cores. A layout gives the cores, the MPI ranks, the OpenMP threads and the process grid of each component, and the search is filtered by allocation strategies and constraints (iter_layouts)

Documentation

The documentation is at access-config-utils.readthedocs.io. It has a user guide, which explains how each format is read, edited and written, and how to describe a model and search for its parallelisation layouts. It also has a developer guide and an API reference.

Installation

Using pip

You can install the latest release directly from PyPI:

pip install access-config-utils

From source

If you prefer to install from source:

git clone https://github.com/ACCESS-NRI/access-config-utils.git
cd access-config-utils
pip install .

Usage

Configuration files parsers

Here is a simple example of how to parse a text and modify its contents.

To parse some text, call the parse method of the appropriate parser:

from access.config import FortranNMLParser

text = '''&data_nml
parameterA = 1
parameterB = 'abc'
/'''

config = FortranNMLParser().parse(text)
print(config)

This prints:

&data_nml
parameterA = 1
parameterB = 'abc'
/

You can then modify the parsed content like a Python dict. Everything that you do not touch is reproduced exactly, including the comments, the blank lines and the spacing:

config["data_nml"]["parameterA"] = 2
print(config)

This prints:

&data_nml
parameterA = 2
parameterB = 'abc'
/

You can also add new keys. They are written like the entries around them, with the same spacing, delimiters, quotes and line endings. Each value is written in the notation of the format, so a bool becomes a Fortran logical here:

config["data_nml"]["parameterC"] = True
config["data_nml"]["parameterD"] = [1, 2, 3]
config["new_nml"] = {"parameterE": "def"}
print(config)

This prints:

&data_nml
parameterA = 2
parameterB = 'abc'
parameterC = .true.
parameterD = 1, 2, 3
/
&new_nml
parameterE = "def"
/

A value that the format cannot express raises UnsupportedEntryError. The file would otherwise no longer mean what the dict says. Examples are None in a format with no valueless assignment, and a string containing a space in a format with no quoted strings.

A list value behaves like a list. You can change, add, remove and reorder its elements, by assignment or with append, extend, insert, pop, sort and the rest. The elements that stay keep their text, comments included, and a new element is written like its neighbours, on their line or on a line of its own:

config = FortranNMLParser().parse('''&data_nml
parameterD = 1,
             2  ! two
/''')
config["data_nml"]["parameterD"].append(3)
print(config)

This prints:

&data_nml
parameterD = 1,
             2,
             3  ! two
/

A few caveats on the dict and list behaviour:

  • A list keeps at least two elements, since a single value is a scalar, and a scalar does not become a list or the other way round.
  • A list whose elements are all of one type keeps them so: a new element of another type raises TypeError.
  • A list written with repeat counts (3*1.0), array qualifiers (x(2) = …) or skipped positions, or assigned more than once, can have its elements changed but not its length: delete the key and assign it again instead. The elements a repeat count stands for can only be changed together, all to the same value (6*9.0 to 6*9.5): to change one of them, delete the key and assign it again.
  • Replacing an existing block wholesale raises SyntaxError — a block can be created and edited, but not swapped out.

Every parser works in the same way, and only the structure of the dict depends on the format. An FMS field table, for instance, is read with the structure of the FMS YAML field table. A header is three levels of keys. A method of three strings is a record, which holds its name under "value", and the records that the file writes for a method make a list:

from access.config import FieldTableParser

config = FieldTableParser().parse('''"TRACER", "atmos_mod", "sphum"
    "longname", "specific humidity"
    "profile_type", "fixed", "surface_value=3.e-6" /
''')
print(dict(config["tracer"]["atmos_mod"]["sphum"]))

This prints:

{'longname': 'specific humidity', 'profile_type': [{'value': 'fixed', 'surface_value': 3e-06}]}

A record is read only. To change it, assign a dict to its place in the list. A new field is written as a whole entry, after the last entry of its type and model:

profile = config["tracer"]["atmos_mod"]["sphum"]["profile_type"]
profile[0] = {**profile[0], "surface_value": 1e-5}
config["tracer"]["atmos_mod"]["liq_wat"] = {"longname": "cloud liquid specific humidity"}
print(config)

This prints:

"TRACER", "atmos_mod", "sphum"
    "longname", "specific humidity"
    "profile_type", "fixed", "surface_value=1e-05" /
"TRACER", "atmos_mod", "liq_wat"
    "longname", "cloud liquid specific humidity" /

A JSON file holds plain data, so you edit its dict directly, and the text is written again from it once it changes. The formatting of the file is kept, down to which lists it wrote on one line:

from access.config import JSONParser

config = JSONParser().parse('''{
    "name": "run",
    "levels": [1, 2, 3],
    "files": [
        "a.nc",
        "b.nc"
    ]
}
''')
config["dt"] = 900
config["levels"].append(4)
print(config)

This prints:

{
    "name": "run",
    "levels": [1, 2, 3, 4],
    "files": [
        "a.nc",
        "b.nc"
    ],
    "dt": 900
}

Development installation

If you intend to contribute or modify the package, it is recommended to work inside a virtual environment.

  1. Create and activate a virtual environment
# Create a virtual environment
python3 -m venv .venv

# Activate the virtual environment
source .venv/bin/activate
  1. Install in editable mode with development and test dependencies
pip install -e ".[devel,test]"

This will install the package in editable mode, meaning changes to the source code are reflected immediately without reinstallation. Development dependencies such as testing tools will also be installed.

  1. Run the test suite
pytest

Contributing

Contributions are welcome! Please open an issue or submit a pull request if you’d like to add features, fix bugs, or improve documentation.

For significant contributions, we recommend discussing proposed changes in an issue before opening a pull request.

License

This project is licensed under the Apache 2.0 License.

Metadata

Release files for access-config-utils 0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for access-config-utils 0.6
File Size Uploaded Provenance Actions
access_config_utils-0.6.tar.gz 329.0 kB With provenance Details for access_config_utils-0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for access-config-utils 0.6
File Interpreter ABI Platform Actions
access_config_utils-0.6-py3-none-any.whl Python 3 none any Details for access_config_utils-0.6-py3-none-any.whl

Total release size: 488.0 kB

Release files / access_config_utils-0.6.tar.gz

Download URL access_config_utils-0.6.tar.gz
Size 329.0 kB
Tags Source
SHA-256 checksum
How to use checksums
656d661c562509aeac2e5ef7189cc089c56e7c6d99aeb299c431348ba80c20e9
BLAKE2b-256 checksum
How to use checksums
2a219dda0fdde06125b733024f822d46a506e4ba91bd1ce44f24ec204cd42109
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / access_config_utils-0.6-py3-none-any.whl

Download URL access_config_utils-0.6-py3-none-any.whl
Size 159.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53b87f1184cd250a6734796736da5bb4dc4093f5778942d82916fbc8e0faba8c
BLAKE2b-256 checksum
How to use checksums
739b8f68b7358840375f5864e8cb82538eaff8410da16d114cf02e2184071e87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for access-config-utils 0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for access_config_utils-0.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page