A framework to create command line interfaces with Python, using only Python's standard libraries, like argparse.
Check the project's documentation here.
To use (or contribute to) the framework, it is necessary the following tools:
- Python 3.7 or higher
Choose one of the next sections to setup your development environment.
To create a virtual environment, run
python3 -m venv .venv
To activate the virtual environment, run
source .venv/bin/activate
To install the framework's development requirements in the virtual environment, run
pip install -r requirements/dev.txt
To add the framework's tools to the path, run
pip install -e .
To deactivate the virtual environment, run deactivate
.
Run the commands of the following sections with the virtual environment active.
To install the framework's development requirements in a virtual environment, run
poetry install
To activate the virtual environment, run
poetry shell
To deactivate the virtual environment, run CTRL+D
or exit
.
To update the requirements file, run
poetry export --format requirements.txt --output requirements/dev.txt --with dev
Run the commands of the following sections with the virtual environment active.
To connect to project's Docker container shell, run
docker/run.sh
To exit the container's shell, run CTRL+D
or exit
.
To run Dockerfile linter, run
docker/lint.sh
To run Docker image security vulnerability scan, run
docker/scan.sh
It is needed to have an account in Docker Hub.
To remove the project's containers, images, volumes and networks, run
docker/down.sh
To change Docker configuration, change the variables in .env
file.
Run the commands of the following sections in the container's shell.
The quality measures of the framework are reproduced by the continuos integration (CI) pipeline of the project. CI configuration in .github/workflows/ci.yml
file.
To run tests and coverage report, run
pytest
To see the html report, check the tests/coverage-results/htmlcov/index.html
file generated by the command.
Tests and coverage configuration in pyproject.toml
file.
To run Python type checker, run
mypy .
Python type checker configuration in pyproject.toml
file.
To run Python linter, run
prospector
prospector --profile tests/.prospector.yaml tests
Python linter configuration in .prospector.yaml
and tests/.prospector.yaml
files.
To check Python code imports format, run
isort --check --diff .
To format Python code imports, run
isort .
To check Python code format, run
black --check --diff .
To format Python code, run
black .
isort and black configuration in pyproject.toml
file.
To check all repository's files format, run
ec -verbose
File format configuration in .editorconfig
file.
To check common security issues in Python code, run
bandit --recursive cly
To check known security vulnerabilities in Python dependencies, run
safety check --file requirements/dev.txt --full-report
To check Python documentation generation, run
sphinx-apidoc --module-first --private --output-dir docs/modules cly
sphinx-build -W -T -v -n -a docs public
To generate Python documentation, run
sphinx-apidoc --module-first --private --output-dir docs/modules cly
sphinx-build -v -n -a docs public
To see the documentation, check the public/index.html
file that the command generated.
Sphinx configuration in docs/conf.py
file.
The documentation is updated automatically by the continuous deploy (CD) pipeline of the project. CD configuration in .github/workflows/cd.yml
file.
SonarCloud analyzes the source code of the project through the CI pipeline.
To configure pre-commit automatically when cloning the repo, run
pip install pre-commit
git config --global init.templateDir ~/.git-template
pre-commit init-templatedir --hook-type commit-msg --hook-type pre-commit ~/.git-template
Must be installed globally. More information here.
To configure pre-commit locally, run
pre-commit install --hook-type commit-msg --hook-type pre-commit
with your virtual environment active.
To test it, run
pre-commit run --all-files
pre-commit configuration in .pre-commit-config.yaml
file.
This repository is licensed under the terms of MIT License.