mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2025-12-31 05:39:41 -06:00
* feat: first pass at dependency injection * feat: add DI example + tests * feat: finish up tests * feat: docs * chore: gen * chore: lint * chore: changelog + ver * fix: split up paragraphs * refactor: improve impl * chore: gen * feat: inject input + ctx into deps * chore: gen * [Python] Feat: More use of `logger.exception` (#2069) * feat: add more instances of `logger.exception` * chore: ver * chore: changelog * fix: one more error log * chore: gen * chore: gen * chore: lint * fix: improve shutdown * chore: changelog * unwind: exit handler * feat: task run error * feat: improve error serde with more context * chore: changelog * fix: changelog * chore: gen * fix: rm celpy + lark dep, casing issues * chore: changelog * fix: respect log levels over the API * fix: changelog * refactor: rename log forwarder * fix: circular import
Hatchet Python Quickstart
This is an example project demonstrating how to use Hatchet with Python. For detailed setup instructions, see the Hatchet Setup Guide.
Prerequisites
Before running this project, make sure you have the following:
- Python v3.10 or higher
- Poetry for dependency management
Setup
- Clone the repository:
git clone https://github.com/hatchet-dev/hatchet-python-quickstart.git
cd hatchet-python-quickstart
- Set the required environment variable
HATCHET_CLIENT_TOKENcreated in the Getting Started Guide.
export HATCHET_CLIENT_TOKEN=<token>
Note: If you're self hosting you may need to set
HATCHET_CLIENT_TLS_STRATEGY=noneto disable TLS
- Install the project dependencies:
poetry install
Running an example
- Start a Hatchet worker by running the following command:
poetry run python src/worker.py
- To run the example workflow, open a new terminal and run the following command:
poetry run python src/run.py
This will trigger the workflow on the worker running in the first terminal and print the output to the the second terminal.