keyrings.envvars
keyrings.envvars is a keyring backend plugin for the keyring utility that provides credentials via environment variables.
Requirements
keyring >= 23.4.0
Python >= 3.9
Installation
You can install keyrings.envvars via pip from PyPI:
$ pip install keyrings.envvars
Usage
keyrings.envvars uses the following format for environment variables:
KEYRING_SERVICE_NAME_<n>=<service>
KEYRING_SERVICE_USERNAME_<n>=<username>
KEYRING_SERVICE_PASSWORD_<n>=<password>
Example for usage with pip credentials:
KEYRING_SERVICE_NAME_0=private-pypi-index.example.com
KEYRING_SERVICE_USERNAME_0=testusername
KEYRING_SERVICE_PASSWORD_0=testpassword
KEYRING_SERVICE_NAME_1=another-private-pypi-index.example.com
KEYRING_SERVICE_USERNAME_1=testusername
KEYRING_SERVICE_PASSWORD_1=testpassword
This can be used along with a requirements.txt containing appropriate --extra-index-url flags to avoid storing credentials in plain-text:
--extra-index-url https://private-pypi-index.example.com/simple
private-package==1.2.3
Note: Defining multiple identical credentials (service name and username) will result in the last defined password being returned as the environment variables are sorted by the keyring backend.
export KEYRING_SERVICE_NAME_0=https://private-pypi-index.example.com
export KEYRING_SERVICE_USERNAME_0=testusername
export KEYRING_SERVICE_PASSWORD_0=testpassword
export KEYRING_SERVICE_NAME_1=https://private-pypi-index.example.com
export KEYRING_SERVICE_USERNAME_1=testusername
export KEYRING_SERVICE_PASSWORD_1=testpassword_1
keyring get https://private-pypi-index.example.com testusername
testpassword_1
If there are multiple credentials defined for a service and no username is given when searching then None will be returned. For example, given the definitions above:
>>> import keyring
>>> cred = keyring.get_credential('https://private-pypi-index.example.com', None)
>>> print(cred)
None
Contributing
Contributions including suggestions, pull requests, etc. are very welcome. keyrings.envvars uses Conventional Commits format for commit messages.
Please run nox before committing any changes. Running pre-commit with the pre-commit and commit-msg hooks enabled is also requested to ensure linting checks are done correctly on code, configuration, and commit messages.
Please note that contributions created partially or entirely with AI/LLM will be rejected.
License
Distributed under the terms of the MIT license, keyrings.envvars is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Please read https://www.chiark.greenend.org.uk/~sgtatham/bugs.html before you file an issue.
Credits
This project was generated from @cjolowicz’s Hypermodern Python Cookiecutter template.
Metadata
Release files for keyrings.envvars 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| keyrings_envvars-2.0.0.tar.gz | 9.8 kB | Without provenance | Details for keyrings_envvars-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| keyrings_envvars-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for keyrings_envvars-2.0.0-py3-none-any.whl |
Total release size: 20.1 kB
Release files / keyrings_envvars-2.0.0.tar.gz
| Download URL | keyrings_envvars-2.0.0.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
877dd55785aeecc2859d29dc9bae3105423e9b813a31a4c028c1d5e1b97f83ea
|
|
BLAKE2b-256 checksum How to use checksums |
a6773fe2a0216138b9a2a72fdebed24f3e5bda073b76fa353c0b19969d7ad7f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.11.2 Linux/6.1.0-37-amd64
|
Release files / keyrings_envvars-2.0.0-py3-none-any.whl
| Download URL | keyrings_envvars-2.0.0-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f9e066c611b263775ac3d323924167d7e9823cb079c4a5d68229dd39eca4647
|
|
BLAKE2b-256 checksum How to use checksums |
1ec8d6e8ee5284193bb6a2671fe8962f8892d7d2bbbf516544762b5e00601c21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.11.2 Linux/6.1.0-37-amd64
|
Security for keyrings.envvars 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.