I/O facility for Idefix/Pluto ini files
Project description
inifix
inifix
in a small Python library with I/O methods to read and write Idefix (or Pluto) inifiles as Python dictionaries.
Installation
$ pip install inifix
Usage
The API is similar to that of toml
and stdlib json
, though intentionally
simplified, and consists in two main user-facing functions: inifix.load
and
inifix.dump
.
import inifix
# read
conf = inifix.load("pluto.ini")
# patch
conf["Time"].update({"CFL": 0.1})
# write back
inifix.dump(conf, "pluto-mod.ini")
inifix.load
supports loading a from an open file
with open("pluto.ini") as fh:
conf = inifix.load(fh)
or from a str/os.Pathlike object representing a file.
Schema Validation
inifix.validate_inifile_schema
can be used to validate an aribitrary
dictionnary as writable to an inifile, following Pluto/Idefix's format. This
will raise an exception (ValueError
) if the dictionnary data
is invalid.
inifix.validate_inifile_schema(data)
Contribution guidelines
We use the pre-commit framework to automatically lint for code style and common pitfals.
Before you commit to your local copy of the repo, please run this from the top level
$ python3 -m pip install -u -e .[dev]
$ pre-commit install
Testing
We use the pytest framework to test inifix
.
The test suite can be run from the top level with a simple pytest
invocation.
$ pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file inifix-0.1.4.tar.gz
.
File metadata
- Download URL: inifix-0.1.4.tar.gz
- Upload date:
- Size: 18.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df19b093d9b07979159d0ec5c6f647a0b9b7131b2e9a2255a9ae58cd48a0e4e8 |
|
MD5 | f09fb1aba23f10e1ca6808b27b71c69c |
|
BLAKE2b-256 | e0d6b18e6e0020989a2a51456ef0fc38ca991d0df56646cdd9d09ed3482b0eec |
File details
Details for the file inifix-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: inifix-0.1.4-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1f8fabfc20011fdf341d296389e1867d950783b6fa58280fdd7b8d576624caf |
|
MD5 | b54fe1bad79483a52a08a30f7f9c6015 |
|
BLAKE2b-256 | bb78d677fa2453a345d8e3ae4249faea0f35c8e33b8be0381d070f749a2fcbfd |