Skip to main content

envpact (Python)

PyPI version Python License: MIT CI

Zero-dependency Python module for envpact — a centralized, serverless, Git-backed secrets manager for solo developers.

Read & write the same vault that envpact-cli, envpact-mcp, and envpact-vscode use. Identical semantics, native Python API.

Part of the envpact ecosystem.

Installation

pip install envpact

Python 3.10+. No runtime dependencies — just stdlib.

Quick Start

If you don't have a vault yet, bootstrap it once with the Node CLI:

npx envpact-cli --init auto

Then use Python directly:

from envpact import EnvPact

pact = EnvPact()
pact.generate_env()                 # writes .env for the current project
pact.add_shared("OPENAI_API_KEY", "sk-…")
pact.rotate("OPENAI_API_KEY", "sk-new")
pact.sync_github(project_name="my-app")

CLI

The package also ships a thin CLI mirroring envpact-cli:

python -m envpact          # generate .env
python -m envpact --list   # list projects
python -m envpact --rotate OPENAI_API_KEY

After installation, the envpact script is also on your $PATH.

API

EnvPact(...)

EnvPact(
    *,
    vault_file: Path | str | None = None,
    secrets_dir: Path | str | None = None,
    project_name: str | None = None,
    environment: str | None = None,
    auto_pull: bool = True,
    auto_push: bool = True,
)

Methods

Method Returns
resolve(project_name=None, environment=None) dict with resolved, unresolved, invalid, environment, missing
generate_env(...) dict with output_path, resolved_count, missing
list_projects() list[str]
list_shared() list[str] (names only)
list_environments(project_name) list[str]
add_secret(project, key, value, environment=None) push status
add_shared(key, value) push status
rotate(key, new_value) references + push status
sync_github(...) sync stats
pull() / push(message) git result

Resolver helpers

from envpact import resolve_project, resolve_string, list_project_environments

# Pure functions over a parsed vault dict — useful for tests.
result = resolve_project(vault_dict, "my-app", "production")

Vault Schema

Identical to envpact-cli — see SHARED_SPEC §1.

Security

  • Vault values are read directly from the user's local clone at ~/.envpact/secrets/. Nothing is ever sent to a third party.
  • list_shared() returns names only.
  • .env files are written with mode 0600 where the OS supports it.
  • All vault commits are signed-off (-s).

License

MIT © Chirag Singhal — see LICENSE.

Release files for envpact 0.2.0

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

Source distribution (sdist)

Source distribution for envpact 0.2.0
File Size Uploaded
envpact-0.2.0.tar.gz 15.7 kB Details

Built distribution (wheel)

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

Total release size: 30.9 kB

Release files / envpact-0.2.0.tar.gz

Download URL envpact-0.2.0.tar.gz
Size 15.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fa27c6344847b7bd2150ad41b41e0c4acb2d566775dab699685a0cd26e1dd397
BLAKE2b-256 checksum
How to use checksums
e1c78fb241710907eaca1c1ce04e29805c103d102a74fa067b2d97099a142847
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / envpact-0.2.0-py3-none-any.whl

Download URL envpact-0.2.0-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0789185ee00718f600009f5a8dd9444cbadce35983efee17bb2083b4227dbaa2
BLAKE2b-256 checksum
How to use checksums
7c2a82567ef8ab174e1fe3b9279eba3e159ac4399b1b1b37415f11e39da0ee98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.2.0 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