Skip to main content

pp

ci pypi license

A CLI kit for user & agents.

pp gathers the shell chores that come up when you work next to coding agents such as Claude Code on one Linux machine. Long jobs wait their turn for the GPU. An agent finds out how its job ended without anyone watching a terminal. The copy of a tool you use every day is one that passed its tests, not the one being edited.

Every command shows what it will do before it does it, and works the same when a person or an agent runs it. Try it queues a first job.

Features

  • pp queue runs commands later, in named queues. A job starts when the GPU memory, CPUs, RAM or counters it asks for are free, and it can have a timeout, retries and a hook for when it ends.
  • pp queue wait blocks until jobs end, then says how each one ended. An agent runs it in the background instead of polling.
  • pp promote releases a project from a git commit, tests the copy, and switches to it only if the tests pass.
  • pp kill stops processes by pid, port or pattern, and never the shell that asked.
  • pp batch renames files, or runs a command on each one, with a preview and undo.
  • pp http shows project folders in a browser, with markdown and code rendered.
  • pp memory finds, links and groups the notes of a memory that agents share.
  • pp cmd writes your own commands, and adds other people's from git.

pp needs no packages beyond Python itself, and it completes in zsh and bash.

How it works

Each command is one Python file. pp looks for them when it runs: its own in pp/commands/, yours in ~/.config/pp/commands/, the plugins you added with pp cmd add, and the folders listed in PP_PATH. A program named pp-NAME in one of those folders, pp's own aside, is a command too. The first one found wins, so a plugin cannot hide a built-in or one of yours. pp lists commands without loading them, so one broken command cannot break the others. pp help NAME prints a command's manual, with examples.

A command answers to its file's name, to a unique prefix of it, and to any name you give it with pp cmd alias.

Everything pp keeps is in plain files:

~/.config/pp/config.toml       settings, a table per command
~/.config/pp/commands/         your own commands
.pp.toml                       a project's settings, at its root
~/.local/state/pp/             queues, job logs, the rename journal
~/.local/share/pp/releases/    what pp promote released
~/.local/share/pp/plugins/     plugins, one git clone each

A queue has a worker, a background process that pp queue add starts when it is not running. It runs each job in its own session, in the directory the job was added from, with the PATH and virtualenv of the shell that added it. A stop reaches every process in that session, and so does the end of a job: what its command leaves running is ended with it, unless the job keeps it (--keep-leftovers).

Install

pp runs on Linux, with Python 3.11.4 or later. Install it as a tool, in an environment of its own:

uv tool install ppkit        # or: pipx install ppkit
pp --version

For completion, add source <(pp completion zsh) to ~/.zshrc after compinit, or source <(pp completion bash) to ~/.bashrc. To change pp itself, run it from a clone instead (CONTRIBUTING.md).

Try it

pp queue add -- sh -c 'echo working; sleep 3; echo hello'   # job 1, in the default queue; its worker starts
pp queue                                       # job 1 running, with its last line of output: working
pp queue wait 1                                # waits, then: done 1 rc=0 3s
pp queue log 1                                 # working, then hello
pp queue add --retries 1 --retry-delay 1s -- sh -c 'echo trying; exit 3'
pp queue wait 2                                # FAILED 2 rc=3, after two tries, with the end of its log

wait exits with 0 when every job succeeded and 1 when one failed, so it fits in a script: pp queue wait 2 && ./next-step.sh.

A job that needs a GPU says how much memory it takes:

pp queue add --gpu-gb 20 -- python train.py

It starts when one card has 20 GB free, counting what nvidia-smi reports and what running jobs have reserved. The job sees only that card, through CUDA_VISIBLE_DEVICES.

Queues

Each queue has its own worker, limits and order. Job ids are unique across queues. A job with a lower --prio runs first, and the default is 10. A big job at the head of a queue is not overtaken by smaller ones.

