Feature flags for Indie Flags — is_enabled, get_value, optional 60s cache
Project description
Indie Flags — Python SDK
Feature flags for Indie Flags. is_enabled, get_value, optional 60s cache. Python 3.9+, stdlib only (no extra dependencies).
Install
pip install indie-flags
Get your API key
In the Indie Flags dashboard, open your project → API Keys. Copy the client key (if_pub_...).
Usage
Init (recommended)
from indie_flags import IndieFlags
flags = IndieFlags(
api_key="if_pub_xxxxxxxx",
# base_url="https://your-api.com", # optional, self-hosted
# email="user@example.com", # optional, for overrides
)
flags.init()
if flags.is_enabled("new-checkout"):
# show new checkout
else:
# show old checkout
theme = flags.get_value("theme") # "dark" | "light" | "system"
Without init
flags = IndieFlags(api_key="if_pub_xxxxxxxx")
on = flags.is_enabled("new-feature")
value = flags.get_value("ab-test-variant")
Options
| Option | Type | Description |
|---|---|---|
api_key |
str | Required. Project API key from dashboard. |
base_url |
str | API base URL. Default https://api.indieflags.dev. |
env |
str | Environment (e.g. "production", "staging"). |
email |
str | User email for flag overrides. |
cache_ttl_sec |
int | Cache TTL after init(). Default 60. Set 0 to disable. |
Methods
init()— Fetch all flags and cache. Call once at startup.is_enabled(flag_key: str) -> bool— Whether the flag is on.get_value(flag_key: str) -> bool | str— Flag value (bool or str for enums).invalidate_cache()— Clear cache.
API
Uses GET /eval and GET /eval/flags. See the REST API docs for direct HTTP usage.
Tests
pip install -e ".[dev]"
pytest tests/ -v
Publishing to PyPI (maintainers)
-
Create an API token on PyPI
pypi.org → Account settings → API tokens → Add API token (scope: “Entire account” or limit to projectindie-flags). -
Bump version in
pyproject.toml(e.g.0.1.0→0.1.1). -
Build and upload (from
sdk-python/):python3 -m venv .venv && source .venv/bin/activate # once pip install build twine python -m build twine upload dist/*
On macOS/Homebrew, use a venv (as above);
pipmay not be available system-wide. -
When Twine asks for credentials:
- Username:
__token__ - Password: your PyPI API token (starts with
pypi-).
Or set once and reuse:
export TWINE_USERNAME=__token__andexport TWINE_PASSWORD=pypi-... - Username:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file indie_flags-0.1.0.tar.gz.
File metadata
- Download URL: indie_flags-0.1.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81f194c5260b774f2d10a13db6ff674dc986c9eb49d4b357a0269232ddc94a0c
|
|
| MD5 |
a9c7b9f0431381e32cc47b2224d88ae3
|
|
| BLAKE2b-256 |
72aa5a3079fb582a15b501a24f57635b6542eac2d039cd924a1242dffc8a6a06
|
File details
Details for the file indie_flags-0.1.0-py3-none-any.whl.
File metadata
- Download URL: indie_flags-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5b02b3b747e71dd698fd5b5b711a9b3079c59a2185833512fa9630901938c66
|
|
| MD5 |
9c1d5dea82dcf2f17713fbb38b91364e
|
|
| BLAKE2b-256 |
5da478fe34d4b8afa43b766a35b5e2eeca53c78a762b823b5b0d0079c182ea39
|