|
| 1 | +Getting Started with Tasktronaut |
| 2 | +================================= |
| 3 | + |
| 4 | +Welcome to Tasktronaut! |
| 5 | + |
| 6 | +This guide will help you install the library, set up your first process, and run it successfully. |
| 7 | + |
| 8 | +Installation |
| 9 | +------------ |
| 10 | + |
| 11 | +Prerequisites |
| 12 | +~~~~~~~~~~~~~ |
| 13 | + |
| 14 | +Tasktronaut requires: |
| 15 | + |
| 16 | +- Python 3.7 or higher |
| 17 | +- pip (Python package manager) |
| 18 | + |
| 19 | +Installing from PyPI |
| 20 | +~~~~~~~~~~~~~~~~~~~~ |
| 21 | + |
| 22 | +The easiest way to install Tasktronaut is using pip: |
| 23 | + |
| 24 | +.. code-block:: bash |
| 25 | +
|
| 26 | + pip install tasktronaut[rq] |
| 27 | +
|
| 28 | +For a specific version: |
| 29 | + |
| 30 | +.. code-block:: bash |
| 31 | +
|
| 32 | + pip install tasktronaut[rq]==0.3.0 |
| 33 | +
|
| 34 | +Installing with Optional Dependencies |
| 35 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 36 | + |
| 37 | +Tasktronaut may offer optional extras for extended functionality. Install them as follows: |
| 38 | + |
| 39 | +.. code-block:: bash |
| 40 | +
|
| 41 | + pip install tasktronaut[dev] |
| 42 | + pip install tasktronaut[docs] |
| 43 | +
|
| 44 | +Installing from Source |
| 45 | +~~~~~~~~~~~~~~~~~~~~~~ |
| 46 | + |
| 47 | +To install the development version from the repository: |
| 48 | + |
| 49 | +.. code-block:: bash |
| 50 | +
|
| 51 | + git clone https://github.com/virtualstaticvoid/tasktronaut.git |
| 52 | + cd tasktronaut |
| 53 | + uv sync |
| 54 | +
|
| 55 | +Verifying Your Installation |
| 56 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 57 | + |
| 58 | +Verify the installation was successful by importing Tasktronaut in a Python shell: |
| 59 | + |
| 60 | +.. code-block:: python |
| 61 | +
|
| 62 | + >>> import tasktronaut |
| 63 | + >>> print(tasktronaut.__version__) |
| 64 | + x.x.x |
| 65 | +
|
| 66 | +If you see the version number without errors, you're ready to go! |
| 67 | + |
| 68 | + |
| 69 | +Your First Process |
| 70 | +------------------ |
| 71 | + |
| 72 | +Creating a Simple Process |
| 73 | +~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 74 | + |
| 75 | +Let's create a basic process with three sequential tasks. Create a file called ``my_first_process.py``: |
| 76 | + |
| 77 | +.. code-block:: python |
| 78 | +
|
| 79 | + from tasktronaut import ProcessDefinition, Builder |
| 80 | +
|
| 81 | + class GreetingProcess(ProcessDefinition): |
| 82 | + """A simple process that greets the user.""" |
| 83 | +
|
| 84 | + def define_process(self, builder: Builder): |
| 85 | + builder.task(self.say_hello) |
| 86 | + builder.task(self.say_name) |
| 87 | + builder.task(self.say_goodbye) |
| 88 | +
|
| 89 | + def say_hello(self): |
| 90 | + print("Hello!") |
| 91 | +
|
| 92 | + def say_name(self, name: str = "World", **kwargs): |
| 93 | + print(f"Nice to meet you, {name}.") |
| 94 | +
|
| 95 | + def say_goodbye(self): |
| 96 | + print("Goodbye!") |
0 commit comments