spartan-module-feature-flag
This module provides a flexible and standardized way to manage feature flags in Python applications. It supports PostgreSQL for persistent storage and optional Redis caching for improved performance.
Features
- CRUD Operations: Create, read, update, and delete feature flags.
- Database Support: PostgreSQL integration.
- Optional Redis Caching: Cache feature flag data for faster access. Redis integration is optional and can be omitted.
- Optional Slack Notifier: Send notification to a Slack channel.
Installation
To install the module and its dependencies, use:
poetry install
Usage
Example Usage
In the examples/basic-usage directory, you will find a complete example of how to use the Feature Flag module in a FastAPI application.
Slack Notifier
-
Attributes
webhook_url: This attribute stores the Slack webhook URL used to send messages to the specified Slack channel.excluded_statuses(Optional): This attribute is a list that specifies which status changes should not trigger notifications to the Slack channel.- If set to
None, all status changes will trigger notifications.
- If set to
headers(Optional): A dictionary where you can specify additional HTTP headers to include in the Slack notification requests.
-
Sample Code
slack_notifier = SlackNotifier( webhook_url='https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX', excluded_statuses=[ChangeStatus.DELETED, ChangeStatus,DISABLED], headers = { "Authorization": "Bearer xoxb-your-slack-token", "Content-Type": "application/json" } )
Development
Debugging & Fixing Issues:
Local Debugging: clone the module repository and install it in "editable" mode using pip install -e ..
Install
- To install the module and its dev dependencies, use:
poetry install --with dev
Run docker-compose
-
To run the PostgreSQL and Redis services, use:
docker-compose -f docker-compose.ci.yml up -d
-
To shut down the services, use:
docker-compose -f docker-compose.ci.yml down
Testing
To run the tests, use:
-
Unit tests:
poetry run pytest tests/unit
-
Integration tests:
poetry run pytest tests/integration
-
Or we can run all tests:
poetry run pytest tests/
Release
Please follow guidelines in docs/RELEASE.md
Contributors
|
Duc Duong |
Hao Bui |
Tuong Dang |
Metadata
Release files for spartan-module-feature-flag 0.4.1
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 |
|---|---|---|---|---|
| spartan_module_feature_flag-0.4.1.tar.gz | 9.0 kB | Without provenance | Details for spartan_module_feature_flag-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spartan_module_feature_flag-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for spartan_module_feature_flag-0.4.1-py3-none-any.whl |
Total release size: 20.7 kB
Release files / spartan_module_feature_flag-0.4.1.tar.gz
| Download URL | spartan_module_feature_flag-0.4.1.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
38418b26886b42f482390fd7167892517228e1cf58922dd7e56b78bc04a6e2ed
|
|
BLAKE2b-256 checksum How to use checksums |
95280ad4fbf7358bc728273cc75caf6b2bee9a92fcca38b1e6a8036b6387abfb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Release files / spartan_module_feature_flag-0.4.1-py3-none-any.whl
| Download URL | spartan_module_feature_flag-0.4.1-py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad3ff89756f756f1e5687ce2ff9bfc6a10e7aa34f2606c097ac6a0349f220433
|
|
BLAKE2b-256 checksum How to use checksums |
2b5e7c499099f6f873c501d16ad9e723f728b698df85e574ff9dc7cdc9f215e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Security for spartan-module-feature-flag 0.4.1
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.