Skip to content

Commit e328f41

Browse files
committed
add changelog & before_create docs
1 parent d0e025f commit e328f41

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

docs/changelog.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
hide:
3+
- navigation
4+
---
5+
6+
# Changelog
7+
8+
## v1.5.0
9+
10+
**2025-02-14**
11+
12+
* **NEW** Tasks now support tagging. Tags are useful for categorizing tasks and filtering them in the UI. See [Task Tags](data_model.md#tags) for more information.
13+
14+
**Python SDK**
15+
16+
* **NEW** Support for tagging.
17+
* **NEW** `before_create` callback to allow modification of task data before it is created. This is useful for adding global tags and metadata to tasks such as the current tenant etc. See [Before Create Callback](python.md#before-create-callback) for more information.

docs/python.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,16 @@ taskbadger.init(
2525
)
2626
```
2727

28-
Details about these configuration parameters can be found [here](basics.md#organization-and-project)
28+
Details about the slug configuration parameters can be found [here](basics.md#organization-and-project).
29+
30+
| Name | Description |
31+
|-------------------|-----------------------------------------------------------------------------------------------------------|
32+
| organization_slug | The organization identifier. |
33+
| project_slug | The project identifier. |
34+
| token | API authentication token. |
35+
| tags | Global tags which are added to all tasks. |
36+
| systems | System integrations such as [Celery](python-celery.md) |
37+
| before_create | A function that is called before a task is created. See [Before Create Callback](#before-create-callback) |
2938

3039
If you attempt to use the SDK without configuring it you will get an error. To avoid this you can use the
3140
[safe functions](#safe-functions) which will log any errors to the `taskbadger` logger.
@@ -120,6 +129,20 @@ def taskbadger_scope_middleware(get_response):
120129
key is present in the current scope as well as the data passed in directly, the value in the data passed
121130
directly will be used. The same applies to tags.
122131

132+
## Before Create Callback
133+
134+
The `before_create` parameter in the `taskbadger.init` function allows you to define a function that will be called before a task is created. This function will be passed the task data as a dictionary and should return the modified task data.
135+
136+
```python
137+
def before_create(task_data: dict) -> dict:
138+
data = task_data.setdefault("data", {})
139+
data["custom"] = "data"
140+
141+
tags = task_data.setdefault("tags", {})
142+
tags["tenant"] = "acme"
143+
144+
return task_data
145+
```
123146

124147
## Python Reference
125148

mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ nav:
8484
- 'Basic Usage': 'python.md'
8585
- 'Function Decorator': 'python-decorator.md'
8686
- 'Celery Integration': 'python-celery.md'
87+
- 'Changelog':
88+
- 'changelog.md'
8789

8890
plugins:
8991
- mkdocstrings:

0 commit comments

Comments
 (0)