{"id":2556,"library":"keyrings-alt","title":"Keyrings-alt","description":"Keyrings-alt is a Python package that provides alternative backend implementations for the `keyring` library, enabling password storage solutions across various environments. It's currently at version 5.0.2 and maintains an active release cadence, often aligning with `keyring` library updates.","status":"active","version":"5.0.2","language":"en","source_language":"en","source_url":"https://github.com/jaraco/keyrings.alt","tags":["keyring","security","password-management","backend","plugin","credentials"],"install":[{"cmd":"pip install keyrings-alt","lang":"bash","label":"Install keyrings-alt"}],"dependencies":[{"reason":"keyrings-alt provides backend implementations for the `keyring` library; `keyring` is the primary interface users interact with.","package":"keyring","optional":false}],"imports":[{"note":"While `keyrings.alt` primarily provides backend plugins that are automatically discovered by the `keyring` library, specific backend classes (like `FileKeyring`) can be imported directly for advanced use cases, such as explicit instantiation or testing.","symbol":"FileKeyring","correct":"from keyrings.alt.file import FileKeyring"}],"quickstart":{"code":"import keyring\nimport os\n\n# keyrings-alt, once installed, provides additional backends\n# that the 'keyring' library automatically discovers and uses.\n\nservice_name = \"my-app-service\"\nusername = \"test-user\"\npassword = os.environ.get('KEYRING_TEST_PASSWORD', 'super-secret-password-123')\n\nprint(f\"Using keyring for service '{service_name}', user '{username}'.\")\n\n# Set a password. The 'keyring' library will try to use the best available backend,\n# which might be one provided by keyrings-alt if no stronger native keyring is present.\nkeyring.set_password(service_name, username, password)\nprint(f\"Password set for service '{service_name}' user '{username}'.\")\n\n# Retrieve the password\nretrieved_password = keyring.get_password(service_name, username)\n\nprint(f\"Retrieved password: {'*' * len(retrieved_password) if retrieved_password else 'None'}\")\n\nif retrieved_password == password:\n    print(\"Password retrieved successfully and matches original.\")\nelse:\n    print(\"Password retrieval failed or did not match.\")\n\n# You can inspect the currently active keyring backend\ncurrent_keyring = keyring.get_keyring()\nprint(f\"\\nCurrently active keyring backend: {current_keyring.__class__.__name__}\")","lang":"python","description":"This quickstart demonstrates how `keyrings-alt` integrates with the `keyring` library. Once `keyrings-alt` is installed, its alternative backends become available for `keyring` to discover and use automatically. The example shows setting and retrieving a password, and identifying the active keyring backend."},"warnings":[{"fix":"Upgrade to Python 3.8 or a later version, or use an older `keyrings-alt` version (e.g., `pip install 'keyrings-alt<4.0.0'`) if your project can't upgrade Python.","message":"`keyrings-alt` v4.0.0 and later require Python 3.8 or newer. Previous versions supported older Python environments.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Ensure your `keyring` installation is version 24.0.0 or higher. If you have dependency conflicts, resolve them by updating other packages or pinning `keyring` to a compatible version.","message":"`keyrings-alt` v5.0.0 and later explicitly require `keyring` library version 24.0.0 or newer. Installing `keyrings-alt` might automatically upgrade `keyring`.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"For most use cases, simply `import keyring` and use its functions. `keyrings-alt` is a dependency that provides the backend implementations for `keyring` to discover.","message":"Users typically interact with `keyrings-alt` indirectly through the `keyring` library's API (e.g., `keyring.set_password`, `keyring.get_password`). Direct imports from `keyrings.alt` are generally for advanced scenarios like explicit backend instantiation.","severity":"gotcha","affected_versions":"all"},{"fix":"Understand the security model of the specific keyring backend being used. Avoid using less secure backends (like `FileKeyring` for sensitive data) in production environments unless explicitly required and mitigated.","message":"Different backends provided by `keyrings-alt` (e.g., `FileKeyring`, `NullKeyring`) have varying security implications. Some backends, like `FileKeyring`, store credentials in plaintext or in less secure ways than system-native keyrings.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}