Skip to main content

Consistent, robust TOML config management with a friendly CLI

Project description

configistate

A useful config file utility.

A configuration utility that provides a consistent, robust framework for incorporating configuration files in software projects.

Features

  • Python Library: Import configistate into your projects for programmatic config management
  • CLI Tool: Use confy command-line tool for working with config files
  • TOML Support: Full support for TOML configuration files
  • File Variables: Support for file:// path variables to read file contents
  • Aliases: Define config file aliases in ~/.confy.rc for easy access

Installation

# Install from source
make build
make install

# Or install in development mode
make build

Python Library Usage

from configistate import Config

# Load a config file
config = Config('config.toml')

# Get values
database_host = config.get('database.host')
debug_mode = config.get('debug', False)

# Set values
config.set('database.port', 5432)
config.save()

# List sections and variables
sections = config.list_sections()
variables = config.list_variables('database')

File Variables

Config files can reference external files using file:// URLs:

[secrets]
api_key = "file:///path/to/secret.txt"

The library will automatically read the file content and substitute it as the variable value.

CLI Tool Usage

The confy command provides a command-line interface:

# List all sections
confy config.toml --list

# List variables in a section
confy config.toml --list database

# Get a configuration value
confy config.toml --get database.host

# Set a configuration value
confy config.toml --set database.port 5432

Aliases

Define aliases in ~/.confy.rc:

[aliases]
myapp = "/path/to/myapp/config.toml"

Then use the alias:

confy myapp --get database.host

Development

# Setup development environment
make build

# Run tests
make test

# Run linting
make fmt

# Build documentation
make doc

# Create distribution package
make dist

Requirements

  • Python 3.8+
  • TOML support

License

MIT License - see LICENSE file for details.

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

configistate-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

configistate-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file configistate-0.1.0.tar.gz.

File metadata

  • Download URL: configistate-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for configistate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4faaa6a5e43420743e2f5176f84bbffb57a6ef965545fe1a9cebe8bd87e58555
MD5 cd8c77497a50e1cdef79edf07802b965
BLAKE2b-256 8846daa195035cce889ab32dc36ddcc8e12cad0de7aedc938f91450f4f876241

See more details on using hashes here.

File details

Details for the file configistate-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: configistate-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for configistate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b84b9dc8590a4d7623451b737fc86102f7e4fdf27631842fea8192bfa053e0d1
MD5 11140248540b8c0487953f1ee5fac15b
BLAKE2b-256 9b5e47f348ba05cb6523c87221df8d75ceab1d72e771a84ed4a16ad8e1e9a3eb

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