{"id":15009910,"url":"https://github.com/envkey/envkey-python","last_synced_at":"2025-07-29T08:05:12.741Z","repository":{"id":27433885,"uuid":"113816465","full_name":"envkey/envkey-python","owner":"envkey","description":"EnvKey's python library. Protect API keys and credentials. Keep configuration in sync.","archived":false,"fork":false,"pushed_at":"2023-05-17T22:44:33.000Z","size":79094,"stargazers_count":23,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T18:06:31.120Z","etag":null,"topics":["configuration","configuration-management","developer-tools","devops","devops-tools","django","encryption","environment-variables","python","python2","python3","secret-management","secrets","security","security-tools"],"latest_commit_sha":null,"homepage":"https://www.envkey.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/envkey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-12-11T05:31:58.000Z","updated_at":"2024-10-15T14:18:10.000Z","dependencies_parsed_at":"2022-08-07T12:16:43.116Z","dependency_job_id":"6598d9c9-abe6-4407-96a5-f8344f88fffa","html_url":"https://github.com/envkey/envkey-python","commit_stats":{"total_commits":31,"total_committers":3,"mean_commits":"10.333333333333334","dds":"0.16129032258064513","last_synced_commit":"e4da1bc4eff6699d83f80e839d6be9de79dddc9b"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/envkey/envkey-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envkey%2Fenvkey-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envkey%2Fenvkey-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envkey%2Fenvkey-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envkey%2Fenvkey-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/envkey","download_url":"https://codeload.github.com/envkey/envkey-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envkey%2Fenvkey-python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267652509,"owners_count":24122093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configuration","configuration-management","developer-tools","devops","devops-tools","django","encryption","environment-variables","python","python2","python3","secret-management","secrets","security","security-tools"],"created_at":"2024-09-24T19:29:05.756Z","updated_at":"2025-07-29T08:05:12.715Z","avatar_url":"https://github.com/envkey.png","language":"Python","readme":"# envkey-python\n\nIntegrate [EnvKey](https://www.envkey.com) with your Python projects to keep API keys, credentials, and other configuration securely and automatically in sync for developers and servers.\n\nCompatible with Python 2 and 3.\n\n# v2\n\nNow that [EnvKey v2](https://v2.envkey.com) has been released, [you can find version 2 of this package here.](https://github.com/envkey/envkey/tree/main/public/sdks/languages-and-frameworks/python)\n\nUsing v2 requires an EnvKey v2 organization (it won't work with ENVKEYs generated in a v1 org).\n\n[Here's a guide on migrating from v1 to v2.](https://docs-v2.envkey.com/docs/migrating-from-v1)\n\nTo continue using version 1 of this package, make sure you specify `==1.*` when installing with pip so that you don't accidentally install v2.\n\n## Installation\n\n```bash\n$ pip install envkey==1.*\n```\n\nThen at the entry point of your application:\n\n```python\nimport envkey\n```\n\nFor **Django**, you should put the above in `manage.py` and `wsgi.py`. Also see the [note on casting below](#django-environ-casting) if you're migrating from `django-environ`.\n\n## Usage\n\nGenerate an `ENVKEY` in the [EnvKey App](https://github.com/envkey/envkey-app). Then set `ENVKEY=...`, either in a gitignored `.env` file in the root of your project (in development) or in an environment variable (on servers).\n\nNow all your EnvKey variables will be available in `os.environ`.\n\nOr as a bit of syntactic sugar to avoid needing to always import `os` alongside `envkey`, you can call `envkey.get`, which delegates to `os.environ.get`. For example:\n\n```python\nimport envkey\n\nmy_var = envkey.get(\"SOME_ENVKEY_VAR\")\n\n```\n\n### Errors\n\nThe package will throw an error if an `ENVKEY` is missing or invalid.\n\n### Example\n\nAssume you have `STRIPE_SECRET_KEY` set for the `development` environment in the EnvKey App. You generate a local development `ENVKEY`.\n\nIn your project's **gitignored** `.env` file:\n\n```bash\n# .env\nENVKEY=GsL8zC74DWchdpvssa9z-nk7humd7hJmAqNoA\n```\n\nIn `app.py`:\n\n```python\nstripe.api_key = os.environ['STRIPE_SECRET_KEY']\n```\n\nOr using the `envkey.get` sugar:\n\n```python\nstripe.api_key = envkey.get('STRIPE_SECRET_KEY')\n```\n\nNow `STRIPE_SECRET_KEY` will stay automatically in sync for all the developers on your team.\n\nFor a server, generate a server `ENVKEY` in the EnvKey App, then set the `ENVKEY` as an environment variable instead of putting it in a `.env` file.\n\nNow your servers will stay in sync as well. If you need to rotate your `STRIPE_SECRET_KEY` you can do it in a few seconds in the EnvKey App, restart your servers, and you're good to go. All your team's developers and all your servers will have the new value.\n\n### Overriding Vars\n\nThis package will not overwrite existing environment variables or additional variables set in a `.env` file. This can be convenient for customizing environments that otherwise share the same configuration. You can also use [sub-environments](https://blog.envkey.com/development-staging-production-and-beyond-85f26f65edd6) in the EnvKey App for this purpose.\n\n### Working Offline\n\nThis package caches your encrypted config in development so that you can still use it while offline. Your config will still be available (though possibly not up-to-date) the next time you lose your internet connection. If you do have a connection available, envkey will always load the latest config. Your cached encrypted config is stored in `$HOME/.envkey/cache`\n\nFor caching purposes, it's assumed you're in development mode when a `.env` file exists in the root of your project.\n\n### Disabling autoload\n\nIf you'd like to have more control over how your config is loaded, you can prevent the package from auto-loading on import by setting `ENVKEY_DISABLE_AUTOLOAD=1` either in your `.env` file or as an environment variable.\n\nYou can then load your config explicitly like this:\n\n```python\nimport envkey\n\nenvkey.load(cache_enabled=True, dot_env_enabled=True, dot_env_path=\".env\")\n```\n\nFor even more flexibility, you can just fetch your config as a dict (without setting it on `os.environ`) like this:\n\n```python\nimport envkey\nimport os\n\nconfig = envkey.fetch_env(os.environ['ENVKEY'], cache_enabled=True)\n```\n\n### django-environ casting\n\nIf you happen to be migrating from `django-environ` to EnvKey, watch out for the fact that EnvKey *does not* cast variables to booleans or any other non-string types as `django-environ` does. All variables set by EnvKey will be *strings* in accordance with the cross-platform environment variable standard. See: https://twitter.com/manishsinhaha/status/1265746057377361921\n\n## envkey-fetch binaries\n\nIf you look in the `ext` directory of this package, you'll find a number of `envkey-fetch` binaries for various platforms and architectures. These are output by the [envkey-fetch Go library](https://github.com/envkey/envkey-fetch). It contains EnvKey's core cross-platform fetching, decryption, verification, web of trust, redundancy, and caching logic. It is completely open source.\n\n## x509 error / ca-certificates\n\nOn a stripped down OS like Alpine Linux, you may get an `x509: certificate signed by unknown authority` error when this package attempts to load your config. [envkey-fetch](https://github.com/envkey/envkey-fetch) tries to handle this by including its own set of trusted CAs via [gocertifi](https://github.com/certifi/gocertifi), but if you're getting this error anyway, you can fix it by ensuring that the `ca-certificates` dependency is installed. On Alpine you'll want to run:\n```\napk add --no-cache ca-certificates\n```\n\n## Further Reading\n\nFor more on EnvKey in general:\n\nRead the [docs](https://docs.envkey.com).\n\nRead the [integration quickstart](https://docs.envkey.com/integration-quickstart.html).\n\nRead the [security and cryptography overview](https://security.envkey.com).\n\n## Need help? Have questions, feedback, or ideas?\n\nPost an [issue](https://github.com/envkey/envkey-python/issues) or email us: [support@envkey.com](mailto:support@envkey.com).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenvkey%2Fenvkey-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenvkey%2Fenvkey-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenvkey%2Fenvkey-python/lists"}