Skip to main content

A tiny, dependency-free background process manager — nohup + screen with a one-line API.

Project description

evenprocess

A tiny, dependency-free background process manager for Python — think nohup + screen, but with a one-line API. Start a process, close your terminal, come back later and check on it, read its logs, restart or stop it.

Works on Linux, macOS and Windows. Pure standard library.

Install

pip install evenprocess

Python API

import evenprocess as ep

# Start a detached process — it survives the terminal/script exiting.
ep.run("python server.py", name="web")

# Or let the name be derived from the command:
proc = ep.run("python worker.py")
print(proc.name, proc.pid, proc.status)

# List everything you manage
for p in ep.ls():
    print(p.name, p.status, p.pid)

# Tail logs (stdout + stderr are merged into one log file)
print(ep.logs("web", lines=100))

# Control
ep.restart("web")
ep.stop("web")          # SIGTERM, then SIGKILL after a timeout
ep.remove("web")        # stop + delete its logs/metadata
ep.clean()              # forget all stopped processes

Each Process object is also fully self-contained:

p = ep.get("web")
p.alive        # bool
p.logs(50)     # str
p.restart()
p.stop()

Useful options

ep.run("ls -la | grep py", shell=True)        # pipes/globs need shell=True
ep.run("python app.py", cwd="/srv/app")       # set working directory
ep.run("python app.py", env={"PORT": "8080"}) # extra environment
ep.run("python app.py", name="web", replace=True)  # replace a running one

CLI

Two entry points are installed: evenprocess and the short alias ep.

evenprocess run "python server.py" -n web    # start detached
evenprocess ls                               # list (add -a for stopped)
evenprocess logs web -f                       # follow output live
evenprocess stop web
evenprocess restart web
evenprocess rm web                            # stop and forget
evenprocess clean                             # drop stopped records

Where things live

Metadata and logs are stored under ~/.evenprocess/<name>/:

  • process.json — pid, command, cwd, start time, restart count
  • output.log — merged stdout/stderr

Override the location with the EVENPROCESS_HOME environment variable.

How detaching works

On POSIX, processes are started with start_new_session=True (a setsid call) so they get their own session and detach from the controlling terminal; stdio is redirected to the log file. On Windows the equivalent DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP flags are used. This is the same mechanism behind nohup, just packaged behind a friendlier API.

License

MIT

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

evenprocess-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

evenprocess-0.1.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file evenprocess-0.1.0.tar.gz.

File metadata

  • Download URL: evenprocess-0.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for evenprocess-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e2f87a8e87919c8b2979dce65bc4eb5e97673186855a569f50d7718a52b7a870
MD5 6028c0fc6495bebe29c316da5a16e0c7
BLAKE2b-256 04fb81c0bcf46ca46bc1bf3695725c249e59ccb14cca3f61c380c5d2f9365b62

See more details on using hashes here.

File details

Details for the file evenprocess-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: evenprocess-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for evenprocess-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da376b8be6ac59842fbb5f039f049d4dafcdd03a9ab9b95fc7432a8b4e21c385
MD5 d0b9d029ab0b41fe56b7fd54048a8023
BLAKE2b-256 f2b004da0de337f73260622edb13ce2e96fe4014db6c0a728b59977a16607556

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