Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/content/creating-tesseracts/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ After that is done, you will be able to use the `tesseract-runtime` command in y
This is the exact same command that is launched inside Tesseract containers to run their
various endpoints, and its syntax mirrors the one of `tesseract run`.

```{note}
When running without containerization, the directory containing `tesseract_api.py` is automatically added to `PYTHONPATH`, allowing you to import additional Python modules from that directory. This behavior matches what happens inside Tesseract containers, where the path containing `tesseract_api.py` is also added to `PYTHONPATH`.
```

For instance, to call the `apply` function, rather than first building a `helloworld` image and running this command:

```bash
Expand Down
4 changes: 4 additions & 0 deletions docs/content/examples/building-blocks/localdependency.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ We can then specify it as a local dependency in `tesseract_requirements.txt` by
./cowsay-6.1-py3-none-any.whl
```

```{note}
If you have additional Python modules in the same directory as `tesseract_api.py`, you can import them directly without any special configuration. The directory containing `tesseract_api.py` is automatically added to `PYTHONPATH` in the container environment.
```

Finally, let's build the Tesseract, and verify it works
```bash
$ tesseract build .
Expand Down
1 change: 1 addition & 0 deletions tesseract_core/sdk/templates/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ COPY "{{ tesseract_source_directory }}/tesseract_api.py" ${TESSERACT_API_PATH}
RUN chmod 444 ${TESSERACT_API_PATH}

ENV PATH="/python-env/bin:$PATH"
ENV PYTHONPATH="/tesseract:$PYTHONPATH"

{% if config.build_config.package_data %}
# Copy package data to image
Expand Down
Loading