Skip to main content

access-config-utils

CI codecov License Code style: black

About

A Python package providing various utilities to work with configurations for the models developed at ACCESS-NRI.

Key Features

Parsers:

  • Various parsers for configuration files used across ACCESS-NRI models
  • Support for round-trip parsing, preserving comments and formatting
  • Simple API

Documentation

Coming soon.

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, one just needs to call the parse function of the appropriate parser:

from access.config import FortranNMLParser

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

config = FortranNMLParser().parse(text)
print(config)
&data_nml
parameterA = 1
parameterB = 'abc'
/

The parsed content can then be modified like a Python dict. Everything not touched — comments, blank lines, spacing — is reproduced exactly:

config["data_nml"]["parameterA"] = 2
print(config)
&data_nml
parameterA = 2
parameterB = 'abc'
/

New keys can be added too, and are written in the style of their neighbours. Each value is written in whichever notation the format uses, 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)
&data_nml
parameterA = 2
parameterB = 'abc'
parameterC = .true.
parameterD = 1, 2, 3
/
&new_nml
parameterE = "def"
/

A value the format cannot express raises UnsupportedEntryError rather than writing a file that no longer means what the dict says — for instance None in a format with no valueless assignment, or a string containing a space in one with no quoted-string syntax.

Two caveats on the dict and list behaviour. Operations that would add, remove or reorder the elements of a list value (append, extend, insert, pop, sort, …) raise NotImplementedError, because each element is tied to the place it came from in the file; assign a whole new list instead. And replacing an existing block wholesale raises SyntaxError — a block can be created and edited, but not swapped out.

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.3

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.3
File Size Uploaded
access_config_utils-0.3.tar.gz 225.8 kB Details

Built distribution (wheel)

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

Total release size: 353.1 kB

Release files / access_config_utils-0.3.tar.gz

Download URL access_config_utils-0.3.tar.gz
Size 225.8 kB
Tags Source
SHA-256 checksum
How to use checksums
55d17068a10e196ca2f60fba9e1302150328a37bc127f8a7db3b6ff291b48227
BLAKE2b-256 checksum
How to use checksums
1d0d3b8e6bb4a31ddfda0857bfb1e7980e8042f847343ca1e21b18b508554f78
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 Sep 9, 2026.

Transparency log

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

Download URL access_config_utils-0.3-py3-none-any.whl
Size 127.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5fc717c0a867f019d886ca3fc68e958f27b42aca352daa2faab78d9e08289c6
BLAKE2b-256 checksum
How to use checksums
e50389add5aba4a5a3b02fe237a96880874fac00255c3c2a1e08adac92affd02
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 Sep 9, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5

2 release files

0.4

2 release files

This release

0.3 This release

2 release files

0.2

2 release files

0.1

2 release files

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