| 1 |
Metadata-Version: 2.4 |
| 2 |
Name: keyring |
| 3 |
Version: 25.7.0 |
| 4 |
Summary: Store and access your passwords safely. |
| 5 |
Author-email: Kang Zhang <[email protected]> |
| 6 |
Maintainer-email: "Jason R. Coombs" <[email protected]> |
| 7 |
License-Expression: MIT |
| 8 |
Project-URL: Source, https://github.com/jaraco/keyring |
| 9 |
Classifier: Development Status :: 5 - Production/Stable |
| 10 |
Classifier: Intended Audience :: Developers |
| 11 |
Classifier: Programming Language :: Python :: 3 |
| 12 |
Classifier: Programming Language :: Python :: 3 :: Only |
| 13 |
Requires-Python: >=3.9 |
| 14 |
Description-Content-Type: text/x-rst |
| 15 |
License-File: LICENSE |
| 16 |
Requires-Dist: pywin32-ctypes>=0.2.0; sys_platform == "win32" |
| 17 |
Requires-Dist: SecretStorage>=3.2; sys_platform == "linux" |
| 18 |
Requires-Dist: jeepney>=0.4.2; sys_platform == "linux" |
| 19 |
Requires-Dist: importlib_metadata>=4.11.4; python_version < "3.12" |
| 20 |
Requires-Dist: jaraco.classes |
| 21 |
Requires-Dist: jaraco.functools |
| 22 |
Requires-Dist: jaraco.context |
| 23 |
Provides-Extra: test |
| 24 |
Requires-Dist: pytest!=8.1.*,>=6; extra == "test" |
| 25 |
Requires-Dist: pyfakefs; extra == "test" |
| 26 |
Provides-Extra: doc |
| 27 |
Requires-Dist: sphinx>=3.5; extra == "doc" |
| 28 |
Requires-Dist: jaraco.packaging>=9.3; extra == "doc" |
| 29 |
Requires-Dist: rst.linker>=1.9; extra == "doc" |
| 30 |
Requires-Dist: furo; extra == "doc" |
| 31 |
Requires-Dist: sphinx-lint; extra == "doc" |
| 32 |
Requires-Dist: jaraco.tidelift>=1.4; extra == "doc" |
| 33 |
Provides-Extra: check |
| 34 |
Requires-Dist: pytest-checkdocs>=2.4; extra == "check" |
| 35 |
Requires-Dist: pytest-ruff>=0.2.1; sys_platform != "cygwin" and extra == "check" |
| 36 |
Provides-Extra: cover |
| 37 |
Requires-Dist: pytest-cov; extra == "cover" |
| 38 |
Provides-Extra: enabler |
| 39 |
Requires-Dist: pytest-enabler>=3.4; extra == "enabler" |
| 40 |
Provides-Extra: type |
| 41 |
Requires-Dist: pytest-mypy>=1.0.1; extra == "type" |
| 42 |
Requires-Dist: pygobject-stubs; extra == "type" |
| 43 |
Requires-Dist: shtab; extra == "type" |
| 44 |
Requires-Dist: types-pywin32; extra == "type" |
| 45 |
Provides-Extra: completion |
| 46 |
Requires-Dist: shtab>=1.1.0; extra == "completion" |
| 47 |
Dynamic: license-file |
| 48 |
|
| 49 |
.. image:: https://img.shields.io/pypi/v/keyring.svg |
| 50 |
:target: https://pypi.org/project/keyring |
| 51 |
|
| 52 |
.. image:: https://img.shields.io/pypi/pyversions/keyring.svg |
| 53 |
|
| 54 |
.. image:: https://github.com/jaraco/keyring/actions/workflows/main.yml/badge.svg |
| 55 |
:target: https://github.com/jaraco/keyring/actions?query=workflow%3A%22tests%22 |
| 56 |
:alt: tests |
| 57 |
|
| 58 |
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json |
| 59 |
:target: https://github.com/astral-sh/ruff |
| 60 |
:alt: Ruff |
| 61 |
|
| 62 |
.. image:: https://readthedocs.org/projects/keyring/badge/?version=latest |
| 63 |
:target: https://keyring.readthedocs.io/en/latest/?badge=latest |
| 64 |
|
| 65 |
.. image:: https://img.shields.io/badge/skeleton-2025-informational |
| 66 |
:target: https://blog.jaraco.com/skeleton |
| 67 |
|
| 68 |
.. image:: https://tidelift.com/badges/package/pypi/keyring |
| 69 |
:target: https://tidelift.com/subscription/pkg/pypi-keyring?utm_source=pypi-keyring&utm_medium=readme |
| 70 |
|
| 71 |
.. image:: https://badges.gitter.im/jaraco/keyring.svg |
| 72 |
:alt: Join the chat at https://gitter.im/jaraco/keyring |
| 73 |
:target: https://gitter.im/jaraco/keyring?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge |
| 74 |
|
| 75 |
The Python keyring library provides an easy way to access the |
| 76 |
system keyring service from python. It can be used in any |
| 77 |
application that needs safe password storage. |
| 78 |
|
| 79 |
These recommended keyring backends are supported: |
| 80 |
|
| 81 |
* macOS `Keychain |
| 82 |
<https://en.wikipedia.org/wiki/Keychain_%28software%29>`_ |
| 83 |
* Freedesktop `Secret Service |
| 84 |
<http://standards.freedesktop.org/secret-service/>`_ supports many DE including |
| 85 |
GNOME (requires `secretstorage <https://pypi.python.org/pypi/secretstorage>`_) |
| 86 |
* KDE4 & KDE5 `KWallet <https://en.wikipedia.org/wiki/KWallet>`_ |
| 87 |
(requires `dbus <https://pypi.python.org/pypi/dbus-python>`_) |
| 88 |
* `Windows Credential Locker |
| 89 |
<https://docs.microsoft.com/en-us/windows/uwp/security/credential-locker>`_ |
| 90 |
|
| 91 |
Other keyring implementations are available through `Third-Party Backends`_. |
| 92 |
|
| 93 |
Installation - Linux |
| 94 |
==================== |
| 95 |
|
| 96 |
On Linux, the KWallet backend relies on dbus-python_, which does not always |
| 97 |
install correctly when using pip (compilation is needed). For best results, |
| 98 |
install dbus-python as a system package. |
| 99 |
|
| 100 |
.. _dbus-python: https://gitlab.freedesktop.org/dbus/dbus-python |
| 101 |
|
| 102 |
Compatibility - macOS |
| 103 |
===================== |
| 104 |
|
| 105 |
macOS keychain supports macOS 11 (Big Sur) and later requires Python 3.8.7 |
| 106 |
or later with the "universal2" binary. See |
| 107 |
`#525 <https://github.com/jaraco/keyring/issues/525>`_ for details. |
| 108 |
|
| 109 |
Using Keyring |
| 110 |
============= |
| 111 |
|
| 112 |
The basic usage of keyring is pretty simple: just call |
| 113 |
``keyring.set_password`` and ``keyring.get_password``:: |
| 114 |
|
| 115 |
>>> import keyring |
| 116 |
>>> keyring.set_password("system", "username", "password") |
| 117 |
>>> keyring.get_password("system", "username") |
| 118 |
'password' |
| 119 |
|
| 120 |
Command-line Utility |
| 121 |
-------------------- |
| 122 |
|
| 123 |
Keyring supplies a ``keyring`` command which is installed with the |
| 124 |
package. After installing keyring in most environments, the |
| 125 |
command should be available for setting, getting, and deleting |
| 126 |
passwords. For more usage information, invoke with no arguments |
| 127 |
or with ``--help`` as so:: |
| 128 |
|
| 129 |
$ keyring --help |
| 130 |
$ keyring set system username |
| 131 |
Password for 'username' in 'system': |
| 132 |
$ keyring get system username |
| 133 |
password |
| 134 |
|
| 135 |
The command-line functionality is also exposed as an executable |
| 136 |
package, suitable for invoking from Python like so:: |
| 137 |
|
| 138 |
$ python -m keyring --help |
| 139 |
$ python -m keyring set system username |
| 140 |
Password for 'username' in 'system': |
| 141 |
$ python -m keyring get system username |
| 142 |
password |
| 143 |
|
| 144 |
Tab Completion |
| 145 |
-------------- |
| 146 |
|
| 147 |
If installed via a package manager (apt, pacman, nix, homebrew, etc), |
| 148 |
these shell completions may already have been distributed with the package |
| 149 |
(no action required). |
| 150 |
|
| 151 |
Keyring provides tab completion if the ``completion`` extra is installed:: |
| 152 |
|
| 153 |
$ pip install 'keyring[completion]' |
| 154 |
|
| 155 |
Then, generate shell completions, something like:: |
| 156 |
|
| 157 |
$ keyring --print-completion bash | sudo tee /usr/share/bash-completion/completions/keyring |
| 158 |
$ keyring --print-completion zsh | sudo tee /usr/share/zsh/site-functions/_keyring |
| 159 |
$ keyring --print-completion tcsh | sudo tee /etc/profile.d/keyring.csh |
| 160 |
|
| 161 |
**Note**: the path of `/usr/share` is mainly for GNU/Linux. For other OSs, |
| 162 |
consider: |
| 163 |
|
| 164 |
- macOS (Homebrew x86): /usr/local/share |
| 165 |
- macOS (Homebrew ARM): /opt/homebrew/share |
| 166 |
- Android (Termux): /data/data/com.termux/files/usr/share |
| 167 |
- Windows (mingw64 of msys2): /mingw64/share |
| 168 |
- ... |
| 169 |
|
| 170 |
After installing the shell completions, enable them following your shell's |
| 171 |
recommended instructions. e.g.: |
| 172 |
|
| 173 |
- bash: install `bash-completion <https://github.com/scop/bash-completion>`_, |
| 174 |
and ensure ``. /usr/share/bash-completion/bash_completion`` in ``~/.bashrc``. |
| 175 |
- zsh: ensure ``autoload -Uz compinit && compinit`` appears in ``~/.zshrc``, |
| 176 |
then ``grep -w keyring ~/.zcompdump`` to verify keyring appears, indicating |
| 177 |
it was installed correctly. |
| 178 |
|
| 179 |
Configuring |
| 180 |
=========== |
| 181 |
|
| 182 |
The python keyring lib contains implementations for several backends. The |
| 183 |
library will attempt to |
| 184 |
automatically choose the most suitable backend for the current |
| 185 |
environment. Users may also specify the preferred keyring in a |
| 186 |
config file or by calling the ``set_keyring()`` function. |
| 187 |
|
| 188 |
Config file path |
| 189 |
---------------- |
| 190 |
|
| 191 |
The configuration is stored in a file named "keyringrc.cfg" |
| 192 |
found in a platform-specific location. To determine |
| 193 |
where the config file is stored, run ``keyring diagnose``. |
| 194 |
|
| 195 |
Config file content |
| 196 |
------------------- |
| 197 |
|
| 198 |
To specify a keyring backend, set the **default-keyring** option to the |
| 199 |
full path of the class for that backend, such as |
| 200 |
``keyring.backends.macOS.Keyring``. |
| 201 |
|
| 202 |
If **keyring-path** is indicated, keyring will add that path to the Python |
| 203 |
module search path before loading the backend. |
| 204 |
|
| 205 |
For example, this config might be used to load the |
| 206 |
``SimpleKeyring`` from the ``simplekeyring`` module in |
| 207 |
the ``./demo`` directory (not implemented):: |
| 208 |
|
| 209 |
[backend] |
| 210 |
default-keyring=simplekeyring.SimpleKeyring |
| 211 |
keyring-path=demo |
| 212 |
|
| 213 |
Third-Party Backends |
| 214 |
==================== |
| 215 |
|
| 216 |
In addition to the backends provided by the core keyring package for |
| 217 |
the most common and secure use cases, there |
| 218 |
are additional keyring backend implementations available for other |
| 219 |
use cases. Simply install them to make them available: |
| 220 |
|
| 221 |
- `keyrings.cryptfile <https://pypi.org/project/keyrings.cryptfile>`_ |
| 222 |
- Encrypted text file storage. |
| 223 |
- `keyrings.alt <https://pypi.org/project/keyrings.alt>`_ - "alternate", |
| 224 |
possibly-insecure backends, originally part of the core package, but |
| 225 |
available for opt-in. |
| 226 |
- `gsheet-keyring <https://pypi.org/project/gsheet-keyring>`_ |
| 227 |
- a backend that stores secrets in a Google Sheet. For use with |
| 228 |
`ipython-secrets <https://pypi.org/project/ipython-secrets>`_. |
| 229 |
- `bitwarden-keyring <https://pypi.org/project/bitwarden-keyring/>`_ |
| 230 |
- a backend that stores secrets in the `BitWarden <https://bitwarden.com/>`_ |
| 231 |
password manager. |
| 232 |
- `onepassword-keyring <https://pypi.org/project/onepassword-keyring/>`_ |
| 233 |
- a backend that stores secrets in the `1Password <https://1password.com/>`_ password manager. |
| 234 |
- `sagecipher <https://pypi.org/project/sagecipher>`_ - an encryption |
| 235 |
backend which uses the ssh agent protocol's signature operation to |
| 236 |
derive the cipher key. |
| 237 |
- `keyrings.osx_keychain_keys <https://pypi.org/project/keyrings.osx-keychain-keys>`_ |
| 238 |
- OSX keychain key-management, for private, public, and symmetric keys. |
| 239 |
- `keyring_pass.PasswordStoreBackend <https://github.com/nazarewk/keyring_pass>`_ |
| 240 |
- Password Store (pass) backend for python's keyring |
| 241 |
- `keyring_jeepney <https://pypi.org/project/keyring_jeepney>`__ - a |
| 242 |
pure Python backend using the secret service DBus API for desktop |
| 243 |
Linux (requires ``keyring<24``). |
| 244 |
|
| 245 |
|
| 246 |
Write your own keyring backend |
| 247 |
============================== |
| 248 |
|
| 249 |
The interface for the backend is defined by ``keyring.backend.KeyringBackend``. |
| 250 |
Every backend should derive from that base class and define a ``priority`` |
| 251 |
attribute and three functions: ``get_password()``, ``set_password()``, and |
| 252 |
``delete_password()``. The ``get_credential()`` function may be defined if |
| 253 |
desired. |
| 254 |
|
| 255 |
See the ``backend`` module for more detail on the interface of this class. |
| 256 |
|
| 257 |
Keyring employs entry points to allow any third-party package to implement |
| 258 |
backends without any modification to the keyring itself. Those interested in |
| 259 |
creating new backends are encouraged to create new, third-party packages |
| 260 |
in the ``keyrings`` namespace, in a manner modeled by the `keyrings.alt |
| 261 |
package <https://github.com/jaraco/keyrings.alt>`_. See the |
| 262 |
``setup.cfg`` file |
| 263 |
in that project for hints on how to create the requisite entry points. |
| 264 |
Backends that prove essential may be considered for inclusion in the core |
| 265 |
library, although the ease of installing these third-party packages should |
| 266 |
mean that extensions may be readily available. |
| 267 |
|
| 268 |
To create an extension for Keyring, please submit a pull request to |
| 269 |
have your extension mentioned as an available extension. |
| 270 |
|
| 271 |
Runtime Configuration |
| 272 |
===================== |
| 273 |
|
| 274 |
Keyring additionally allows programmatic configuration of the |
| 275 |
backend calling the api ``set_keyring()``. The indicated backend |
| 276 |
will subsequently be used to store and retrieve passwords. |
| 277 |
|
| 278 |
To invoke ``set_keyring``:: |
| 279 |
|
| 280 |
# define a new keyring class which extends the KeyringBackend |
| 281 |
import keyring.backend |
| 282 |
|
| 283 |
class TestKeyring(keyring.backend.KeyringBackend): |
| 284 |
"""A test keyring which always outputs the same password |
| 285 |
""" |
| 286 |
priority = 1 |
| 287 |
|
| 288 |
def set_password(self, servicename, username, password): |
| 289 |
pass |
| 290 |
|
| 291 |
def get_password(self, servicename, username): |
| 292 |
return "password from TestKeyring" |
| 293 |
|
| 294 |
def delete_password(self, servicename, username): |
| 295 |
pass |
| 296 |
|
| 297 |
# set the keyring for keyring lib |
| 298 |
keyring.set_keyring(TestKeyring()) |
| 299 |
|
| 300 |
# invoke the keyring lib |
| 301 |
try: |
| 302 |
keyring.set_password("demo-service", "tarek", "passexample") |
| 303 |
print("password stored successfully") |
| 304 |
except keyring.errors.PasswordSetError: |
| 305 |
print("failed to store password") |
| 306 |
print("password", keyring.get_password("demo-service", "tarek")) |
| 307 |
|
| 308 |
|
| 309 |
Disabling Keyring |
| 310 |
================= |
| 311 |
|
| 312 |
In many cases, uninstalling keyring will never be necessary. |
| 313 |
Especially on Windows and macOS, the behavior of keyring is |
| 314 |
usually degenerate, meaning it will return empty values to |
| 315 |
the caller, allowing the caller to fall back to some other |
| 316 |
behavior. |
| 317 |
|
| 318 |
In some cases, the default behavior of keyring is undesirable and |
| 319 |
it would be preferable to disable the keyring behavior altogether. |
| 320 |
There are several mechanisms to disable keyring: |
| 321 |
|
| 322 |
- Uninstall keyring. Most applications are tolerant to keyring |
| 323 |
not being installed. Uninstalling keyring should cause those |
| 324 |
applications to fall back to the behavior without keyring. |
| 325 |
This approach affects the Python environment where keyring |
| 326 |
would otherwise have been installed. |
| 327 |
|
| 328 |
- Configure the Null keyring in the environment. Set |
| 329 |
``PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring`` |
| 330 |
in the environment, and the ``Null`` (degenerate) backend |
| 331 |
will be used. This approach affects all uses of Keyring where |
| 332 |
that variable is set. |
| 333 |
|
| 334 |
- Permanently configure the Null keyring for the user by running |
| 335 |
``keyring --disable`` or ``python -m keyring --disable``. |
| 336 |
This approach affects all uses of keyring for that user. |
| 337 |
|
| 338 |
|
| 339 |
Altering Keyring Behavior |
| 340 |
========================= |
| 341 |
|
| 342 |
Keyring provides a mechanism to alter the keyring's behavior through |
| 343 |
environment variables. Each backend implements a |
| 344 |
``KeyringBackend.set_properties_from_env``, which |
| 345 |
when invoked will find all environment variables beginning with |
| 346 |
``KEYRING_PROPERTY_{NAME}`` and will set a property for each |
| 347 |
``{NAME.lower()}`` on the keyring. This method is invoked during |
| 348 |
initialization for the default/configured keyring. |
| 349 |
|
| 350 |
This mechanism may be used to set some useful values on various |
| 351 |
keyrings, including: |
| 352 |
|
| 353 |
- keychain; macOS, path to an alternate keychain file |
| 354 |
- appid; Linux/SecretService, alternate ID for the application |
| 355 |
|
| 356 |
|
| 357 |
Using Keyring on Ubuntu 16.04 |
| 358 |
============================= |
| 359 |
|
| 360 |
The following is a complete transcript for installing keyring in a |
| 361 |
virtual environment on Ubuntu 16.04. No config file was used:: |
| 362 |
|
| 363 |
$ sudo apt install python3-venv libdbus-glib-1-dev |
| 364 |
$ cd /tmp |
| 365 |
$ pyvenv py3 |
| 366 |
$ source py3/bin/activate |
| 367 |
$ pip install -U pip |
| 368 |
$ pip install secretstorage dbus-python |
| 369 |
$ pip install keyring |
| 370 |
$ python |
| 371 |
>>> import keyring |
| 372 |
>>> keyring.get_keyring() |
| 373 |
<keyring.backends.SecretService.Keyring object at 0x7f9b9c971ba8> |
| 374 |
>>> keyring.set_password("system", "username", "password") |
| 375 |
>>> keyring.get_password("system", "username") |
| 376 |
'password' |
| 377 |
|
| 378 |
|
| 379 |
Using Keyring on headless Linux systems |
| 380 |
======================================= |
| 381 |
|
| 382 |
It is possible to use the SecretService backend on Linux systems without |
| 383 |
X11 server available (only D-Bus is required). In this case: |
| 384 |
|
| 385 |
* Install the `GNOME Keyring`_ daemon. |
| 386 |
* Start a D-Bus session, e.g. run ``dbus-run-session -- sh`` and run |
| 387 |
the following commands inside that shell. |
| 388 |
* Run ``gnome-keyring-daemon`` with ``--unlock`` option. The description of |
| 389 |
that option says: |
| 390 |
|
| 391 |
Read a password from stdin, and use it to unlock the login keyring |
| 392 |
or create it if the login keyring does not exist. |
| 393 |
|
| 394 |
When that command is started, enter a password into stdin and |
| 395 |
press Ctrl+D (end of data). After that, the daemon will fork into |
| 396 |
the background (use ``--foreground`` option to block). |
| 397 |
* Now you can use the SecretService backend of Keyring. Remember to |
| 398 |
run your application in the same D-Bus session as the daemon. |
| 399 |
|
| 400 |
.. _GNOME Keyring: https://wiki.gnome.org/Projects/GnomeKeyring |
| 401 |
|
| 402 |
Using Keyring on headless Linux systems in a Docker container |
| 403 |
============================================================= |
| 404 |
|
| 405 |
It is possible to use keyring with the SecretService backend in Docker containers as well. |
| 406 |
All you need to do is install the necessary dependencies and add the `--privileged` flag |
| 407 |
to avoid any `Operation not permitted` errors when attempting to unlock the system's keyring. |
| 408 |
|
| 409 |
The following is a complete transcript for installing keyring on a Ubuntu 18:04 container:: |
| 410 |
|
| 411 |
docker run -it -d --privileged ubuntu:18.04 |
| 412 |
|
| 413 |
$ apt-get update |
| 414 |
$ apt install -y gnome-keyring python3-venv python3-dev |
| 415 |
$ python3 -m venv venv |
| 416 |
$ source venv/bin/activate # source a virtual environment to avoid polluting your system |
| 417 |
$ pip3 install --upgrade pip |
| 418 |
$ pip3 install keyring |
| 419 |
$ dbus-run-session -- sh # this will drop you into a new D-bus shell |
| 420 |
$ echo 'somecredstorepass' | gnome-keyring-daemon --unlock # unlock the system's keyring |
| 421 |
|
| 422 |
$ python |
| 423 |
>>> import keyring |
| 424 |
>>> keyring.get_keyring() |
| 425 |
<keyring.backends.SecretService.Keyring object at 0x7f9b9c971ba8> |
| 426 |
>>> keyring.set_password("system", "username", "password") |
| 427 |
>>> keyring.get_password("system", "username") |
| 428 |
'password' |
| 429 |
|
| 430 |
Using Keyring with tox |
| 431 |
====================== |
| 432 |
|
| 433 |
Some backends rely on environment variables to operate correctly, and ``tox`` filters most environment variables by default. |
| 434 |
|
| 435 |
For example, when using Keyring to store credentials for pip, one may encounter the following error when |
| 436 |
running tests under ``tox`` when using a backend reliant on D-Bus: |
| 437 |
|
| 438 |
RuntimeError: No recommended backend was available. Install the keyrings.alt package if you want to use the non-recommended backends. See README.rst for details. |
| 439 |
|
| 440 |
This error is caused by Keyring KWallet backend not able to resolve the backing service. |
| 441 |
|
| 442 |
To work around the issue, add ``DBUS_SESSION_BUS_ADDRESS`` to ``pass_env`` in the |
| 443 |
``tox`` configuration. Consider adding other necessary variables, such as ``DISPLAY`` and ``WAYLAND_DISPLAY`` (if using ``pinentry``). |
| 444 |
|
| 445 |
Integration |
| 446 |
=========== |
| 447 |
|
| 448 |
API |
| 449 |
--- |
| 450 |
|
| 451 |
The keyring lib has a few functions: |
| 452 |
|
| 453 |
* ``get_keyring()``: Return the currently-loaded keyring implementation. |
| 454 |
* ``get_password(service, username)``: Returns the password stored in the |
| 455 |
active keyring. If the password does not exist, it will return None. |
| 456 |
* ``get_credential(service, username)``: Return a credential object stored |
| 457 |
in the active keyring. This object contains at least ``username`` and |
| 458 |
``password`` attributes for the specified service, where the returned |
| 459 |
``username`` may be different from the argument. |
| 460 |
* ``set_password(service, username, password)``: Store the password in the |
| 461 |
keyring. |
| 462 |
* ``delete_password(service, username)``: Delete the password stored in |
| 463 |
keyring. If the password does not exist, it will raise an exception. |
| 464 |
|
| 465 |
In all cases, the parameters (``service``, ``username``, ``password``) |
| 466 |
should be Unicode text. |
| 467 |
|
| 468 |
|
| 469 |
Exceptions |
| 470 |
---------- |
| 471 |
|
| 472 |
The keyring lib raises the following exceptions: |
| 473 |
|
| 474 |
* ``keyring.errors.KeyringError``: Base Error class for all exceptions in keyring lib. |
| 475 |
* ``keyring.errors.InitError``: Raised when the keyring cannot be initialized. |
| 476 |
* ``keyring.errors.PasswordSetError``: Raised when the password cannot be set in the keyring. |
| 477 |
* ``keyring.errors.PasswordDeleteError``: Raised when the password cannot be deleted in the keyring. |
| 478 |
|
| 479 |
Get Involved |
| 480 |
============ |
| 481 |
|
| 482 |
Python keyring lib is an open community project and eagerly |
| 483 |
welcomes contributors. |
| 484 |
|
| 485 |
* Repository: https://github.com/jaraco/keyring/ |
| 486 |
* Bug Tracker: https://github.com/jaraco/keyring/issues/ |
| 487 |
* Mailing list: http://groups.google.com/group/python-keyring |
| 488 |
|
| 489 |
Security Considerations |
| 490 |
======================= |
| 491 |
|
| 492 |
Each built-in backend may have security considerations to understand |
| 493 |
before using this library. Authors of tools or libraries utilizing |
| 494 |
``keyring`` are encouraged to consider these concerns. |
| 495 |
|
| 496 |
As with any list of known security concerns, this list is not exhaustive. |
| 497 |
Additional issues can be added as needed. |
| 498 |
|
| 499 |
- macOS Keychain |
| 500 |
- Any Python script or application can access secrets created by |
| 501 |
``keyring`` from that same Python executable without the operating |
| 502 |
system prompting the user for a password. To cause any specific |
| 503 |
secret to prompt for a password every time it is accessed, locate |
| 504 |
the credential using the ``Keychain Access`` application, and in |
| 505 |
the ``Access Control`` settings, remove ``Python`` from the list |
| 506 |
of allowed applications. |
| 507 |
|
| 508 |
- Freedesktop Secret Service |
| 509 |
- No analysis has been performed |
| 510 |
|
| 511 |
- KDE4 & KDE5 KWallet |
| 512 |
- No analysis has been performed |
| 513 |
|
| 514 |
- Windows Credential Locker |
| 515 |
- No analysis has been performed |
| 516 |
|
| 517 |
Making Releases |
| 518 |
=============== |
| 519 |
|
| 520 |
This project makes use of automated releases and continuous |
| 521 |
integration. The |
| 522 |
simple workflow is to tag a commit and push it to Github. If it |
| 523 |
passes tests in CI, it will be automatically deployed to PyPI. |
| 524 |
|
| 525 |
Other things to consider when making a release: |
| 526 |
|
| 527 |
- Check that the changelog is current for the intended release. |
| 528 |
|
| 529 |
Running Tests |
| 530 |
============= |
| 531 |
|
| 532 |
Tests are continuously run in Github Actions. |
| 533 |
|
| 534 |
To run the tests locally, install and invoke |
| 535 |
`tox <https://pypi.org/project/tox>`_. |
| 536 |
|
| 537 |
Background |
| 538 |
========== |
| 539 |
|
| 540 |
The project was based on Tarek Ziade's idea in `this post`_. Kang Zhang |
| 541 |
initially carried it out as a `Google Summer of Code`_ project, and Tarek |
| 542 |
mentored Kang on this project. |
| 543 |
|
| 544 |
.. _this post: http://tarekziade.wordpress.com/2009/03/27/pycon-hallway-session-1-a-keyring-library-for-python/ |
| 545 |
.. _Google Summer of Code: http://socghop.appspot.com/ |
| 546 |
|
| 547 |
For Enterprise |
| 548 |
============== |
| 549 |
|
| 550 |
Available as part of the Tidelift Subscription. |
| 551 |
|
| 552 |
This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use. |
| 553 |
|
| 554 |
`Learn more <https://tidelift.com/subscription/pkg/pypi-keyring?utm_source=pypi-keyring&utm_medium=referral&utm_campaign=github>`_. |