Metadata-Version: 2.4
Name: samco-job-lifecycle
Version: 0.1.1
Summary: A small, dependency-free state machine for tracking job lifecycles
Author: samcoai
License-Expression: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# samco-job-lifecycle

A small, dependency-free Python library for tracking the state of a job. It validates transitions, records UTC timestamps, and keeps an in-memory event history. It does not run jobs or store them in a database.

## Install

```sh
pip install samco-job-lifecycle
```

## Example

```python
from samco_job_lifecycle import Job, JobStatus

job = Job("your-project-id")  # Replace this with your own identifier
job.start()
job.succeed()

assert job.status is JobStatus.SUCCEEDED
assert job.is_terminal
print(job.events)
```

The string passed to `Job` is an ID you choose. If your application already has a project ID, you can use it here. The library only tracks this job's state; it does not look up or create a project.

Valid paths are `pending -> running -> succeeded|failed|cancelled` and `pending -> cancelled`. Terminal jobs cannot transition again. Invalid changes raise `InvalidTransition`.

Requires Python 3.9 or newer.
