Metadata-Version: 2.3
Name: cronipy
Version: 0.1.1
Summary: Add your description here
Author: lantonic
Author-email: lantonic <luka.olegsson@gmail.com>
Requires-Dist: cyclopts>=5.3.2
Requires-Python: >=3.12
Description-Content-Type: text/markdown

# cronipy

`cronipy` turns Python functions into cron jobs. You decorate a function with a schedule, run one command, and cronipy writes the crontab entries for you. The package is in early development, and the interface can change.

## Installation

```bash
pip install cronipy
```

## Usage

Define your jobs in a module of your package, e.g. `mypackage.tasks`:

```python
from cronipy import Cron

cron = Cron()

@cron.task("*/5 * * * *")
def do_something_every_five_minutes():
    ...
```

Then install the jobs into your crontab:

```python
cron.install()
```

or from a shell, install jobs from all `Cron` objects in the specified module:

```bash
$ cronipy install mypackage.tasks
```

`cronipy` adds one line per decorated function into the current user's `crontab`. Function output is logged in `logs/<function name>.log`.

## Options

You can pass these arguments to `Cron`:

- `dry_run`: when true, a job prints its name and does nothing.
- `env`: a dictionary of environment variables added to every crontab line.
- `log_dir`: where the log files go, `./logs` by default.
- `work_dir`: the directory each job runs in, `./` by default.
- `python`: the interpreter the jobs use, the one that runs cronipy by default.

## Development

This repository uses [uv](https://docs.astral.sh/uv/). Set up a development environment with `uv sync`, and run the checks with `uv run pytest`.

## Roadmap

- [ ] Enable autodiscovery of modules containing Cron objects.
- [ ] Enable compatibility with single-file modules.

## License
[BSD 3-Clause](./LICENSE.txt) 
