Metadata-Version: 2.1
Name: taskbadger
Version: 0.3.0
Summary: The official Python SDK for Task Badger
Home-page: https://taskbadger.net/
License: Apache-2.0
Requires-Python: >=3.8,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: attrs (>=21.3.0)
Requires-Dist: httpx (>=0.15.4,<0.24.0)
Requires-Dist: importlib-metadata (>=1.0,<2.0) ; python_version < "3.8"
Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
Requires-Dist: tomlkit (>=0.11.6,<0.12.0)
Requires-Dist: typer[all] (>=0.7.0,<0.8.0)
Project-URL: Documentation, https://docs.taskbadger.net/
Project-URL: Repository, https://github.com/taskbadger/taskbadger-docs
Description-Content-Type: text/markdown

# Task Badger Python Client

This is the official Python SDK for [Task Badger](https://taskbadger.net/).

For full documentation go to https://docs.taskbadger.net/python/.

---

## Getting Started

### Install

```bash
pip install --upgrade taskbadger
```

### Client Usage

#### Configuration

```python
import taskbadger

taskbadger.init(
    organization_slug="my-org",
    project_slug="my-project",
    token="***"
)
```

#### API Example

```python
from taskbadger import Task, Action, EmailIntegration

# create a new task with custom data and an action definition
task = Task.create(
    "task name",
    data={
        "custom": "data"
    },
    actions=[
        Action(
            "*/10%,success,error",
            integration=EmailIntegration(to="me@example.com")
        )
    ]
)

# update the task status to 'processing' and set the value to 0
task.started()
try:
   for i in range(100):
      do_something(i)
      if i!= 0 and i % 10 == 0:
         # update the progress of the task
         task.update_progress(i)
except Exception as e:
    # record task errors
    task.error(data={
        "error": str(e)
    })
    raise

# record task success
task.success()
```

### CLI USage

#### Configuration

```shell
$ taskbadger configure
Organization slug: my-org 
Project slug: project-x 
API Key: XYZ.ABC 
Config written to ~/.config/taskbadger/confi
```

#### Usage Examples

The CLI `run` command executes your command whilst creating and updating a Task Badger task.

```shell
$ taskbadger run "demo task" --action "error email to:me@test.com" -- path/to/script.sh
Task created: https://taskbadger.net/public/tasks/xyz/
```


