Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 0134e1d1 authored by Freezed's avatar Freezed
Browse files

:sparkles: Integrate `strava-cli` & add devel tools

A copy of CLI launcher from `strava-cli` is made to permit commands addition on top of `strava-cli`
All Python tooling is added too.

Squashed commit, fix jobs:
- https://lab.frogg.it/fcode/geostrapy/-/jobs/30004
- https://lab.frogg.it/fcode/geostrapy/-/jobs/30005
parent b01f3552
No related branches found
No related tags found
1 merge request!1Resolve "strava-cli integration"
Pipeline #4253 passed
stages:
- lint
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip
- /var/venv/
lint:
image: python:3.9-slim
stage: lint
except:
- /^wip-.*$/
- /^old-.*$/
script:
- python -V
- apt-get update -qq && apt-get -qq -y install make python3-venv
- python3 -m venv /var/venv/
- source /var/venv/bin/activate
- pip install -r requirements.txt
- pip install -r requirements-dev.txt
- make --no-print-directory lint
Makefile 0 → 100644
EDITOR = geany
help: # Print help on Makefile
@grep '^[^.#]\+:\s\+.*#' Makefile | \
sed "s/\(.\+\):\s*\(.*\) #\s*\(.*\)/`printf "\033[93m"`\1`printf "\033[0m"` \3/" | \
expand -t20
open_all: # Open all projects files
${EDITOR} ${VIRTUAL_ENV}/bin/activate
${EDITOR} .gitignore .gitlab-ci.yml Makefile README.md requirements.txt requirements-dev.txt setup.cfg
${EDITOR} .git/hooks/p*-commit
${EDITOR} cli/run.py
pre_commit: # Run the pre-commit hook
.git/hooks/pre-commit
clean: # Remove files not tracked in source control
rm -rf htmlcov .pytest_cache
find . -type f -name "*.orig" -delete
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -delete
find . -type d -empty -delete
lint: # Lint code
${VIRTUAL_ENV}/bin/black --check --quiet cli/*.py
${VIRTUAL_ENV}/bin/flake8 --config=setup.cfg
${VIRTUAL_ENV}/bin/pylint --rcfile=setup.cfg cli/*.py
......@@ -9,7 +9,7 @@ A python CLI to share data related to physical activities over an API (geo-local
1. Use services like [Strava](https://www.strava.com) to follow my physical activities (any other service is welcome)
1. Keep control over the data I share: just what I need ([_proportionality & relevance_](https://www.cnil.fr/fr/cnil-direct/question/quels-sont-les-grands-principes-des-regles-de-protection-des-donnees))
1. Respect python guidelines proposed by _Vincent Bernat_ ( [🇫🇷](https://vincent.bernat.ch/fr/blog/2019-script-python-durable) | [🇬🇧](https://vincent.bernat.ch/en/blog/2019-sustainable-python-script) ).
1. Respect python scripting guidelines proposed by _Vincent Bernat_ ( [🇫🇷](https://vincent.bernat.ch/fr/blog/2019-script-python-durable) | [🇬🇧](https://vincent.bernat.ch/en/blog/2019-sustainable-python-script) ).
✨ (planed) Features
......@@ -24,10 +24,43 @@ These are imagined with _[Strava](https://developers.strava.com/docs/reference/)
* [crop start, end & stop points](https://lab.frogg.it/fcode/geostrapy/-/issues/4)
* [change start-time](https://lab.frogg.it/fcode/geostrapy/-/issues/5)
* [Post GPX file as activity](https://lab.frogg.it/fcode/geostrapy/-/issues/6)
* [Process GPX multi-track file](7)
* [Process GPX multi-track file](https://lab.frogg.it/fcode/geostrapy/-/issues/7)
* and [maybe more](https://lab.frogg.it/fcode/geostrapy/-/boards)
🚀 Quickstart
-------------
```bash
git clone git@lab.frogg.it:fcode/geostrapy.git && cd geostrapy
/<path>/<to>/python3.9 -m venv ~/.venvs/geostrapy
source ~/.venvs/geostrapy/bin/activate
pip install -r requirements.txt
python cli/run.py --help
```
🚧 Development
--------------
- [Topic branches](https://git-scm.com/book/en/v2/Git-Branching-Branching-Workflows#_topic_branch) are used and named after issue's slug
- Built with `Python 3.9`
- Code linting with [`flake8`](https://pypi.org/project/flake8/), [`pylint`](https://pypi.org/project/pylint) & [`black`](https://pypi.org/project/black)
- Install development tools:
* `pip install -r requirements-dev.txt`
- A `Makefile` with tools : run `make help` to have a look
- Use the `pre-commit` git hook, [CI will run it](.gitlab-ci.yaml)
* `echo "make --no-print-directory lint" > .git/hooks/pre-commit`
* `chmod u+x .git/hooks/pre-commit`
### 📌 Dependences
Details in [`requirements.txt`](requirements.txt) & [`requirements-dev.txt`](requirements-dev.txt)
- [`strava-cli`](https://github.com/bwilczynski/strava-cli)
### 🤝 Contributing
- Roadmap ➡️ [_project kanban_](https://lab.frogg.it/fcode/geostrapy/-/boards)
......
#!/usr/bin/env python3
# coding:utf-8
"""
run.py: CLI launcher, just run it
Add `geostrapy` commands to `strava-cli`
"""
import click
from strava.commands import (
login,
logout,
set_config,
)
@click.group()
def cli():
"""
Share data related to physical activities over an API (geo-localized or not)
Add commands for `strava-cli` https://github.com/bwilczynski/strava-cli
"""
cli.add_command(login)
cli.add_command(logout)
cli.add_command(set_config)
if __name__ == "__main__":
cli()
black
flake8
pylint
click==8.0.4
strava-cli==0.6.1
[flake8]
max-line-length = 90
[pylint]
output-format = colorized
score = n
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment