This guide explains how to deploy the Trailpack UI to Streamlit Cloud.
- A GitHub account with access to this repository
- A Streamlit Cloud account (free tier available at https://share.streamlit.io)
- PyST API credentials (PYST_HOST and PYST_AUTH_TOKEN)
Ensure your repository is pushed to GitHub:
git push origin main- Go to https://share.streamlit.io
- Click "New app"
- Select your repository:
TimoDiepers/trailpack - Set the branch (e.g.,
mainor your deployment branch) - Set the main file path:
trailpack/ui/streamlit_app.py - Click "Advanced settings"
In the "Secrets" section, add your PyST API credentials in TOML format:
PYST_HOST = "https://your-pyst-api-server.com"
PYST_AUTH_TOKEN = "your_secret_token_here"Important Notes:
- Do NOT include these secrets in your code or repository
- The config system automatically detects Streamlit Cloud and uses
st.secrets - For local development, use a
.envfile instead (see.env.example)
Click "Deploy" and wait for the app to build and start.
The application uses a smart configuration system that:
- On Streamlit Cloud: Automatically loads from
st.secrets - Locally: Falls back to environment variables or
.envfile - Lazy Loading: Secrets are loaded when first accessed, not at import time
This ensures compatibility with both local development and cloud deployment.
Issue: App crashes on startup
- Check that your secrets are correctly formatted in TOML
- Verify PYST_HOST includes the protocol (http:// or https://)
- Check Streamlit Cloud logs for specific error messages
Issue: API calls fail
- Verify your PYST_HOST is accessible from Streamlit Cloud
- Check that PYST_AUTH_TOKEN is valid
- Ensure the PyST API server accepts connections from Streamlit Cloud's IP range
Issue: Module not found errors
- The app includes automatic path configuration to find trailpack modules
- Verify all external dependencies are listed in
requirements.txt - Check that there are no circular dependencies
- Review Streamlit Cloud build logs
Create a .env file:
cp .env.example .env
# Edit .env with your credentialsRun the app:
streamlit run trailpack/ui/streamlit_app.py- No
.envfile needed - Configure secrets through Streamlit Cloud dashboard
- App automatically uses cloud configuration
The requirements.txt file at the repository root lists all dependencies:
pyst-client @ git+https://github.com/cauldron/pyst-client.git
langcodes
python-dotenv
httpx
openpyxl
streamlit>=1.28.0
pandas>=2.0.0
Note: The package code is deployed directly, so requirements.txt does NOT include the trailpack package itself. The streamlit app automatically adds the repository root to Python's import path to ensure all trailpack modules can be imported.
For issues related to:
- Trailpack: Open an issue on GitHub
- Streamlit Cloud: Check https://docs.streamlit.io/streamlit-community-cloud
- PyST API: Contact your PyST API provider