Files
hatchet/examples/python/quickstart
Matt Kaye f1f276f6dc Feat: Python task unit tests (#1990)
* feat: add mock run methods for tasks

* feat: docs

* feat: first pass at unit tests

* cleanup: split out tests

* feat: pass lifespan through

* fix: rm comment

* drive by: retry on 404 to help with races

* chore: changelog

* chore: ver

* feat: improve logging everywhere

* chore: changelog

* fix: rm print cruft

* feat: print statement linter

* feat: helper for getting result of a standalone

* feat: docs for mock run

* feat: add task run getter

* feat: propagate additional metadata properly

* chore: gen

* fix: date

* chore: gen

* feat: return exceptions

* chore: gen

* chore: changelog

* feat: tests + gen again

* fix: rm print cruft
2025-07-17 13:54:40 -04:00
..
2025-04-30 14:10:09 -07:00
2025-04-30 14:10:09 -07:00
2025-04-30 14:10:09 -07:00
2025-04-30 14:10:09 -07:00
2025-04-30 14:10:09 -07:00
2025-04-30 14:10:09 -07:00
2025-04-30 14:10:09 -07:00

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:

  1. Python v3.10 or higher
  2. Poetry for dependency management

Setup

  1. Clone the repository:
git clone https://github.com/hatchet-dev/hatchet-python-quickstart.git
cd hatchet-python-quickstart
  1. Set the required environment variable HATCHET_CLIENT_TOKEN created 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=none to disable TLS

  1. Install the project dependencies:
poetry install

Running an example

  1. Start a Hatchet worker by running the following command:
poetry run python src/worker.py
  1. 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.