polite-config
Easy functions for paths, logging and configuration files.
Part of the DTOcean suite of tools.
Installation
pip install polite-config
Usage
An example of setting up logging using a user-specific yaml configuration file.
Copy the default logging file from the module source code to the user's data
directory (C:\Users\<USERNAME>\AppData\Roaming\DTOcean\polite):
>>> from polite_config.paths import (DirectoryMap, ModPath, UserDataPath)
>>> objdir = ModPath("polite", "config")
>>> datadir = UserDataPath("polite", "DTOcean")
>>> dirmap = DirectoryMap(datadir, objdir)
>>> dirmap.copy_file("logging.yaml", overwrite=True)
>>> datadir.isfile("logging.yaml")
True
Use the copied configuration file to set up logging:
>>> from polite_config.configuration import Logger
>>> log = Logger(datadir)
>>> log_config_dict = log.read()
>>> log.configure_logger(log_config_dict)
>>> logger = log.get_named_logger("polite")
>>> logger.info("Hello World")
INFO - polite - Hello World
Note that classes such as ModPath and UserDataPath are subclasses of
pathlib.Path.
Development
polite-config is developed using the Poetry dependency manager. Poetry must be installed and available on the command line.
To install:
poetry install
Tests
A test suite is provided with the source code that uses pytest.
Install the testing dependencies:
poetry install --with test
Run the tests:
poetry run pytest
Code quality can also be audited using the ruff and pyright tools.
Install the dependencies:
poetry install --with audit
Run the audit:
poetry run ruff
poetry run pyright src
The above tests can be run across all compatible Python versions using tox and tox-uv. To install and run:
poetry install --with tox
poetry run tox
Contributing
Please see the dtocean GitHub repository for contributing guidelines.
Credits
This package was initially created as part of the EU DTOcean project by Mathew Topper at TECNALIA.
It is now maintained by Mathew Topper at Data Only Greater.
License
Metadata
Release files for polite-config 3.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| polite_config-3.0.1.tar.gz | 15.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| polite_config-3.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.3 kB
Release files / polite_config-3.0.1.tar.gz
| Download URL | polite_config-3.0.1.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
98df6b8bdace8fe900660db3e20fed68af0e1b23a8ffd81bb2142e548aedea94
|
|
BLAKE2b-256 checksum How to use checksums |
b1cf7b6bc5289568c393c152565b7a6ea17c55345b58a27cfca3da497ef8c7d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 12, 2026.
Transparency logRelease files / polite_config-3.0.1-py3-none-any.whl
| Download URL | polite_config-3.0.1-py3-none-any.whl |
|---|---|
| Size | 16.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c7cdac3de5e45e389087820aae57da95fc7cf2aefff66a0eaf38951d2f5c60e
|
|
BLAKE2b-256 checksum How to use checksums |
56e95fc365c54115cf030501fb5268061c6ec0fc665bce39ac0938b194b7d612
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 12, 2026.
Transparency log