Skip to main content

SuperConf

SuperConf Logo

Github Repo Github Page Github Releases

PyPI - Python Version PyPI - Format PyPI - Status

Gitter PyPI PyPI - Downloads piwheels (including prereleases) GitHub commit activity License: GPL v3


This project is in Beta.

A powerful and flexible configuration management library for Python. SuperConf provides a clean, type-safe, and intuitive way to handle configuration from multiple sources including environment variables, configuration files, and dictionaries.

Inspired from Cafram, forked from ClassyConf.

Features

  • 🔒 Type-safe configuration with built-in validation
  • 🔄 Multiple configuration sources (environment variables, files, dictionaries)
  • 📦 Nested configuration support
  • 🎯 Default values and custom casting
  • 🚀 Easy to use and extend
  • 🔍 Strict type checking mode
  • 📝 Comprehensive field types (Boolean, Integer, String, List, Dict, etc.)
  • 🎨 Support for custom field types

Quickstart

Installation

Install using pip:

pip install superconf

Or install from source:

git clone https://github.com/mrjk/python-superconf.git
cd python-superconf
pip install -e .

Basic Usage

Here's a simple example of how to use SuperConf:

from superconf.configuration import Configuration
from superconf.fields import FieldString, FieldInt, FieldBool, FieldList

class AppConfig(Configuration):

    class Meta:
        loaders = [Environment()]  # Load from environment variables
    
    debug = FieldBool(default=False, help="Enable debug mode")
    port = FieldInt(default=8080, help="Server port")
    app_name = FieldString(default="myapp", help="Application name")
    plugins = FieldList(default=[], help="Enabled plugins")

# Create and use the configuration
config = AppConfig()
print(config.debug)  # False
print(config.port)   # 8080

# Use environment variables to override defaults
# export APP_PORT=9000
# export APP_DEBUG=true

Overview

Requirements

  • Python 3.9 or higher
  • Dependencies:
    • pyaml >= 24.12.1

FAQ

Q: How is SuperConf different from other configuration libraries?
A: SuperConf combines the best features of existing libraries with strong type safety, nested configurations, and a clean API.

Q: Can I use multiple configuration sources?
A: Yes, SuperConf supports multiple loaders that can be prioritized in order.

Q: Is it possible to extend SuperConf with custom field types?
A: Yes, you can create custom field types by extending the Field class.

Known Issues

  • String parsing for dictionary fields is not implemented yet
  • Cache settings need refinement
  • Some features are marked as WIP (Work in Progress)

Development

Setup Development Environment

  1. Clone the repository:
git clone https://github.com/mrjk/python-superconf.git
cd python-superconf
  1. Install development dependencies:
poetry install

Development Commands

SuperConf uses Taskfile for development tasks:

  • Run tests: task test
  • Run linting: task test_lint
  • Fix linting issues: task fix_lint
  • Generate documentation: task gen_doc_class_graph

Running Tests

task test        # Run all tests
task test_pytest # Run pytest suite
task test_recap  # View test coverage report

Project Information

License

This project is licensed under the GPLv3 License.

Author

Support

For support, please:

  1. Check the documentation
  2. Open an issue on GitHub

Related Projects

Roadmap

  • Implement string parsing for dictionary fields
  • Improve caching mechanism
  • Add more configuration sources
  • Create comprehensive documentation site
  • Add more examples and use cases
  • Implement configuration validation hooks

Metadata

Release files for superconf 0.1.4

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

Source distribution (sdist)

Source distribution for superconf 0.1.4
File Size Uploaded Provenance Actions
superconf-0.1.4.tar.gz 43.9 kB Without provenance Details for superconf-0.1.4.tar.gz

Built distribution (wheel)

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

Total release size: 90.7 kB

Release files / superconf-0.1.4.tar.gz

Download URL superconf-0.1.4.tar.gz
Size 43.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a7d46df66b187182c425223e0872f290117db4dd9f0bd6a481d8629d7ca9cf6c
BLAKE2b-256 checksum
How to use checksums
561775aac0071b36d27ae00ac41bbd8a0cdc0d4aead680a51db40b986738b209
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.10.11 Linux/6.6.65-1-MANJARO

Release files / superconf-0.1.4-py3-none-any.whl

Download URL superconf-0.1.4-py3-none-any.whl
Size 46.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9c9e4bee44be54023caa7b4099f59e1ff0293650b9d09893f62d05646a33837
BLAKE2b-256 checksum
How to use checksums
4ebc44f8dc26a7ff1df264f4d1085ff4ae52cd8ca78051f0aaa00e4abebdacf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.10.11 Linux/6.6.65-1-MANJARO

Security for superconf 0.1.4

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