Skip to main content

PyPI version Build Status

conf

A very simple and lightweight configuration loader and parser for Python.

Supports:

  • yaml files (*.yml, *.yaml)

  • ini files (*.ini)

  • json files (*.json)

Installation

pip install conf

Usage

Starting your app

Start your app with your configuration file:

python your_app.py --config your_config.yml

The --config argument can be a file, a relative path or an absolute path. You are allowed to provide multiple configuration files (separated by a single space), in which case any setting of a former configuration file can be overwritten by a setting of a later configuration file, if the name of that setting is identical.

Fetching your setting (option 1)

Simply get your setting from the conf module:

import conf
your_setting = conf.your_setting

Fetching your setting (option 2)

Import your setting directly:

from conf import your_setting

Fetching your setting (option 3)

You can provide a default value if you are not sure the setting will be present:

import conf
your_setting = conf.get('your_setting', 'your default value')

Note: If you use an ArgumentParser in your own application for other purposes, you must use the parse_known_args() method of the parser.

Meta

This lib was designed and written in 2018 by finetuned89 and ramonhagenaars.

Metadata

Release files for conf 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for conf 0.1.0
File Size Uploaded
conf-0.1.0.tar.gz 3.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for conf 0.1.0
File Interpreter ABI Platform
conf-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.4 kB

Release files / conf-0.1.0.tar.gz

Download URL conf-0.1.0.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1dbf18c71fbe6269444859547f81fd96030f341400ebbf3057b7e347d46aeb7e
BLAKE2b-256 checksum
How to use checksums
bfbb4eab25b55506a559f6c44877f8dd21115084346a0949169666a5befde8a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.1

Release files / conf-0.1.0-py3-none-any.whl

Download URL conf-0.1.0-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6298c271d4a8d36489e1e9e3a7d3d5c2b80bc161cc1c0b9deae174d4d5d213f
BLAKE2b-256 checksum
How to use checksums
0b77eaae8b56776e60b96b7ccf5c523cd6f2304f7985cfcb07b658c12fbead0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.1

Release history Release notifications | RSS feed

0.4.1

1 release file

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

This release

0.1.0 This release

2 release files

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