Configuration and Dependencies
Your Datapane app may have requirements on external libraries and require certain environment values. Datapane supports the ability to,
  • add local folders and files, which you can deploy alongside your app
  • include pip requirements, which are made available to your app when it is run on Datapane
These are all configured in your datapane.yaml.
For complex dependencies and internal libraries, we highly recommend creating a Docker container.

Python dependencies

If we were building a reporting tool to pull down financial data, we may want to use the yfinance library in Python. To do this, we could add it to a requirements list in our datapane.yaml
datapane.yaml
1
...
2
3
requirements:
4
- yfinance
Copied!

Additional files and folders

For more complex scripts, we may want to include a local Python folder or file. Imagine we have a separate Python file, stock_scaler.py which helps us scale the values of our stocks, and which we want to use in our script, or a folder of SQL scripts which we want to use in Python.
1
~/C/d/d/my-new-proj> ls
2
dp-script.py datapane.yaml stock_scaler.py
Copied!
To include this in the deploy, we could add it to include
datapane.yaml
1
...
2
3
include:
4
- stock_scaler.py
Copied!
We can then import it in our script as follows:
dp_script.py
1
import stock_scalar
2
3
...
Copied!

Docker dependencies

By default apps on Datapane run using our default Docker image, which, in addition to including Datapane and its supported visualisation libraries, includes the following libraries,
1
# datapane cli includes plotting and basic DS libs, e.g. pandas
2
3
# additional visualisations
4
seaborn == 0.11.*
5
altair-recipes ~= 0.9.0
6
git+https://github.com/altair-viz/[email protected]#egg=altair-pandas
7
8
# analytics libraries
9
scipy == 1.5.*
10
scikit-learn == 0.23.*
11
patsy ~= 0.5.1
12
lightgbm ~= 3.1.0
13
lifetimes == 0.11.*
14
lifelines == 0.25.*
15
./wheels/fbprophet-0.7.1-py3-none-any.whl
16
adtk ~= 0.6.2
17
18
# data access
19
sqlalchemy ~= 1.3
20
psycopg2-binary ~= 2.8
21
PyMySQL ~= 0.10.1
22
google-cloud-bigquery[pandas, pyarrow] ~= 2.4.0
23
boto3 ~= 1.16.19
24
requests ~= 2.25.0
25
ftpretty ~= 0.3.2
26
pymongo ~= 3.11.0
27
28
# misc
29
dnspython ~= 2.0.0
30
sh ~= 1.13.0
Copied!
If you want your app to run in your own Docker container, you can specify your own by creating an Environment. Although you can use any base for your Docker image, we recommend inheriting from ours. To do this, create a Docker image that inherits from the our base images (such as datapane/dp-runner-py38) and add your required dependencies - see https://hub.docker.com/u/datapane for all our images.
If you build this and push it to Dockerhub, you can then specify it in your datapane.yaml as follows:
1
environment: my-environment
Copied!
When you run an app, it will run inside this Docker container. Note that the first run may take a bit longer, as it needs to pull the image from DockerHub. Once it pulls it once, it's cached for future runs.
We support both public and private Docker images, so you can add private internal libraries, for instance, to your Docker image. You can add your registry credentials to your Datapane Server from the server settings page.
Last modified 1mo ago