diff --git a/Makefile b/Makefile index e3c7d9694c41101ecc397e2d9b06d701954a931c..6fdcc8607a4a2c78f32042028580a074aecc9cd3 100644 --- a/Makefile +++ b/Makefile @@ -24,4 +24,5 @@ clean: # Remove files not tracked in source control lint: # Lint code ${VIRTUAL_ENV}/bin/black --check --quiet cli/*.py ${VIRTUAL_ENV}/bin/flake8 --config=setup.cfg + ${VIRTUAL_ENV}/bin/pydocstyle ${VIRTUAL_ENV}/bin/pylint --rcfile=setup.cfg cli/*.py diff --git a/README.md b/README.md index 0fc4b47c8771ebb2253187000956574a9748625b..e09aaaf9c8a34b7599ddcfd9ef2d490041f91d36 100644 --- a/README.md +++ b/README.md @@ -43,9 +43,9 @@ 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 +- Follow our [`git` conventions](https://forga.gitlab.io/process/fr/manuel/convention/git/) (🇫🇷 only) - 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) +- Code linting with [`flake8`](https://pypi.org/project/flake8/), [`pylint`](https://pypi.org/project/pylint), [`black`](https://pypi.org/project/black) & [pydocstyle](https://pypi.org/project/pydocstyle/). - Install development tools: * `pip install -r requirements-dev.txt` - A `Makefile` with tools : run `make help` to have a look diff --git a/cli/api.py b/cli/api.py index 036123e34fc85e018d453cbf798d92fc5e97d582..9bdd0a572d0f887acbbfb24085bfd5e49fcbcd57 100644 --- a/cli/api.py +++ b/cli/api.py @@ -1,13 +1,14 @@ -""" -API utilities -""" - +#!/usr/bin/env python3 +# coding:utf-8 +"""Strava's API helpers.""" from strava.api._helpers import client, url, json def post_activity(xargs): - """API call to create an activity""" + """Post an activity creation. + Activity creation is made only with parameters (no GPX file). + """ response = client.post(url=url("/activities"), data=xargs) if response.ok: diff --git a/cli/commands.py b/cli/commands.py index b4451e9266fb5838e236875648dfb8e8fdafbc0f..59e26b57be021cb9408f33bd2a55a3387c4f79f6 100644 --- a/cli/commands.py +++ b/cli/commands.py @@ -1,5 +1,8 @@ -""" -CLI commands +#!/usr/bin/env python3 +# coding:utf-8 +"""Manage CLI commands. + +Each function describes a CLI command. """ import datetime @@ -83,7 +86,7 @@ _ACTIVITY_COLUMNS = ("key", "value") @output_option() @login_required def post_create(**kwargs): - """Create an activity""" + """Create an activity (manually).""" xargs = { "name": kwargs["name"], "type": kwargs["activity_type"], diff --git a/cli/main.py b/cli/main.py index 9a98d1d0d888109d15459c90e3e626dd25388964..c1e713c0c33779746f2fc21bb205edeee934a82c 100644 --- a/cli/main.py +++ b/cli/main.py @@ -1,12 +1,10 @@ #!/usr/bin/env python3 # coding:utf-8 -""" -run.py: CLI launcher, just run it +"""Geostrapy CLI. -Add `geostrapy` commands to `strava-cli` +Share data related to physical activities over an API (geo-localized or not) +This module adds commands for `strava-cli` https://github.com/bwilczynski/strava-cli """ - - import click from strava.commands import ( @@ -20,10 +18,7 @@ from commands import post_create @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 - """ + """Launch the CLI.""" cli.add_command(login) diff --git a/requirements-dev.txt b/requirements-dev.txt index a6d00faae063ae2e7bff4ad6903540aa844bb791..583e3e50cef67a60e1b22bccfd2e7b962375e668 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,4 @@ black flake8 +pydocstyle pylint