Skip to main content

No project description provided

Project description

foliconf

Minimal Python configuration library that produces pyi stubs for git repositories.

Installation

git clone and pip install -e ..

Usage

You may first want to seed your project with a config.py module, within anywhere in the repository:

python -m foliconf src/my_package/config.py

In a module you'd like to configure add:

from my_package.config import config_class

@config_class("pizza.toppings")
class ToppingsConfig:
    mushrooms: bool = True
    pepper_slices: int = 7

You can now update the pyi stubs by rerunning python -m foliconf src/my_package/config.py.

To create the configuration object:

from my_package.config import make_config, Config, config_from_dict

# Create the default config:
def make_my_config() -> Config:
    cfg = make_config()
    return cfg

# Create a custom config:
def make_my_config_custom(overrides: dict[str, Any]) -> Config:
    cfg = config_from_dict(overrides)
    return cfg

The cfg object can now be used as e.g. cfg.pizza.toppings.pepper_slices. mypy and other tools will correctly evaluate this expression to be an integer.

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

foliconf-0.2.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

foliconf-0.2-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file foliconf-0.2.tar.gz.

File metadata

  • Download URL: foliconf-0.2.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.7

File hashes

Hashes for foliconf-0.2.tar.gz
Algorithm Hash digest
SHA256 b6e1e24366578800cca3335a13ee7709cb52f88a037a9d12b036bcfc81de20df
MD5 583b17d94860afa4b1c5c0c9e7ab1138
BLAKE2b-256 99603baec4035bc7a8204e4fae3a7df6adab1ebb2b8ab2a060726e9a01dbdadb

See more details on using hashes here.

File details

Details for the file foliconf-0.2-py3-none-any.whl.

File metadata

  • Download URL: foliconf-0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.7

File hashes

Hashes for foliconf-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ce26463c6e50d111706feab475481f8798e24fdff8965ad9fc1ec1692b3cdc86
MD5 d584e49004a724d1aafc94a699d914f1
BLAKE2b-256 6dda600af55420a5c5675c4c75ca779dabcc1ccd9a5e2c9c4e3a6bc417814239

See more details on using hashes here.

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