Berglas Library for Python
==========================
.. image:: https://travis-ci.org/maroux/berglas-python.svg?branch=master
:target: https://travis-ci.org/maroux/berglas-python
.. image:: https://coveralls.io/repos/github/maroux/berglas-python/badge.svg?branch=master
:target: https://coveralls.io/github/maroux/berglas-python?branch=master
.. image:: https://img.shields.io/pypi/v/berglas.svg?style=flat-square
:target: https://pypi.python.org/pypi/berglas
.. image:: https://img.shields.io/pypi/pyversions/berglas.svg?style=flat-square
:target: https://pypi.python.org/pypi/berglas
.. image:: https://img.shields.io/pypi/implementation/berglas.svg?style=flat-square
:target: https://pypi.python.org/pypi/berglas
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/ambv/black
This library automatically parses berglas references when imported.
Only Python 3.6+ is supported currently.
You can find the latest, most up to date, documentation on `Github`_.
Quick Start
-----------
Install library:
.. code:: sh
pip install berglas
Import the module:
.. code:: python
import berglas.auto # noqa
When imported, the `berglas` module will:
1. Detect the runtime environment and call the appropriate API to get the list
of environment variables that were set on the resource at deploy time
1. Download and decrypt any secrets that match the `Berglas environment
variable reference syntax`_
1. Replace the value for the environment variable with the decrypted secret
You can also opt out of auto-parsing and call the library yourself instead:
.. code:: python
import os
from berglas import resolver
if __name__ == '__main__':
client = resolver.Client()
client.replace("MY_SECRET")
print(os.environ["MY_SECRET"])
// alternatively, use resolve method to simply get the value without updating environment:
my_secret = client.resolve(os.environ["MY_SECRET"])
print(my_secret)
Release Notes
-------------
v0.1
~~~~
- First version
Development
-----------
Getting Started
~~~~~~~~~~~~~~~
Assuming that you have Python, ``pyenv`` and ``pyenv-virtualenv`` installed, set up your
environment and install the required dependencies like this instead of
the ``pip install berglas`` defined above:
.. code:: sh
$ git clone https://github.com/maroux/berglas-python.git
$ cd python
$ pyenv virtualenv 3.9.14 berglas-3.9
...
$ pyenv shell berglas-3.9
$ pip install setuptools==58
$ pip install -r requirements/dev-3.9.txt
Updating Requirements Files
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Update the `install_requires` variable in `setup.py` and then from the pyenv virtualenv shell run:
.. code:: sh
$ python -m pip install pip==18.0 pip-tools==3.2.0 --upgrade
$ make pip_compile
Running Tests
~~~~~~~~~~~~~
You can run tests in using ``make test``. By default,
it will run all of the unit and functional tests, but you can also specify your own
``py.test`` options.
.. code:: sh
$ py.test
Getting Help
------------
We use GitHub issues for tracking bugs and feature requests.
* If it turns out that you may have found a bug, please `open an issue <https://github.com/maroux/berglas-python/issues/new>`__
.. _Github: github.com/maroux/berglas-python
.. _Berglas environment variable reference syntax: https://github.com/GoogleCloudPlatform/berglas/blob/master/doc/reference-syntax.md
Raw data
{
"_id": null,
"home_page": "https://github.com/maroux/berglas-python",
"name": "berglas",
"maintainer": "Aniruddha Maru",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "aniruddhamaru@gmail.com",
"keywords": "secrets gcs gcp",
"author": "Aniruddha Maru",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/77/a1/1326a7d9550405c9a4b76aa6081cfe27644db4523ac40187de6e52c986e8/berglas-0.3.1.tar.gz",
"platform": null,
"description": "Berglas Library for Python\n==========================\n\n.. image:: https://travis-ci.org/maroux/berglas-python.svg?branch=master\n :target: https://travis-ci.org/maroux/berglas-python\n\n.. image:: https://coveralls.io/repos/github/maroux/berglas-python/badge.svg?branch=master\n :target: https://coveralls.io/github/maroux/berglas-python?branch=master\n\n.. image:: https://img.shields.io/pypi/v/berglas.svg?style=flat-square\n :target: https://pypi.python.org/pypi/berglas\n\n.. image:: https://img.shields.io/pypi/pyversions/berglas.svg?style=flat-square\n :target: https://pypi.python.org/pypi/berglas\n\n.. image:: https://img.shields.io/pypi/implementation/berglas.svg?style=flat-square\n :target: https://pypi.python.org/pypi/berglas\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/ambv/black\n\nThis library automatically parses berglas references when imported.\n\nOnly Python 3.6+ is supported currently.\n\nYou can find the latest, most up to date, documentation on `Github`_.\n\nQuick Start\n-----------\n\nInstall library:\n\n.. code:: sh\n\n pip install berglas\n\nImport the module:\n\n.. code:: python\n\n import berglas.auto # noqa\n\nWhen imported, the `berglas` module will:\n\n1. Detect the runtime environment and call the appropriate API to get the list\nof environment variables that were set on the resource at deploy time\n\n1. Download and decrypt any secrets that match the `Berglas environment\nvariable reference syntax`_\n\n1. Replace the value for the environment variable with the decrypted secret\n\nYou can also opt out of auto-parsing and call the library yourself instead:\n\n.. code:: python\n\n import os\n\n from berglas import resolver\n\n if __name__ == '__main__':\n client = resolver.Client()\n client.replace(\"MY_SECRET\")\n print(os.environ[\"MY_SECRET\"])\n\n // alternatively, use resolve method to simply get the value without updating environment:\n my_secret = client.resolve(os.environ[\"MY_SECRET\"])\n print(my_secret)\n\nRelease Notes\n-------------\n\nv0.1\n~~~~\n\n- First version\n\nDevelopment\n-----------\n\nGetting Started\n~~~~~~~~~~~~~~~\nAssuming that you have Python, ``pyenv`` and ``pyenv-virtualenv`` installed, set up your\nenvironment and install the required dependencies like this instead of\nthe ``pip install berglas`` defined above:\n\n.. code:: sh\n\n $ git clone https://github.com/maroux/berglas-python.git\n $ cd python\n $ pyenv virtualenv 3.9.14 berglas-3.9\n ...\n $ pyenv shell berglas-3.9\n $ pip install setuptools==58\n $ pip install -r requirements/dev-3.9.txt\n\nUpdating Requirements Files\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\nUpdate the `install_requires` variable in `setup.py` and then from the pyenv virtualenv shell run:\n.. code:: sh\n\n $ python -m pip install pip==18.0 pip-tools==3.2.0 --upgrade\n $ make pip_compile\n\nRunning Tests\n~~~~~~~~~~~~~\nYou can run tests in using ``make test``. By default,\nit will run all of the unit and functional tests, but you can also specify your own\n``py.test`` options.\n\n.. code:: sh\n\n $ py.test\n\n\nGetting Help\n------------\n\nWe use GitHub issues for tracking bugs and feature requests.\n\n* If it turns out that you may have found a bug, please `open an issue <https://github.com/maroux/berglas-python/issues/new>`__\n\n.. _Github: github.com/maroux/berglas-python\n.. _Berglas environment variable reference syntax: https://github.com/GoogleCloudPlatform/berglas/blob/master/doc/reference-syntax.md\n",
"bugtrack_url": null,
"license": "Apache Software License (Apache License 2.0)",
"summary": "Berglas Python Library",
"version": "0.3.1",
"split_keywords": [
"secrets",
"gcs",
"gcp"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b211096c9df7fc59e357e9797e4a5e43fc8e7acf9c8060823d93a45713296d60",
"md5": "fd30e52b1c03f2c3d720a8aed99d5abe",
"sha256": "d44cbf76c8fcb214db51b2045b0e883384ab1b1a6710389a6657476ea609effe"
},
"downloads": -1,
"filename": "berglas-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fd30e52b1c03f2c3d720a8aed99d5abe",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 11565,
"upload_time": "2023-04-27T18:48:30",
"upload_time_iso_8601": "2023-04-27T18:48:30.787825Z",
"url": "https://files.pythonhosted.org/packages/b2/11/096c9df7fc59e357e9797e4a5e43fc8e7acf9c8060823d93a45713296d60/berglas-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "77a11326a7d9550405c9a4b76aa6081cfe27644db4523ac40187de6e52c986e8",
"md5": "91070a2d3b9d09e1cb5c2c33bb87e98a",
"sha256": "3862025b6182e820102333529fb039b809f27f4fe31fa7c13668265dbd077b71"
},
"downloads": -1,
"filename": "berglas-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "91070a2d3b9d09e1cb5c2c33bb87e98a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 11580,
"upload_time": "2023-04-27T18:48:34",
"upload_time_iso_8601": "2023-04-27T18:48:34.441678Z",
"url": "https://files.pythonhosted.org/packages/77/a1/1326a7d9550405c9a4b76aa6081cfe27644db4523ac40187de6e52c986e8/berglas-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-27 18:48:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "maroux",
"github_project": "berglas-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "berglas"
}