pp queue add -q dl --need net=1 -- ./fetch.sh            the dl queue, taking one of a counter named net
pp queue add --timeout 2h -- python x.py                 stopped after two hours
pp queue add --retries 2 --retry-if 'Connection reset' -- ./sync.sh
pp queue add --on-fail 'notify-send "job $PP_QUEUE_JOB failed"' -- ./nightly.sh
pp queue add --tag sweep.lr1 -- python x.py --lr 0.1     a name for the job, and for its family
pp queue wait --prefix sweep.                            every job whose name starts with sweep.
pp queue wait -f 12                                      a line for each start, event and outcome
pp queue drop 20-29                                      a range: it shows the jobs and asks first
pp queue kill 12                                         waits while the worker stops it, then:
                                                         killed 12 (stopped on SIGTERM)
pp queue retry 11 -- --seed 2                            job 11 again, with one argument more
pp queue hold 15        pp queue release 15

Every verb that takes jobs takes the same five forms: an id, a range of ids, a --tag name matched whole, --prefix P, and --all with -q NAME. pp queue note is the exception, and takes one job by its id or by a tag that names one. A job added without --tag has no name, and its id selects it.

Limits go in ~/.config/pp/config.toml. Every queue draws on the shared GPU memory, CPUs and RAM; a queue's own pool caps what it may take of them. A counter is a number, or a command that prints how much is free:

[resources]                  # shared by every queue
license = 4                  # --need license=1 takes one
nodes = { probe = "sinfo -h -t idle -o %D", every = "1m" }

[queue.default]
retries = 1
retry_if = "Connection reset|503"

[queue.dl.resources]         # only the dl queue has these
net = 2

A project's .pp.toml says how its jobs are launched and stopped, where their output goes, and what is in their environment:

[queue]
runner = "docker/run.sh"                   # the job runs as docker/run.sh CMD...
stop = "docker rm -f $PP_QUEUE_CONTAINER"  # how a stop reaches the work the runner started
log = "logs/{tag}.log"                     # under the project root; {tag} or {id}
env = { HF_HUB_OFFLINE = "1" }

A runner puts the work where no signal of pp's reaches it, so a project that sets one says the stop as well, or the add is refused. pp hands the runner PP_QUEUE_CONTAINER, a name for whatever it starts elsewhere, and PP_QUEUE_ENVFILE, a file of KEY=VALUE lines for a container to read with --env-file. pp queue add --no-runner skips the runner for one job, and --runner CMD with --stop CMD gives one job both with no .pp.toml.

A campaign is a file of one job per line, each line with its own flags, and a stage can wait for the one before it:

IDS=$(pp queue add --from stage1.txt)                   # one id per line on stdout
pp queue add --from stage2.txt --after "$(echo "$IDS" | tr '\n' ',')"

Give a job a token or a secret with --env or the project's env: a variable exported in your shell reaches it only through the worker. --json gives a job's variables by name, with each value ***. pp help queue is a short page, and four more hold the rest: pp help queue containers has the runner to copy, and settings, agents and reference the others. pp help queue add lists every option of add.

Working with agents

An agent that starts a long job should not sit in a loop checking on it. With pp it runs pp queue wait ID in the background. Claude Code tells the agent when a background command exits, and the output says how the job ended, with the end of the log if it failed. pp queue wait -f ID prints a line per event instead, for a monitor. A follow that is ended and started again goes on from where that session's last one stopped. pp queue add prints this hint when an agent runs it.

pp queue wait 12-15 --fail-fast returns at the first failure and leaves the rest running. pp queue retry ID -- --flag runs a job again with an argument more. --ok-rc 12,13 says which exit codes besides 0 are a result rather than a failure. pp help queue agents has the recipes, and the one for agents that land changes on a shared branch.

pp notes which session queued each job. pp queue wait --mine waits for the jobs this session queued, and also reports the ones that ended before it started waiting, so an outcome is not missed:

pp queue add -- ./train.sh       # prints the job's id, and the hint to wait in the background
pp queue wait --mine             # every job of this session: how it ended, with the log's end on failure

