Metadata-Version: 2.4
Name: evenprocess
Version: 0.1.0
Summary: A tiny, dependency-free background process manager — nohup + screen with a one-line API.
Project-URL: Homepage, https://github.com/yourname/evenprocess
Project-URL: Repository, https://github.com/yourname/evenprocess
Project-URL: Issues, https://github.com/yourname/evenprocess/issues
Author-email: Your Name <you@example.com>
License: MIT
License-File: LICENSE
Keywords: background,cli,daemon,manager,nohup,process,screen
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# 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

```bash
pip install evenprocess
```

## Python API

```python
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:

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

### Useful options

```python
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`.

```bash
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
