Skip to main content

Custom requirements.txt

Endash installs some dependencies for you by default - all dash dependencies needed to launch a Dash app. When you start adding features to your app, you'll need to define your own dependencies in a requirements.txt file.

There are a few ways to do this. One easy way is with Poetry, but you can also use pipenv, virtualenv, or even manually writing your own requirements.txt file.

Here's how you'd do this with Poetry for the excellent dash-bootstrap-components package:

# myapp/

pip3 install poetry
poetry init
# follow prompts - say no to adding dependencies
# creates a `pyproject.toml` file

poetry add dash-bootstrap-components
poetry lock
poetry export -f requirements.txt -o requirments.txt
# creates requirements.txt file

You can test that the app will run in the same environment by using a shell with all the dependencies -- and only those dependencies -- installed.

poetry shell

If this fails, add the necessary package with poetry add package_name and try again.