Skip to main content

Simple TOML Settings

PyPI version Test Suite Codacy Coverage Codacy Badge CodeQL

A Python library to save your settings in a TOML file.

Development Status

Note that there is still additional functionality planned to be added to this package, but the methodology is to keep the package simple to use and understand. Any additional functionality will be added in a way that is backward compatible and optional.

The package is considered stable and is being used in production in several non-trivial applications.

Please report any bugs you find on the issue tracker and feel free to make suggestions for improvements.

Installation

You should install this package into a virtual environment. You can use uv (recommended), or Poetry to do this:

$ uv add simple-toml-settings

or

$ poetry add simple-toml-settings

If you don't want to use Poetry, you can use pip from inside your virtual environment:

$ pip install simple-toml-settings

Usage

This is a library to save your settings in a TOML file. It is designed to be simple to use and to be able to save and load settings from a TOML file with a minimal of configuration.

The below is a minimal example, for full documentation and information on available options, see the documentation site. There are several flags you can set to change the location of the settings file, the name of the file, allowing to run without a settings file, and more.

Usage is simple:

Setup

from simple_toml_settings import TOMLSettings


class MySettings(TOMLSettings):
    """My settings class."""

    # Define the settings you want to save
    name: str = "My Name"
    age: int = 42
    favourite_colour: str = "blue"
    favourite_number: int = 42
    favourite_foods: list = ["pizza", "chocolate", "ice cream"]


settings = MySettings("test_app")

The above will automatically create a TOML file in the user's home directory called config.toml, in the subdirectory .test_app/, and save the settings to it. If the file already exists, the settings will be loaded from it.

The file contents for the above example would be:

[test_app]
age = 42
favourite_colour = "blue"
favourite_number = 42
name = "My Name"
schema_version = "none"
favourite_foods = ["pizza", "chocolate", "ice cream"]

Using the settings

Once you have created your settings class, you can use it like any other class:

settings = MySettings("test_app")
settings.favourite_colour = "red"
settings.save()

Development setup

See the Contributing Guidelines for details of how to contribute to this project and set it up for development.

License

This project is released under the terms of the MIT license.

Credits

The original Python boilerplate for this package was created using Pymaker by Grant Ramsay (seapagan) (Me!! 😄).

Metadata

Release files for simple-toml-settings 0.13.1

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

Source distribution (sdist)

Source distribution for simple-toml-settings 0.13.1
File Size Uploaded
simple_toml_settings-0.13.1.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simple-toml-settings 0.13.1
File Interpreter ABI Platform
simple_toml_settings-0.13.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.9 kB

Release files / simple_toml_settings-0.13.1.tar.gz

Download URL simple_toml_settings-0.13.1.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8f84faec7521b90567f8fa23b46c64f8090cb945037a44f1beafa781db191ed9
BLAKE2b-256 checksum
How to use checksums
101acdb8b5ffa7ab5260c8ba76d48c3b9c0adcfa6ed8e6cce14a0e7f2b9c5ab3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / simple_toml_settings-0.13.1-py3-none-any.whl

Download URL simple_toml_settings-0.13.1-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31efe8c3961b6e2af967cf61c2b3cd20d82e99cd94a8b9bb3157080160e0033e
BLAKE2b-256 checksum
How to use checksums
45ca9eb5e9065c70fdde53e78553be1326273673bd333717bfc9dd346d550b89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.13.1 This release

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

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