Catalog PyPI
PACKAGE EXPLORERView in registry

1password-cli

PyPI

Python wrapper around the 1Password CLI with Pydantic Settings integration

1passwordclipydanticsecretssettings
Versions collected1
Direct dependencies2From release 0.0.1
Last observed20 Oct, 15:16 UTC

README

Version 0.0.1 documentation

1Password CLI Python Wrapper

PyPI version Python Support License: MIT CI/CD Coverage

Python wrapper for 1Password CLI with Pydantic Settings integration. Automatically injects secrets from op:// references while preserving types.

Features

  • Automatic secret injection with op:// reference detection
  • Pydantic Settings integration with pre-validation injection
  • Type preservation (int, float, bool, None, lists)
  • Full type hints with py.typed marker
  • Performance optimized (skips CLI calls when no secrets detected)
  • Timeout protection and clear error messages

Installation

pip install 1password-cli

Prerequisites: 1Password CLI installed and authenticated (op signin)

Usage

String injection:

from scottzach1.onepassword_cli import inject_string_1password

password = inject_string_1password("op://vault/database/password")

Dictionary injection:

from scottzach1.onepassword_cli import inject_dictionary_1password

config = {
    "database_url": "op://vault/database/url",
    "api_key": "op://vault/api/key",
    "port": 5432,  # Non-secret values preserved
}
injected = inject_dictionary_1password(config)

Pydantic Settings:

from scottzach1.onepassword_cli import OnePasswordSettings

class AppSettings(OnePasswordSettings):
    database_url: str = "op://vault/database/url"
    api_key: str = "op://vault/api/key"
    port: int = 8080

settings = AppSettings()  # Secrets injected automatically

API

  • inject_string_1password(value, check_cli=True) - Inject secrets into a string
  • inject_dictionary_1password(data, check_cli=True, in_place=False) - Inject secrets into a dictionary
  • OnePasswordSettings - Pydantic Settings base class with automatic injection

See docstrings for parameters and exceptions.

Development

# Setup
uv sync --dev && uv run pre-commit install

# Test
uv run pytest tests/ -v -m "not integration"
uv run coverage run -m pytest tests/ -m "not integration"

# Lint/Format
uv run ruff check src/ tests/ --fix
uv run ruff format src/ tests/

License

MIT License - see LICENSE file.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.0.123 Jan 20262

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
scottzach1/1password-python

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 15:16 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:e485bcbe080b144ac8a54c17c2cd1c645f06caffbf9659b4ad4dcd33d8f0414d