Repository navigation
v0.0.9
What's changed
New: PostgreSQL adapter
PostgresAdapterstores feature flags in your own PostgreSQL database. Install it withpip install "feature_gate[postgres]"(psycopg 3). psycopg is only imported when you use this adapter, soMemoryAdapterandPosthogAdapterwork without it.- Configure it with
PostgresAdapter(database_url=...), orFEATURE_GATE_DATABASE_URL, falling back toDATABASE_URL. You can also pass an existing psycopgconnection; if it's already inside a transaction, the adapter's writes become part of it. - Behaves like
MemoryAdapter: adding a flag that already exists is harmless, a missing key raisesFeatureNotFound, andfeatures()returns flags in the order they were added.
- Configure it with
feature-gate-migratecommand creates and updates the adapter's tables on your database. Running it again only applies new migrations, and a PostgreSQL advisory lock stops two deploys from migrating at the same time. You can also call it from Python asfeature_gate.migrate.migrate(connection).- Configurable table prefix, defaulting to
feature_gate_. Set it withtable_prefix=,--table-prefixorFEATURE_GATE_TABLE_PREFIX. The migrations and the adapter must use the same prefix. - Feature IDs are UUIDv7s, created by a
<prefix>uuidv7()function the migration adds, so PostgreSQL 13 and later are supported. The full schema is in the README.
Compatibility
- PostgreSQL 13+ for the new adapter. CI tests it on PostgreSQL 16 and 18.
- Python support is unchanged (3.10+). CI runs the suite on 3.10 and 3.15.
Development & packaging
- New CI workflow runs the test suite on every pull request, on Python 3.10 and 3.15 against PostgreSQL 16 and 18.
- The publish workflow now runs the PostgreSQL tests against a
postgres:16service before publishing. - PostgreSQL tests run locally when
FEATURE_GATE_TEST_DATABASE_URLis set; otherwise they're skipped.
Full changelog: v0.0.8...v0.0.9