From a36768d3420612639c7dc771f767c2d034edba61 Mon Sep 17 00:00:00 2001 From: Ben Gruber Date: Wed, 6 Aug 2025 13:09:28 +0000 Subject: [PATCH 1/4] Add instructions for Keyring with tox for pip Adds instructions to the Readme for how to deal with issues when using Keyring with tox for pip credentials. See #283 for context. --- README.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.rst b/README.rst index 8141f082..81b36920 100644 --- a/README.rst +++ b/README.rst @@ -379,6 +379,20 @@ The following is a complete transcript for installing keyring on a Ubuntu 18:04 >>> keyring.get_password("system", "username") 'password' +Using Keyring with tox on Linux systems for pip credentials +============================================================= + +When using Keyring to store credentials for pip, you may encounter the following error when +running tests under ``tox``: + + 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. + +This can be caused by Keyring not knowing where D-Bus is located, as ``tox`` does not pass +through the required environment variables. +This can be resolved by adding ``DBUS_SESSION_BUS_ADDRESS`` to ``pass_env`` in your +``tox`` configuration. You may additionally need to add ``DISPLAY`` and ``WAYLAND_DISPLAY`` +to ``pass_env`` for ``pinentry`` to get confirmation. + Integration =========== From 27cb77f60bb3f5e735bcc4918449a626ff45bc3f Mon Sep 17 00:00:00 2001 From: Ben Gruber Date: Wed, 6 Aug 2025 13:14:14 +0000 Subject: [PATCH 2/4] Fix wording and extra spaces --- README.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 81b36920..0c1b94d6 100644 --- a/README.rst +++ b/README.rst @@ -382,16 +382,17 @@ The following is a complete transcript for installing keyring on a Ubuntu 18:04 Using Keyring with tox on Linux systems for pip credentials ============================================================= -When using Keyring to store credentials for pip, you may encounter the following error when +When using Keyring to store credentials for pip, you may encounter the following error when running tests under ``tox``: 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. -This can be caused by Keyring not knowing where D-Bus is located, as ``tox`` does not pass -through the required environment variables. +This can be caused by Keyring not knowing the address for D-Bus, as ``tox`` does not pass +through the required environment variables by default. + This can be resolved by adding ``DBUS_SESSION_BUS_ADDRESS`` to ``pass_env`` in your ``tox`` configuration. You may additionally need to add ``DISPLAY`` and ``WAYLAND_DISPLAY`` -to ``pass_env`` for ``pinentry`` to get confirmation. +to ``pass_env`` to enable ``pinentry`` to get confirmation. Integration =========== From e7fbfa76a1f675bede0f5654e99add3a0cd66370 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 16 Nov 2025 10:59:30 -0500 Subject: [PATCH 3/4] Prefer imperative third-person voice. --- README.rst | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index 0c1b94d6..d4a2f4f0 100644 --- a/README.rst +++ b/README.rst @@ -379,20 +379,19 @@ The following is a complete transcript for installing keyring on a Ubuntu 18:04 >>> keyring.get_password("system", "username") 'password' -Using Keyring with tox on Linux systems for pip credentials -============================================================= +Using Keyring with tox on Linux systems for pip credentials +=========================================================== -When using Keyring to store credentials for pip, you may encounter the following error when +When using Keyring to store credentials for pip, one may encounter the following error when running tests under ``tox``: 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. -This can be caused by Keyring not knowing the address for D-Bus, as ``tox`` does not pass -through the required environment variables by default. +This error is caused by Keyring not knowing the address for D-Bus, as ``tox`` filters +by default the required environment variables. -This can be resolved by adding ``DBUS_SESSION_BUS_ADDRESS`` to ``pass_env`` in your -``tox`` configuration. You may additionally need to add ``DISPLAY`` and ``WAYLAND_DISPLAY`` -to ``pass_env`` to enable ``pinentry`` to get confirmation. +To work around the issue, add ``DBUS_SESSION_BUS_ADDRESS`` to ``pass_env`` in the +``tox`` configuration. Consider adding other necessary variables, such as ``DISPLAY`` and ``WAYLAND_DISPLAY`` (if using ``pinentry``). Integration =========== From 9ff845920c4c72031343b17c6a3d605e6247f081 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 16 Nov 2025 11:04:33 -0500 Subject: [PATCH 4/4] Generalize the guidance around tox. --- README.rst | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index d4a2f4f0..5bfae91f 100644 --- a/README.rst +++ b/README.rst @@ -379,16 +379,17 @@ The following is a complete transcript for installing keyring on a Ubuntu 18:04 >>> keyring.get_password("system", "username") 'password' -Using Keyring with tox on Linux systems for pip credentials -=========================================================== +Using Keyring with tox +====================== -When using Keyring to store credentials for pip, one may encounter the following error when -running tests under ``tox``: +Some backends rely on environment variables to operate correctly, and ``tox`` filters most environment variables by default. + +For example, when using Keyring to store credentials for pip, one may encounter the following error when +running tests under ``tox`` when using a backend reliant on D-Bus: 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. -This error is caused by Keyring not knowing the address for D-Bus, as ``tox`` filters -by default the required environment variables. +This error is caused by Keyring KWallet backend not able to resolve the backing service. To work around the issue, add ``DBUS_SESSION_BUS_ADDRESS`` to ``pass_env`` in the ``tox`` configuration. Consider adding other necessary variables, such as ``DISPLAY`` and ``WAYLAND_DISPLAY`` (if using ``pinentry``).