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.2.tar.gz (2.7 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.2-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: simpleconfigfinder-0.2.2.tar.gz
  • Upload date:
  • Size: 2.7 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.2.tar.gz
Algorithm Hash digest
SHA256 1c9622681bd082536e3fe802862269a98485d4e47477cce7ebbc4a0c5e0731a3
MD5 83fc699812de14c9627bc02d81749bc9
BLAKE2b-256 d96beb35033f22adff453cb3544053172bf16ecc082cd3d5389f4938d7ace6dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for simpleconfigfinder-0.2.2.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.2-py3-none-any.whl.

File metadata

File hashes

Hashes for simpleconfigfinder-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 55b8cb07679733d4e5eb179fec2d2ea09aa9679ee82165b32d79ad432b368824
MD5 20cf1223b7b5894e88822be77c1f2c1e
BLAKE2b-256 0a4b3d52d29411b19ac543b0a318fcc7693abdc1ec19ddc074a76bb86c3ffc25

See more details on using hashes here.

Provenance

The following attestation bundles were made for simpleconfigfinder-0.2.2-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