Local Resources
This document describes how to access local files within a Seaplane app.
All files within the nested my-project-name
directory are included in your build zip file and are accessible within your Seaplane app.
Seaplane executes your app, i.e. main.py, from the root project directory. As a result, file paths of local files are defined starting from the root project directory.
For example, assume you have the following file structure, where products.csv
and main.py
are both located in the same directory.
my-project-name/ # root project directory
├── my-project-name/ # nested project directory
│ ├── products.csv # local csv file
│ └── main.py
├── .env
└── pyproject.toml
You can load products.csv
as a pandas DataFrame as follows in main.py
:
# main.py
import pandas as pd
# file path starts from the root project directory
products = pd.read_csv("my-project-name/products.csv")
Note products.csv
file path is defined from the root project directory down, i.e my-project-name/products.csv
. Follow this format to access your local files.
Learn more about Seaplane's default file structures here.