Detailed setup instructions for development and local use.
- Python 3.11 or newer — check with
python --version - pip — bundled with Python
- git — for cloning the repo
- uv or poetry — faster dependency management (see below)
- VS Code or PyCharm — any Python-capable editor
# Clone
git clone https://github.com/Tools00/pem-ec-0d.git
cd pem-ec-0d
# Virtual environment
python -m venv venv
source venv/bin/activate # macOS/Linux
# venv\Scripts\activate # Windows PowerShell
# Dependencies
pip install -r requirements.txt
# Run the app
streamlit run src/streamlit_app.py
# Run tests
pytest tests/ -v# Install uv if you don't have it
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone
git clone https://github.com/Tools00/pem-ec-0d.git
cd pem-ec-0d
# Create env and install from pyproject.toml
uv sync
# Run the app
uv run streamlit run src/streamlit_app.py
# Run tests
uv run pytestThree sanity checks before using the app:
# 1. Module imports OK
python -c "from src.electrochemistry import Electrochemistry; print('OK')"
# 2. All tests green
pytest tests/ -q
# Expected: "78 passed in <0.5s"
# 3. App starts
streamlit run src/streamlit_app.py
# Then open http://localhost:8501You ran Streamlit with relative imports but without a package context.
The current codebase handles this — if you see this error, you have an
outdated streamlit_app.py. Pull the latest main.
Your venv is not activated, or pip install didn't complete.
source venv/bin/activate # make sure (venv) appears in your prompt
pip install -r requirements.txtAnother Streamlit instance is running. Kill it or use a different port:
# macOS/Linux: find and kill
lsof -i :8501
kill <PID>
# Or use a different port
streamlit run src/streamlit_app.py --server.port 8502This test depends on typical PEM-EC operating parameters. If you tweaked
the default cell/thermal parameters, the sanity bounds may need updating.
Revert src/constants.py and src/electrochemistry.py defaults to verify.
Check that your operating current density is below the limiting current (default j_L = 3 A/cm²). At j ≥ j_L, the concentration overpotential diverges and U_cell becomes NaN.
Your venv is not activated. Activation is per-shell-session — you need to re-activate after opening a new terminal.
See docs/DEPLOY.md (coming in v0.3).
Quick version:
- Push your repo to GitHub
- Go to share.streamlit.io
- Connect your GitHub account
- "New app" → select repo → main file path:
src/streamlit_app.py - Streamlit Cloud auto-installs from
requirements.txt
| Platform | Tested | Notes |
|---|---|---|
| macOS 13+ | ✅ | Primary dev platform |
| Linux (Ubuntu 22.04+) | ✅ | CI runs here |
| Windows 11 + PowerShell | Should work — activate venv with venv\Scripts\activate |
|
| Python 3.11, 3.12, 3.13 | ✅ | Enforced by CI |
| Python 3.10 and older | ❌ | Uses list[str] syntax and other PEP 604 features |
cd pem-ec-0d
git pull
source venv/bin/activate
pip install -r requirements.txt --upgrade
pytest tests/ -q # verify nothing broke