Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

PyPI version 1password-secrets

1password-secrets

PyPI version 1password-secrets CI/CD

1password-secrets is a CLI utility to sync 1Password secrets (env files). It enables:

  • Seamless sharing of local secrets used for development. Developers starting out in a project can just use this tool to retrieve the .env file needed for local development. Likewise it is also simple to push back any local changes to the 1password vault.

  • More secure and simpler method of managing Fly.io secrets. By default, Fly secrets must be managed by flyctl. This means that setting secrets in production, developers must use flyctl passing credentials via arguments - risking credentials being stored in their histories. Alternatively one must secrets in a file and run flyctl secrets import. This works well, but you must ensure everything is synched to a secret/password manager and then delete the file. 1password-secrets enables a leaner management of secrets via 1password. Passing a fly app name, it automatically finds and imports secrets in an 1password to Fly. This way you ensure developers always keep secrets up-to-date and never in files on disk.

Motivation: Using 1password avoids the need for another external secret management tool and keeps the access control in a centralised place that we already use.

Getting started

Requirements

  • Install the required dependencies:

    1Password >= 8.9.13

    1Password CLI >= 2.13.1

    Python >= 3.10

    flyctl >= 0.0.451 (optional)

    brew install --cask 1password 1password-cli && \
    brew install flyctl
    

    More information and installation instructions for other systems can be found in the 1password documentation.

  • Allow 1Password to connect to 1Password-CLI by going to Settings -> Developer -> Command-Line Interface (CLI) and select Connect with 1Password CLI.

  • Sign into your 1Password desktop and if you wish to use the fly integration, also make sure the CLI is authenticated.

Installation

In order to keep your system tidy and without conflicts in your global and user packages, we recommend pipx:

pipx install 1password-secrets

This should do the trick for all systems. Adapt the installation command to fit your and preferred tool.

Use pipx upgrade 1password-secrets to update to the latest release.

Usage

Local

1password-secrets will allow you to create, pull and push secrets to a 1password secure note with repo:<owner>/<repo> or local:<dir-basename> in its name. repo is used when within a valid git repository with remote "origin" set.

The remote name can be changed with the --remote switch if you use a different remote (e.g. upstream)

By default it syncs to ./.env file, this can overridden with a file_name field in 1password containing the desired relative file path.

By default it searches items across 1password vaults. Restrict the search to a single vault with the --vault switch.

  • To bootstrap a 1Password secret matching the current repo/directory, run: 1password-secrets local create ./env
    Where ./env is an existing file you with to use.

  • To get secrets from 1Password, run: 1password-secrets local pull

  • To push the local changes to 1Password, run: 1password-secrets local push

Fly

Make sure you have a Secure Note in 1Password with fly:<fly-app-name> in the title. fly-app-name is the name of your fly application.

As with Local secrets above, you can specify a single 1Password vault by name or id with the --vault option.

  • To import secrets to fly, run: 1password-secrets fly import <fly-app-name>

  • Secrets can be edited directly on 1Password app or using the command: 1password-secrets fly edit <fly-app-name>

Development

  • Ensure you have make installed.
  • Create a virtual environment: make setup-venv.
  • Activate the virtual environment: source ./venv/bin/activate.
  • Install dependencies: make install-deps.

Then you can install (link) the repo globally with make local-install.

Before pushing changes ensure your code is properly formatted with make lint. Auto format the code with make format

Metadata

Release files for 1password-secrets 0.0.1.dev135

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

Source distribution (sdist)

Source distribution for 1password-secrets 0.0.1.dev135
File Size Uploaded
1password-secrets-0.0.1.dev135.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for 1password-secrets 0.0.1.dev135
File Interpreter ABI Platform
1password_secrets-0.0.1.dev135-py3-none-any.whl Python 3 none any Details

Total release size: 17.9 kB

Release files / 1password-secrets-0.0.1.dev135.tar.gz

Download URL 1password-secrets-0.0.1.dev135.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
894506686d80338b59ef130e10685005f5083c3780f144231f5dbb03e626054f
BLAKE2b-256 checksum
How to use checksums
87fabb2666d67ac2850bd2e7b6524f71490839ed945167c717d4a6a1e0642e21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.11

Release files / 1password_secrets-0.0.1.dev135-py3-none-any.whl

Download URL 1password_secrets-0.0.1.dev135-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
effeaa27daff41bfba3ce92dd6e4219298befad961b96c43417ad171ad868b08
BLAKE2b-256 checksum
How to use checksums
3984735af34eb17147667313e0ed5f08b150a16b60a95fd3afea2b1e25991490
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.11

Release history Release notifications | RSS feed

0.7.0

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

This release

0.0.1.dev135 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