A job can say where it has got to. A line of its output that begins pp-event: is an event, and pp queue shows the latest one. pp queue wait ID --event REGEX returns once the job's current attempt says what the pattern matches, so an agent can check a run's first evaluation without reading its log:

print("pp-event: eval@1000 loss=0.31", flush=True)   # in the job
pp queue wait 12 --event 'eval@1000'                   # returns once the job has said it

A memory agents share

A memory is a folder of markdown notes, one fact per file, that the agents on a machine read and write with their own tools. pp memory ranks the notes for a situation, follows their links (§G:NAME, [[NAME]]), proposes links and groups, and checks the index. pp memory edit runs the command an agent would write anyway, such as sed -i or a python heredoc, while no other edit of the memory runs, so two agents changing one note at once both keep their change.

pp memory find push release hours    the notes for the work at hand, best first, as FILE:LINE
pp memory related push-hours         what a note links, the notes most like it, and its groups
pp memory groups                     about √N groups of N notes: a draft of the hubs MEMORY.md lists
pp memory check                      broken links, unreached notes, look-alikes, and the sizes
pp memory edit -- sed -i 's/a/b/' ~/.local/share/pp/memory/hub.md
                                     your own command, taking turns with other edits, undone if it fails

MEMORY.md lists groups, and a hub note per group lists the group's notes, so every note is two reads from the root. With N notes that index is shortest at about √N groups of about √N notes. A memory whose folder is a git repository keeps a history: each kept edit is one commit. The memory is ~/.local/share/pp/memory unless [memory] dir in config.toml or --dir names another folder.

Nothing is typed into the agent's terminal. pp leaves the session's identity out of the jobs it runs, so a job does not think it is inside that session.

The commands follow the same rules, so an agent can use them without a terminal. A command that stops or removes things (kill, drop, retry, clean) shows what it will do and asks, unless you named each thing exactly. -n only shows, -y goes ahead, and without a terminal it refuses instead of asking. Lists and status reports have --json. The exit status is 0 when it worked, 1 when it failed and 2 when it refused; CONTRIBUTING.md has all of them.

Releases

pp promote keeps the copy of a tool or service you use apart from the tree you edit. It copies a git commit into ~/.local/share/pp/releases/NAME/STAMP/, runs the project's check inside that copy, and points the current link at it only if the check passes. The links you register go through current, so they never change.

# .pp.toml, at the project root
[promote]
check = "./test.sh"                              # must pass, or nothing changes
links = { "~/.local/bin/notes" = "bin/notes" }
after = "systemctl --user restart notes"         # makes the running service pick up the release
verify = "curl -fsS http://127.0.0.1:8100/ >/dev/null"   # if this fails, pp goes back
pp promote -n                  the plan and every problem, without changing anything
pp promote                     release HEAD
pp promote status              each project, its release, and how far its source is ahead
pp promote rollback notes      back to the release before

after runs again on a rollback, so it has to work for any release. A database migration that cannot be undone does not belong in it. pp keeps the last five releases, and always keeps the current one and the one before.

Each hook's output goes to a file beside the run's log, and pp shows it as it comes. pp waits for the hook itself, not for what the hook leaves running, so redirect the output of a process an after starts.

A systemd service runs the release by pointing at current:

ExecStart=%h/.local/share/pp/releases/notes/current/bin/serve --port 8100

Everyday tools

pp kill :8080                  whatever listens on port 8080
pp kill 'vite --port'          processes whose command line matches; it shows them and asks
pp kill -n :8080               only show what it would stop
pp kill --ports                every listening port and what owns it

pkill -f PATTERN can kill the shell that runs it, because the pattern is in that shell's command line. pp kill leaves out itself and the processes that started it.

pp batch rename ' ' '_' '*'                                  spaces to underscores, after a preview
pp batch rename -t '{parent}_{i:03}{ext}' 'photos/**/*.jpg'   trip_001.jpg, trip_002.jpg, ... in each folder
pp batch run 'ffmpeg -i {} {out}' '*.wav' --out 'mp3/{stem}.mp3' -j 4
pp batch undo                                                put the last rename back
pp http ~/notes .              a tab for each folder, at http://127.0.0.1:8000, with a box that searches them

