Skip to main content

ConfigIt

https://secure.travis-ci.org/pictage/ConfigIt.png?branch=develop

ConfigIt is MIT Licensed Python Configuration library brought to you by the camera shy people at Pictage.

Python is all about the dicts so why do we settle for INIs?

Features

All configuration files are native python files.

Using ConfigIt you can read those files in as a module, or file and return a dictionary with attribute access.

One of the most powerful things about configit is its ability to use other configurations within a configuration.

Installation

To install configit, simply:

$ pip install configit

API Documentation

configit.conf_from_file(filepath)

Reads a string file path and returns a ConfigDict.

filepath = r'tests/configs/default.py'

config = conf_from_file(filepath)
assert config.config_dict.name == 'default'
configit.conf_from_module(module)

Reads an imported module and returns a ConfigDict.

import tests.configs.module_config

config = conf_from_module(tests.configs.module_config)
assert config.config_dict.name == 'module_config'
configit.conf_from_dict(conf_dict)

Reads a dictionary and returns a ConfigDict.

ConfigDicts are accessible by attributes as well as keys.

config = dict(answer=42)

config = configit.conf_from_dict(config)
assert config.answer == 42
configit.use(conf_source)

Within a python configuration you can import another python configuration. The imported configuration will update local name space of the importing configuration. This means values in sub configuration will be accessible in the local configuration.

This can be useful for boiler plate configurations where you only need a few items changed.

file_supplement.py contents:

answer=42

file.py contents:

import configit
configit.use('file_supplement.py')

Code using configit to get the configuration:

import configit
config = conf_from_file('file.py')

assert config.answer == 42

Order matters!

file_supplement.py contents:

answer=42

file.py contents:

import configit
configit.use('file_supplement.py')
answer=5

Code using configit to get the configuration:

import configit
config = conf_from_file('file.py')

assert config.answer == 5

For further examples refer to included tests.

Contribute

  1. Fork the repository on Github to start making your changes to the develop branch (or branch off of it).

  2. Install to your env or venv by running:

    $ python setup.py develop
  3. Hack-a-thon, dance party!

  4. Write a test which shows that the bug was fixed or that the feature works as expected.

  5. Test by running:

    $ python setup.py test
  6. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS.

Metadata

Release files for ConfigIt 1.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 ConfigIt 1.1
File Size Uploaded Provenance Actions
ConfigIt-1.1.tar.gz 5.1 kB Without provenance Details for ConfigIt-1.1.tar.gz

Release files / ConfigIt-1.1.tar.gz

Download URL ConfigIt-1.1.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a4e00afe7fba28364c325cd76bf5f125f7c4de1eb566cb785adaa6b3a3cc28bc
BLAKE2b-256 checksum
How to use checksums
b12ced3cd243b4e940d9b147388d19b80966764ff400470967f5ab469c5dae95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for ConfigIt 1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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