Skip to main content

Keep It Secret by BTHLabs

Project description

Keep It Secret by BTHLabs

Keep It Secret is a small Python library for declarative management of app secrets.

Docs | Source repository


$ pip install keep_it_secret


Keep It Secret gives a developer API needed to declare secrets used by the app and access them in a secure, uniform manner.

Consider the following example:

from secrets_manager import (
    AbstractField, EnvField, LiteralField, Secrets, SecretsField,
from import AWSSecrets, AWSSecretsManagerField

class AppSecrets(Secrets):
    secret_key: str =
    db_password: str ='APP_DB_PASSWORD', required=True)
    pbkdf2_iterations_count: int = EnvField(

class DevelopmentSecrets(AppSecrets):
    secret_key: str ='thisisntsecure')

class ProductionSecrets(AppSecrets):
    aws: AWSSecrets =
    secret_key: str = AWSSecretsManagerField(
        'app/production/secret_key', required=True,
    db_password: str = AWSSecretsManagerField(
        'app/production/db_password', required=True,

The AppSecrets class serves as base class for environment specific classes. The environment specific classes can overload any field, add new fields and extend the base class to provide custom behaviour.

The DevelopmentSecrets class uses environment variables and literal values to provide secrets suitable for the development environment:

>>> development_secrets = DevelopmentSecrets()
>>> development_secrets.secret_key
>>> development_secrets.db_password
>>> development_secrets.pbkdf2_iterations_count

The ProductionSecrets class uses environment variables and AWS Secrets Manager to provide secrets suitable for the development environment:

>>> production_secrets = ProductionSecrets()
>>> production_secrets.secret_key
>>> production_secrets.db_password
>>> production_secrets.pbkdf2_iterations_count


Keep It Secret is developed by Tomek Wójcik.


Keep It Secret is licensed under the MIT License.

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

keep_it_secret-1.2.0.tar.gz (9.1 kB view hashes)

Uploaded Source

Built Distribution

keep_it_secret-1.2.0-py3-none-any.whl (11.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page