Skip to content

entorb/strava-streamlit

Repository files navigation

Torben's Strava App V2 using Streamlit

This is a modern rewrite of my old Strava Äpp. Currently, only read-only statistics features are implemented. For bulk modify of activities and Excel import, please use the old Äpp.

Privacy

  • Code: The source-code is open source.
  • Data: The app does not use a database. Your Strava data is only temporarily cached.
  • Access: A temporary access token to your Strava profile is used and revoked at logout.
  • Cookies: Only a single technical cookie is used for session identification and deleted at end of session. No user tracking.

Repo Setup

Python version

As my webserver is running Python 3.11, I need to use it locally too. See below.

Install

see install.sh

Run

see run.sh

Check Code

pre-commit run --all-files
scripts/copy_test_data.sh
pytest --cov --cov-report=html:coverage_report

Config

see .streamlit/config.toml see .streamlit/secrets.toml

SonarQube Code Analysis

At sonarcloud.io

If you want unit test coverage reports in SonarQube, you need to run the sonar check in the GitHub Action pipeline:

TODOs

Features

Open Feature TODOs

  • some text to explain features

Done Feature TODOs

  • activity caching: all or selected years only
  • activity geo calculations
  • gear download
  • activity table
  • activity statistics
  • activity year summary
  • activity active days per year
  • known locations edit and list unknown frequent locations
  • choose km vs. miles
  • calendar export

Technical Features

Open Dev TODOs

  • why is supervisorctl log empty supervisorctl tail -f strava-streamlit
  • reconnect after token expired
  • unit tests for act stats

Done Dev TODOs

  • Strava login
  • Strava logout/deauthorize
  • Strava token refresh
  • Strava logos and buttons
  • API response caching for local dev environment
  • unit tests using dummy activity data

Deployment at Uberspace

Python version for local dev

As my webserver is running Python 3.11, I need to use it locally too.

Variant 1: use venv

.pyenv/versions/3.11.9/bin/python -m venv .venv --prompt $(basename $(pwd))
source .venv/bin/activate

Variant 2: use global pyenv

pyenv global 3.11.9
eval "$(pyenv init -)"

.vscode/settings.json

{
    "python.defaultInterpreterPath": ".pyenv/versions/3.11.9/bin/python"
}

Setup

see https://entorb.net/wickie/Uberspace#Streamlit

mkdir ~/strava-streamlit

# run scripts/deploy.sh

pip3.11 install --user streamlit -r strava-streamlit/requirements.txt

# start it manually (stop by ctrl+c)
streamlit run main.py

# add web backend
uberspace web backend set /strava-streamlit --http --port 8501

verify it is working via browser https://entorb.net/strava-streamlit

stop streamlit via ctrl+c

create service vim ~/etc/services.d/strava-streamlit.ini

[program:strava-streamlit]
directory=%(ENV_HOME)s/strava-streamlit
command=python3.11 -O -m streamlit run src/main.py
loglevel=info

start service

supervisorctl reread
supervisorctl update
supervisorctl status
supervisorctl restart strava-streamlit

Check log

 supervisorctl tail -f strava-streamlit
 tail -f ~/logs/supervisord.log

TODO: why is the output first command not showing the logs?

Deploy update

see deploy.sh

About

Strava Äpp V2 using Streamlit

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published