pp http listens on 127.0.0.1 unless you pass --bind, and does not serve .git or files such as .env or private keys. Behind a proxy that serves it under a path, --prefix /notes puts that path in every link it writes. --bind unix:PATH listens on a socket instead of a port.

Your own commands

pp cmd new hello --user -s "Say hello"     writes ~/.config/pp/commands/hello.py, a working start

A command is a Python file with a docstring and a main function. The first line of the docstring is what pp lists, and the rest is its help. Edit it into what you need. After this edit, pp hello world prints hello, world:

"""Say hello

    pp hello NAME          say hello to NAME
"""
from pp.lib import ui


def main(argv: list[str]) -> int:
    ap = ui.parser("hello", __doc__)
    ap.add_argument("name")
    a = ap.parse_args(argv)
    print(f"hello, {a.name}")
    return 0

Commands that someone else wrote come as a plugin: a git repository with command files in its commands/ folder, or at its top.

pp cmd add github.com/OWNER/REPO            shows the commands it adds, then asks
pp cmd add github.com/OWNER/REPO -n --show  only shows, with their code
pp cmd update                               fetches, shows the diff, then asks
pp cmd rm REPO
pp cmd ls                                   every command, and where it comes from

Any command can have a name of your own:

pp cmd alias st promote status              `pp st` is `pp promote status`
pp cmd alias                                every alias, and what it runs
pp cmd alias st --rm                        take the name back

The names live in [alias] in ~/.config/pp/config.toml, and this is the one place pp writes that file. A name that is a command's own is refused, so an alias never hides a command, and pp help st and pp st <TAB> say what pp promote status does.

pp clones the plugin into ~/.local/share/pp/plugins/ and checks out the commit you said yes to. Only pp cmd update moves it, after showing you the diff. A plugin's code runs as you, so read it before you say yes.

A program named pp-NAME in ~/.config/pp/commands/, in a plugin or in a PP_PATH folder, in any language, is a command too. Your PATH is not read, so a program named pp-* that other software installs takes no command's name. To add a command to pp itself, see CONTRIBUTING.md.

Status

pp is new, and its version is 0.x. A command or a config key may still change, and so may a field of --json output; the changelog says when one does. CI runs the tests on Python 3.11.4 and 3.14, on Ubuntu 24.04.

Contributing

CONTRIBUTING.md says how to test and send a change, and what a command needs to fit in. Bugs go to the issue tracker.

Developed with agent assistance.

License

Copyright 2026 The pp Authors. Licensed under the Apache License 2.0; see LICENSE.

Metadata

Release files for ppkit 0.2.3

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

Source distribution (sdist)

Source distribution for ppkit 0.2.3
File Size Uploaded Provenance Actions
ppkit-0.2.3.tar.gz 622.6 kB Without provenance Details for ppkit-0.2.3.tar.gz

Built distribution (wheel)

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

Total release size: 927.9 kB

Release files / ppkit-0.2.3.tar.gz

Download URL ppkit-0.2.3.tar.gz
Size 622.6 kB
Tags Source
SHA-256 checksum
How to use checksums
dddce598d3e38d81bdf6b5fed8ed0e31e4a1b21bb076225238e9c9ca0ccb906f
BLAKE2b-256 checksum
How to use checksums
f6bf011c3c201c87486c71360fd79983e3df473a4753695f37358c3ad3009faf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","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}

Release files / ppkit-0.2.3-py3-none-any.whl

Download URL ppkit-0.2.3-py3-none-any.whl
Size 305.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c08b9135dde917a0be9d7b9b5555c6fda0b788e35ce35fca8d04a27788ee7f7
BLAKE2b-256 checksum
How to use checksums
80129c02950d49c44c87243413ff0d60d49c768c4e25b3ecd6f5bfa6d8fa0de3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","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}

Security for ppkit 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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