Skip to main content

Logo

octoconf

Python Package Build Status Server Dependency Status Code Quality Server Test Coverage License

Multi-profile supported, flexible config library for Python 2 & 3.

Features

  • Allow multiple config profiles in one YAML file

  • Allow include multiple YAML files

  • Overridable profile selection from code for special use-cases (e.g. config for testing)

  • Inheritable config profiles, what makes profile merges by dictionaries. (the native YAML bookmarking is also available)

  • Can use variables in the config file

Installation

pip install octoconf

Config format

An octoconf config file is pure YAML file with some reserved keywords:

  • USED_CONFIG>: <node_name> in the file root

    you can specify the name of default config profile

  • <INCLUDE: <yml_path(s)> in the file root

    this octoconf file(s) will be included

  • <BASE: <node_name> in the 2nd level

    this will used for making (merge based) inheritance between profiles

The profile nodes should be on 1st level!

Usage

  • You can load config from string with loads():
    import octoconf
    
    config = octoconf.loads(yaml_string)
    print(config)
  • Or directly from StringIO (e.g. from file) with load():
    import octoconf
    
    with open('config.yml') as fd:
        config = octoconf.load(fd)
    print(config)

Please check the features docs for explain octoconf’s features.

Examples YAML files

USED_CONFIG>: UserConfig
<INCLUDE: vendor.defaults.yml


# This config overrides the production preset (from vendor.defaults.yml file)
UserConfig:
  <BASE: ProductionConfig

  App:
    TITLE: "Amazing Foobar"

  Flask:
    SQLALCHEMY_DATABASE_URI: "sqlite:///${SERVER}/app.sqlite"

For more examples, please check the examples directory.

Bugs

Bugs or suggestions? Visit the issue tracker.

Release files for octoconf 0.2.2

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

Source distribution (sdist)

Source distribution for octoconf 0.2.2
File Size Uploaded
octoconf-0.2.2.tar.gz 17.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for octoconf 0.2.2
File Interpreter ABI Platform
octoconf-0.2.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 22.6 kB

Release files / octoconf-0.2.2.tar.gz

Download URL octoconf-0.2.2.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
48163c2c03775c4904650bed40403d187602d90a958193f2c5458781be5dc970
BLAKE2b-256 checksum
How to use checksums
44c3e6cfc400c01129d0950c8bc75371482d5ef94fcf0bd5408e2b4ddba770e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / octoconf-0.2.2-py2.py3-none-any.whl

Download URL octoconf-0.2.2-py2.py3-none-any.whl
Size 4.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
6468868972a1229650781cc91ac48eb7f9df7094e79bc5f7bc968edd3364859c
BLAKE2b-256 checksum
How to use checksums
59be51a2956a229a915d8452209e342389fffe192f6265428bc850af414279e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

3 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