==============
Configure-Tron
==============
.. image:: https://img.shields.io/pypi/v/configuretron.svg
:target: https://pypi.python.org/pypi/configuretron
.. image:: https://img.shields.io/travis/channelcat/configuretron.svg
:target: https://travis-ci.com/channelcat/configuretron
.. image:: https://readthedocs.org/projects/configuretron/badge/?version=latest
:target: https://configuretron.readthedocs.io/en/latest/?version=latest
:alt: Documentation Status
.. image:: https://pyup.io/repos/github/channelcat/configuretron/shield.svg
:target: https://pyup.io/repos/github/channelcat/configuretron/
:alt: Updates
Configuretron enables type hinted configuration files and secrets for python. Easily add secrets to your configuration that are encryptable from clients and decryptable from trusted developers and running services.
Features
------------
* Type-hinted configuration
* Simple, readable YAML configs
* Config in source control
* Secrets safely in source control
* Easily swap environments
* Control who can encrypt and decrypt
Installation
------------
.. code-block:: console
$ python -m pip install configuretron
Usage
--------
config.yml
.. code-block:: yaml
config:
api_url: https://apitopia.com/api/v1
api_timeout: 20
config.py
.. code-block:: python
@dataclass
class Config:
api_url: str
api_timeout: int = 30
config = configuretron.from_yaml(Config, "config.yml")
Adding Secrets
--------------
Adding encryption just takes a few console commands
.. code-block:: console
$ python -m configuretron --yaml=config.yml setup_encryption
Copy the generated base64 private key into an environment variable (in this example, PRIVATE_KEY)
Encrypt and variables in the config (in this example, api_token):
.. code-block:: console
$ python -m configuretron --yaml=config.yml encrypt --key api_token
Then pass the key to the config
.. code-block:: python
private_key = configuretron.env_base64_value('PRIVATE_KEY')
config = configuretron.from_yaml(Config, "config.yml", private_key=private_key)
Environmental overrides
-----------------------
To override values per-environment, add them into the config like so:
.. code-block:: yaml
config:
api_url: http://localhost:8080/api/v1
api_timeout: 20
env:
prod:
config:
api_url: https://apitopia.com/api/v1
Then just pass `env` when initializing the configuration:
.. code-block:: python
config = configuretron.from_yaml(Config, "config.yml", env="prod")
TODO Features
-------------
* Config heirarchy
* Type validation
* Multiple layered configs
=======
History
=======
0.1.0 (2022-12-22)
------------------
* First release on PyPI.
Raw data
{
"_id": null,
"home_page": "https://github.com/channelcat/configuretron",
"name": "configuretron",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "configuretron",
"author": "Channel Cat",
"author_email": "channelcat@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e2/f1/30549d5857b0a8655ab24522ce8f9aafc6f67c6a9d733df050019c1f22d8/configuretron-0.3.0.tar.gz",
"platform": null,
"description": "==============\nConfigure-Tron\n==============\n\n\n.. image:: https://img.shields.io/pypi/v/configuretron.svg\n :target: https://pypi.python.org/pypi/configuretron\n\n.. image:: https://img.shields.io/travis/channelcat/configuretron.svg\n :target: https://travis-ci.com/channelcat/configuretron\n\n.. image:: https://readthedocs.org/projects/configuretron/badge/?version=latest\n :target: https://configuretron.readthedocs.io/en/latest/?version=latest\n :alt: Documentation Status\n\n\n.. image:: https://pyup.io/repos/github/channelcat/configuretron/shield.svg\n :target: https://pyup.io/repos/github/channelcat/configuretron/\n :alt: Updates\n\n\n\nConfiguretron enables type hinted configuration files and secrets for python. Easily add secrets to your configuration that are encryptable from clients and decryptable from trusted developers and running services.\n\nFeatures\n------------\n * Type-hinted configuration\n * Simple, readable YAML configs\n * Config in source control\n * Secrets safely in source control\n * Easily swap environments\n * Control who can encrypt and decrypt\n\nInstallation\n------------\n\n.. code-block:: console\n\n $ python -m pip install configuretron\n\nUsage\n--------\n\nconfig.yml\n\n.. code-block:: yaml\n\n config:\n api_url: https://apitopia.com/api/v1\n api_timeout: 20\n\nconfig.py\n\n.. code-block:: python\n\n @dataclass\n class Config:\n api_url: str\n api_timeout: int = 30\n\n config = configuretron.from_yaml(Config, \"config.yml\")\n\nAdding Secrets\n--------------\n\nAdding encryption just takes a few console commands\n\n.. code-block:: console\n\n $ python -m configuretron --yaml=config.yml setup_encryption\n\nCopy the generated base64 private key into an environment variable (in this example, PRIVATE_KEY)\n\nEncrypt and variables in the config (in this example, api_token):\n\n.. code-block:: console\n\n $ python -m configuretron --yaml=config.yml encrypt --key api_token\n\nThen pass the key to the config\n\n.. code-block:: python\n\n private_key = configuretron.env_base64_value('PRIVATE_KEY')\n config = configuretron.from_yaml(Config, \"config.yml\", private_key=private_key)\n\nEnvironmental overrides\n-----------------------\n\nTo override values per-environment, add them into the config like so:\n\n.. code-block:: yaml\n\n config:\n api_url: http://localhost:8080/api/v1\n api_timeout: 20\n env:\n prod:\n config:\n api_url: https://apitopia.com/api/v1\n\nThen just pass `env` when initializing the configuration:\n\n.. code-block:: python\n\n config = configuretron.from_yaml(Config, \"config.yml\", env=\"prod\")\n\n\nTODO Features\n-------------\n* Config heirarchy\n* Type validation\n* Multiple layered configs\n\n\n=======\nHistory\n=======\n\n0.1.0 (2022-12-22)\n------------------\n\n* First release on PyPI.\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "Configuration and Secrets for Python applications",
"version": "0.3.0",
"project_urls": {
"Homepage": "https://github.com/channelcat/configuretron"
},
"split_keywords": [
"configuretron"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "29cc5b451cf5f54e9e7ee3a91a2edd7f1539ed4af4f1aa4307ccdb8cf061d950",
"md5": "b8507080e2296e97e033ef351675ee93",
"sha256": "71a90714371b91c0b7f2d62d32ccfba9cf3a58f7fec6c42aedb86bc0f3b12de7"
},
"downloads": -1,
"filename": "configuretron-0.3.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "b8507080e2296e97e033ef351675ee93",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.9",
"size": 8204,
"upload_time": "2024-01-16T23:58:34",
"upload_time_iso_8601": "2024-01-16T23:58:34.109882Z",
"url": "https://files.pythonhosted.org/packages/29/cc/5b451cf5f54e9e7ee3a91a2edd7f1539ed4af4f1aa4307ccdb8cf061d950/configuretron-0.3.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e2f130549d5857b0a8655ab24522ce8f9aafc6f67c6a9d733df050019c1f22d8",
"md5": "fa9a3efea0e2525058ee6280a47076b2",
"sha256": "183390aed14af72fe23516c9bf48a892cd0793c3edc64adefe2b9f04bdd96b04"
},
"downloads": -1,
"filename": "configuretron-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "fa9a3efea0e2525058ee6280a47076b2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 16974,
"upload_time": "2024-01-16T23:58:35",
"upload_time_iso_8601": "2024-01-16T23:58:35.277428Z",
"url": "https://files.pythonhosted.org/packages/e2/f1/30549d5857b0a8655ab24522ce8f9aafc6f67c6a9d733df050019c1f22d8/configuretron-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-16 23:58:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "channelcat",
"github_project": "configuretron",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "configuretron"
}