Skip to main content

Minimalistic configuration finder with standard Python libraries.

Project description

Config Finder

Finds a configuration file (e.g. pyproject.toml) and returns some sub-configuration with only python standard libraries.

!!! note Supported formats:

* [TOML](https://en.wikipedia.org/wiki/TOML)
* [JSON](https://en.wikipedia.org/wiki/JSON)

Algorighm

  1. starts from the currently executed file (__main__.__file__)
  2. Checks if that folder contains the desired configuration file
  3. Goes to the parent directory and repeats at 2

Use Case

When defining machine learning projects and handling the project configuration by e.g. a pyproject.toml (e.g. with Astral UV or Poetry) you can utilize the configuration files to define and store important variables.

[tool.some_tool]
key1 = "some_value_1"
key2 = "some_value_2"

[tool.some_tool.default_config]
important_key = "some_value"

[tool.some_tool.special_config]
important_key = "another_value"

!!! tip Instead of defining global variables in your code or using dotenv, a configuration file such as the pyproject.toml can be used to store configurations.

Access works via

```python 
find_configuration("pyproject.toml", ["tool", "some_tool", "default_config"])
```
```
{"important_key" : "some_value"}    
```

This function can also be used to handle credentials.

!!! caution Do not write your credentials into the pyproject.toml and ensure that you do not check your credentials into the source control.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simpleconfigfinder-0.2.1.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simpleconfigfinder-0.2.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file simpleconfigfinder-0.2.1.tar.gz.

File metadata

  • Download URL: simpleconfigfinder-0.2.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for simpleconfigfinder-0.2.1.tar.gz
Algorithm Hash digest
SHA256 63e7c62119718c4999f5f3221168f6ef391172b3655039c85bf46d3b05a36a42
MD5 30b7903b4853c3a291ef651a16b71151
BLAKE2b-256 5fa260b7ccf8f6661fcaf38d808cf1154ae10bbbc9c313f0f97076abe4c8390b

See more details on using hashes here.

Provenance

The following attestation bundles were made for simpleconfigfinder-0.2.1.tar.gz:

Publisher: python-publish.yml on fabfabi/simpleconfigfinder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file simpleconfigfinder-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for simpleconfigfinder-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4287e57265beb6081bad28e4b8750fb5205b85ff63e2f7c1de9e1cfd9122ec5e
MD5 25290c3cfa49b33bc024a70d10f30d57
BLAKE2b-256 7e19276298161d453e5c14d5c11078e4e8dd26f4f7325b6b5a2f0d1fda50e26a

See more details on using hashes here.

Provenance

The following attestation bundles were made for simpleconfigfinder-0.2.1-py3-none-any.whl:

Publisher: python-publish.yml on fabfabi/simpleconfigfinder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page