# python-keyenv: Your local, safe keyring 🕵️♂️
<!-- ![Tests](https://github.com/andreakiro/python-keyenv/actions/workflows/tests.yml/badge.svg) -->
Go-to solution for effortless secret keys management. This lib/tool allows you to securley store (once for all!) and swiftly load secret key-value pairs from a local cache using dotenv file logic. Now, accessing your favorite API keys across all your projects is as simple as saying hello.
## Usage
### Save your keys and interact with cache
Run this anywhere in your computer to safely store a key on disk
```bash
$ keyenv -n {service name} -sk {secret key}
```
You can of course update a service's key anytime, or list all services
```bash
$ keyenv update -n {service name} -sk {new secret key}
$ keyenv list # this will list all service names
```
You can also provide path to a `json` file to store/update commands
```bash
$ keyenv store -p {path/to/json}
$ keyenv update -p {path/to/json}
```
You could also perform same actions from a Python script if needed
```python
import keyenv as kv
kv.store(service="secret")
kv.update(service="secret")
kv.store("path/to/json/keys")
print(kv.list())
```
### Load your keys across your Python projects
You can then access all of your keys with `keyenv.get(service)` in your Python code 🥳
```python
import langchain.llms as llms
import keyenv as kv
os.environ["OPENAI_API_KEY"] = kv.get("openai")
llm = llms.OpenAI()
llm_chain = LLMChain(prompt="Hi my name is", llm=llm)
llm_chain.run()
```
## Installation
🚨 To install `python-keyenv`, use pip: ```pip install python-keyenv```.
Raw data
{
"_id": null,
"home_page": "https://github.com/andreakiro/python-keyenv",
"name": "keyenv",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "api,keys,env,cache,configurations,python",
"author": "Andrea Pinto",
"author_email": "andreakiro.pinto@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/72/40/5b5b3d0294089d0540dbcd4c004e988b526a62ce0a2b2ecf929e682eda81/keyenv-0.1.0.tar.gz",
"platform": null,
"description": "# python-keyenv: Your local, safe keyring \ud83d\udd75\ufe0f\u200d\u2642\ufe0f\n\n<!-- ![Tests](https://github.com/andreakiro/python-keyenv/actions/workflows/tests.yml/badge.svg) -->\n\nGo-to solution for effortless secret keys management. This lib/tool allows you to securley store (once for all!) and swiftly load secret key-value pairs from a local cache using dotenv file logic. Now, accessing your favorite API keys across all your projects is as simple as saying hello.\n\n## Usage\n\n### Save your keys and interact with cache\n\nRun this anywhere in your computer to safely store a key on disk\n```bash\n$ keyenv -n {service name} -sk {secret key}\n```\n\nYou can of course update a service's key anytime, or list all services\n```bash\n$ keyenv update -n {service name} -sk {new secret key}\n$ keyenv list #\u00a0this will list all service names\n```\n\nYou can also provide path to a `json` file to store/update commands\n```bash\n$ keyenv store -p {path/to/json}\n$ keyenv update -p {path/to/json}\n```\n\nYou could also perform same actions from a Python script if needed\n```python\nimport keyenv as kv\nkv.store(service=\"secret\")\nkv.update(service=\"secret\")\nkv.store(\"path/to/json/keys\")\nprint(kv.list())\n```\n\n### Load your keys across your Python projects\n\nYou can then access all of your keys with `keyenv.get(service)` in your Python code \ud83e\udd73\n\n```python\nimport langchain.llms as llms\nimport keyenv as kv\n\nos.environ[\"OPENAI_API_KEY\"] = kv.get(\"openai\")\n\nllm = llms.OpenAI()\nllm_chain = LLMChain(prompt=\"Hi my name is\", llm=llm)\nllm_chain.run()\n```\n\n## Installation\n\n\ud83d\udea8 To install `python-keyenv`, use pip: ```pip install python-keyenv```.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Store and load secret key-value pairs from a local cache",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/andreakiro/python-keyenv",
"Repository": "https://github.com/andreakiro/python-keyenv"
},
"split_keywords": [
"api",
"keys",
"env",
"cache",
"configurations",
"python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "add52c14efefce4ed38a15ed8640e49b817c9f57fa3ef1bca7fd1df8ad98e112",
"md5": "e6e43dd1905872fe8be8271562461d01",
"sha256": "589b08c408ecd8a2211dc572dfb2c591b13e496b493869fa0617d3afbb74cbef"
},
"downloads": -1,
"filename": "keyenv-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e6e43dd1905872fe8be8271562461d01",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 4525,
"upload_time": "2023-05-17T21:56:31",
"upload_time_iso_8601": "2023-05-17T21:56:31.980015Z",
"url": "https://files.pythonhosted.org/packages/ad/d5/2c14efefce4ed38a15ed8640e49b817c9f57fa3ef1bca7fd1df8ad98e112/keyenv-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "72405b5b3d0294089d0540dbcd4c004e988b526a62ce0a2b2ecf929e682eda81",
"md5": "fc28c26e35f30b0d358aa1a2acb73a38",
"sha256": "b1f80f9de653e17dad71fe5ea6c66096e0a04c5162bbe4a53226e2ce5cef7d2a"
},
"downloads": -1,
"filename": "keyenv-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "fc28c26e35f30b0d358aa1a2acb73a38",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 3654,
"upload_time": "2023-05-17T21:56:33",
"upload_time_iso_8601": "2023-05-17T21:56:33.920484Z",
"url": "https://files.pythonhosted.org/packages/72/40/5b5b3d0294089d0540dbcd4c004e988b526a62ce0a2b2ecf929e682eda81/keyenv-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-17 21:56:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "andreakiro",
"github_project": "python-keyenv",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "python-dotenv",
"specs": [
[
"==",
"\"1.0.0\""
]
]
}
],
"lcname": "keyenv"
}