Skip to main content

English | 简体中文

tomlconfig

Toml configparser made (stupidly) simple for python.

install

pip install tomlconfig

Usage

Define the toml config file "config.toml" as following:

[general]
language = 'en'

[general.editor]
size = 12
font = 'arial'

TomlConfig parse it very simply:

from tomlconfig import TomlConfig

# read config file
config = TomlConfig("config.toml")

# get item
language = config["general.language"] # "en"
size = config["general.editor.size"]  # 12

# in operation
"general.language" in  config  # True"
config.hasSec("general") # True
config.hasSec("general.language") #False

# set item
config["general.editor.font"] = "Roman" # set font=Roman in toml

# add item
config["server.name"] = 'server1' # add a new item
config["newSection"] = {"k1":1} # add a new config section

# delete item
del config["server.name"]

# list item operation
config.insertToChild("general.editor.font", 0, "Arial") # change font from str to list and insert item
config.appendToChild("general.editor.font", "SimSun") # font=["Arial", "Roman", "SimSun"]
# same as config["general.editor.file"].append("SimSun")

# save
config.save()
# saveas
config.save("newfile.toml")

Metadata

Release files for tomlconfig 1.2.1

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

Built distribution (wheel)

Table of built distributions (wheels) for tomlconfig 1.2.1
File Interpreter ABI Platform Actions
tomlconfig-1.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details for tomlconfig-1.2.1-py2.py3-none-any.whl

Release files / tomlconfig-1.2.1-py2.py3-none-any.whl

Download URL tomlconfig-1.2.1-py2.py3-none-any.whl
Size 18.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d27d5985eeb1133bc83c301507dccdb169ab84d2511ec45976d208549d42e27d
BLAKE2b-256 checksum
How to use checksums
d80ba4449d9d86b2df61b390a3b0cb0a96a1cdc0e8e8a900d572c26dce6b1654
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.0

Security for tomlconfig 1.2.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

1.2.1 This release

1 release file No provenance

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