Skip to main content

No project description provided

Project description

prescribe

Declarative, idempotent config file management with rollback and conflict detection.

Write a TOML spec describing how your config files should look. Run prescribe apply. Done.

pip install prescribe

Commands

prescribe apply spec.toml            # Apply changes
prescribe apply spec.toml --dry-run  # Preview without writing
prescribe status spec.toml           # Show sync status of all targets
prescribe list                       # List all managed files
prescribe rollback path/to/file      # Roll back changes to a file

All commands accept --json for machine-readable output and --state (or PRESCRIBE_STATE env var) to set the state database path.

prescribe rollback accepts --on-conflict to control behaviour when a managed key was externally modified: prompt (default when stdin is a TTY), revert (always force-revert), or ignore (skip silently).


Spec format

A spec is a TOML file with one or more [[targets]] blocks.

[[targets]]
path = "~/.config/nvim/settings.json"
format = "jsonc"

[targets.data]
"editor.tabSize" = 2
"editor.formatOnSave" = true

[[targets]]
path = "~/.gitconfig"
format = "toml"
delete = ["core.autocrlf"]

[targets.data]
"core.editor" = "nvim"

[[targets]]
path = "~/.zshrc"
format = "line"
managed_block_id = "prescribe"
lines = [
  "export EDITOR=nvim",
  "alias ll='ls -lah'",
]

Target fields

Field Required Description
path yes Path to the config file (supports ~, env vars, and a paths fallback list)
format yes toml, yaml, jsonc, json5, or line
data no Key/value pairs to set (dot-notation keys for nested values)
delete no Keys to remove
lines no Lines to manage (requires format = "line")
managed_block_id no* Block identifier for line-format files (*required for line)
platforms no Limit to linux, macos, and/or windows
machine no Limit to specific hostnames (overridable via PRESCRIBE_MACHINE env var)

JSONC

prescribe includes a pure-Python JSONC round-trip parser that preserves comments and formatting. It is validated against Microsoft's node-jsonc-parser — the same parser used internally by VS Code — via an oracle test suite against real VS Code settings files.


To do

  • CLI integration testsCliRunner tests for apply, rollback (including --on-conflict), and status commands
  • Schema migration tests — exercise migrate() against a real DB with a prior schema version
  • Symlink awareness — detect and handle symlinked target paths correctly
  • File permission preservation — restore chmod bits on rollback (important for ~/.ssh/config etc.)
  • Spec compositioninclude one spec from another for large multi-machine dotfile repos
  • Pre/post hooks — run shell commands before/after apply (e.g. source ~/.bashrc, package installs)
  • Windows validation — CRLF handling, path resolution, and atomic writes need real Windows testing

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prescribe-0.1.1.tar.gz (28.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prescribe-0.1.1-py3-none-any.whl (38.9 kB view details)

Uploaded Python 3

File details

Details for the file prescribe-0.1.1.tar.gz.

File metadata

  • Download URL: prescribe-0.1.1.tar.gz
  • Upload date:
  • Size: 28.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for prescribe-0.1.1.tar.gz
Algorithm Hash digest
SHA256 871b5d059e824ed4b47c9614267a94c140d53c493c6d3ba27aa57c7feac6e557
MD5 cbe45fdf32e3e4730cabd4879d91b1d8
BLAKE2b-256 1733b4400080ea17cc3b26d7daf00a8c417f3f3d71eb226808e6a001e1e66374

See more details on using hashes here.

File details

Details for the file prescribe-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: prescribe-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 38.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for prescribe-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 989a23195d81c5f704849d0e95c6ac041550d58fbd3e132943ca1ae2c5f7d869
MD5 f9f89663e76a348c12cf6aed3748d227
BLAKE2b-256 ac3a7dcf7a5155430d9783fe9c11c11d94d1e60eb73470c195b8f49a6e41c82f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page