Install & Compatibility
Where this runs
tested against v1.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 116.4MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 4.4s · import 0.000s · 117MB
114MB installed
● package 114MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
No direct user-facing symbols for core functionality
✓ Functionality is automatically registered with `keyring` upon installation.
✗ from artifacts_keyring import AzureArtifactsKeyringBackend
artifacts-keyring acts as a backend for the `keyring` library, automatically intercepting credential requests for Azure Artifacts feeds. Users primarily interact with `keyring` itself, rather than importing directly from artifacts_keyring.
This quickstart demonstrates how to verify that `artifacts-keyring` has registered itself as a backend with the `keyring` library, and how to programmatically attempt to retrieve credentials. Note that actual credential retrieval for an Azure Artifacts feed requires an active Azure login session (e.g., via `az login`) and a configured feed.
import os
import subprocess
import sys
import keyring
print("--- Verifying artifacts-keyring installation and backend ---")
try:
# Run keyring's CLI to list backends and verify registration
print("Listing available keyring backends...")
result = subprocess.run(
[sys.executable, "-m", "keyring", "--list-backends"],
capture_output=True, text=True, check=True, encoding="utf-8"
)
print("Available Keyring Backends:")
print(result.stdout)
if "Azure Artifacts Keyring Backend" in result.stdout:
print("SUCCESS: Azure Artifacts Keyring Backend found in the list!")
else:
print("WARNING: Azure Artifacts Keyring Backend NOT found in the listed backends.")
print("\n--- Demonstrating keyring interaction (requires Azure Artifacts setup) ---")
# Example of how keyring *would* be used to retrieve a password for an Azure Artifacts service.
# Note: This will likely prompt for credentials or return None if no Azure Artifacts
# feed is configured in your environment that matches the service_name.
# It demonstrates the interaction point, not necessarily a successful auth without setup.
# Use an example Azure Artifacts service name (replace with your actual feed if testing)
# The exact service name format might vary slightly depending on the tool/context,
# but generally involves the feed URL or identifier.
service_name = "https://pkgs.dev.azure.com/your_org/_packaging/your_feed/nuget/v3/index.json"
username = "artifact_username" # artifacts-keyring often handles username automatically or it's 'token'
# Set ARTIFACTS_KEYRING_DISABLE_PROMPT to avoid interactive prompts in automated tests
os.environ['ARTIFACTS_KEYRING_DISABLE_PROMPT'] = '1'
print(f"Attempting to retrieve password for service: {service_name}")
password = keyring.get_password(service_name, username)
if password:
print(f"Successfully retrieved password for '{service_name}' (first 5 chars): {password[:5]}...")
else:
print(f"No password retrieved for '{service_name}'.")
print("This is expected if you are not currently logged into Azure Artifacts")
print("or if this specific service name is not configured for automatic credential retrieval.")
print("To test further, ensure you have an active Azure login (e.g., `az login`) ")
print("and try to access an Azure Artifacts feed via a tool that uses keyring (e.g., pip, twine).")
except ImportError:
print("ERROR: 'keyring' not found. Please ensure 'artifacts-keyring' (which depends on 'keyring') is installed.")
except subprocess.CalledProcessError as e:
print(f"ERROR: Failed to run keyring CLI. Return code: {e.returncode}\nStdout: {e.stdout}\nStderr: {e.stderr}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
Upgrade
Version history
1.0.0latest on PyPI · released Aug 13, 2025
Audit
Dependencies
keyringrequiredCore dependency; this library is a backend for keyring.