ConfigPig — Python SDK
Python SDK for ConfigPig, a managed config file registry for teams.
Installation
pip install configpig
Or with uv:
uv add configpig
Configuration
Set environment variables or pass directly to the client:
export CONFIGPIG_API_KEY="sk-api01-your-key-here"
export CONFIGPIG_URL="https://configpig.com" # optional, this is the default
Quick Start — get_config()
The simplest way to use ConfigPig. One function, no boilerplate:
from configpig import get_config
# Fetch a config
content = get_config("my-config")
# With a specific label
content = get_config("my-config", label="production")
# With format conversion
content = get_config("my-config", output_format="yaml")
# With a fallback if the service is unreachable
content = get_config("my-config", fallback='{"default": true}')
# With TTL caching (seconds)
content = get_config("my-config", ttl=300)
Set global defaults so you don't repeat yourself:
import configpig
configpig.configure(
api_key="sk-api01-...",
base_url="https://configpig.com",
default_label="latest",
default_ttl=300,
)
Using the Full Client
For advanced use cases (creating configs, managing versions, labels, etc.):
from configpig import Client
client = Client()
# List all configs
result = client.list_configs()
if result.ok:
for cfg in result.data:
print(f"{cfg.slug}: {cfg.name}")
# Get a specific config
result = client.get_config("my-config")
if result.ok:
print(result.data.name)
# Fetch config content with optional format conversion
result = client.fetch("my-config", label="latest", output_format="yaml")
if result.ok:
print(result.data.content)
# Create a new config
result = client.create_config(
name="App Settings",
slug="app-settings",
content='{"debug": false, "log_level": "info"}',
format="json",
tags=["app"],
)
# Create a new version
result = client.create_version(
"app-settings",
content='{"debug": false, "log_level": "warn"}',
change_note="Changed log level to warn",
)
# Promote a version to a label
result = client.promote("app-settings", version=2, label="production")
API Reference
All methods return APIResponse[T] with fields:
ok: bool— whether the request succeededstatus_code: int— HTTP status codedata: T | None— response data (whenokis True)error: str | None— error message (whenokis False)
Configs
| Method | Description |
|---|---|
list_configs(tag?, search?) |
List all configs |
get_config(slug) |
Get config details |
create_config(...) |
Create a new config |
update_config(slug, ...) |
Update config metadata |
delete_config(slug) |
Delete a config |
Versions
| Method | Description |
|---|---|
list_versions(slug) |
List all versions |
get_version(slug, version_number) |
Get specific version |
create_version(slug, ...) |
Create a new version |
Fetch
| Method | Description |
|---|---|
fetch(slug, label?, output_format?) |
Fetch config content with optional format conversion |
Labels
| Method | Description |
|---|---|
list_labels() |
List team labels |
create_label(name, ...) |
Create a team label |
delete_label(name) |
Delete a team label |
list_config_labels(slug) |
List labels for a config |
assign_label(slug, label, version) |
Assign label to version |
Promote / Rollback
| Method | Description |
|---|---|
promote(slug, version, label) |
Assign label to a version |
rollback(slug, label) |
Rollback label to previous version |
Exports
| Method | Description |
|---|---|
list_exports() |
List exports |
create_export(name, ...) |
Create an export |
get_export(export_id) |
Get export details |
delete_export(export_id) |
Delete an export |
System
| Method | Description |
|---|---|
health_check() |
Check API health |
License
MIT — Bright Wing Solutions LLC
Metadata
Release files for configpig 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| configpig-0.1.0.tar.gz | 27.0 kB | Without provenance | Details for configpig-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| configpig-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for configpig-0.1.0-py3-none-any.whl |
Total release size: 36.6 kB
Release files / configpig-0.1.0.tar.gz
| Download URL | configpig-0.1.0.tar.gz |
|---|---|
| Size | 27.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db4d51ddc5ae1c62006b60bdc7d9087b57db2e68f969dcf0e0595c7a6298990d
|
|
BLAKE2b-256 checksum How to use checksums |
4cbd0e4a627b07514457881418c447579842ffe93bbd080988c45747c1ede434
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / configpig-0.1.0-py3-none-any.whl
| Download URL | configpig-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9646c88612f4749f1cf395218ef9886ece0a40ced47742d5684dace96e46ae57
|
|
BLAKE2b-256 checksum How to use checksums |
a08e60151871eba7773072bfbd43068c85dc84ceed81b945f2dfbadd89a631fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for configpig 0.1.0
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.