Skip to main content

Clarence

A package for working with pass. It allows you to fetch and list secrets stored in the password store. It's named for an excellent passer.

Installation

Before using Clarence please ensure you have the pass command-line tool installed and properly configured.

Then using the package is simply:

# If using uv
uv add clarence

# Or with pip
pip install clarence

Usage

Fetching a secret

To fetch a secret from your password store:

from clarence import get_secret
secret = get_secret("path/to/secret")

The result of get_secret is an object of class Secret: this is basically just a regular str but with a print method that obscures the secret if you happen to print it to the console. While this helps make it harder to reveal a secret, you still must take care.

When you want to use your secret you need to use the reveal method. This makes it obvious when your code is using the unobscured secret.

connection_string = f"mssql+pymssql://1234567:{secret.reveal()}@example.com/testingdb"

Listing secrets

You can view all available secrets:

from clarence import list_secrets
list_secrets()

The result is a SecretsList object, which will print in the same way as the pass command-line utility.

Documentation

Functions

get_secret(path: str) -> Secret

Fetches a secret from the password store.

  • Args:
    • path (str): The path to the secret in the password store.
  • Returns:
    • Secret: The retrieved secret.

list_secrets() -> SecretsList

Lists all the secrets in the password store.

  • Returns:
    • SecretsList: An object containing the list of secrets.

Classes

Secret

Represents a secret as a string, obscured when printing.

  • Methods:
    • __init__(value: str): Initializes the secret with its actual value.
    • __str__() -> str: Returns an obscured string representation of the secret.
    • __repr__() -> str: Returns an obscured string representation for debugging.
    • __format__(format_spec: str) -> str: Returns the actual secret value when used in formatted strings.
    • reveal() -> str: Returns the actual secret value as a string.

SecretsList

Represents a list of secrets.

  • Methods:
    • __init__(tree: str): Initializes the SecretsList with a tree structure.
    • __str__() -> str: Returns the string representation of the tree.
    • __repr__() -> str: Returns the string representation of the tree for debugging.

Metadata

Release files for clarence 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clarence 0.2.1
File Size Uploaded
clarence-0.2.1.tar.gz 28.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clarence 0.2.1
File Interpreter ABI Platform
clarence-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 31.1 kB

Release files / clarence-0.2.1.tar.gz

Download URL clarence-0.2.1.tar.gz
Size 28.2 kB
Tags Source
SHA-256 checksum
How to use checksums
14fd0aa64e4b8f4c5b0830eb3c0ce2af8bcfeaf371e93f66c455a3cecf2e8c1f
BLAKE2b-256 checksum
How to use checksums
993930961de7cbdb9b8b79a59a22c9a80da7d90d9923c5327914650ef51417bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.17

Release files / clarence-0.2.1-py3-none-any.whl

Download URL clarence-0.2.1-py3-none-any.whl
Size 2.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
acb8573a21c6ac8a96a31261bb16295ed4178d55f7b417e8e96867097658f8b9
BLAKE2b-256 checksum
How to use checksums
7451d5c272ed8d9dfcd1a91e4f00e915c4630d40c0ae9c167c59bf68c382a9a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.17

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page