Skip to content

Developper instructions

Florian Blanchet edited this page Apr 30, 2021 · 20 revisions

Clone

git clone https://github.com/NotANameServer/incipyt
cd incipyt

Setup virtual environment and incipyt package

Linux

python -m venv .env
source .env/bin/activate
python -m pip install --upgrade pip flit
python -m flit install --pth-file --deps develop

Windows

py -m venv .env
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
.\venv\Scripts\Activate.ps1
python -m pip install --upgrade pip flit
python -m flit install --pth-file --deps develop

Setup pre-commit for formatter and linter

pre-commit install --install-hooks --overwrite

You can test pre-commit with pre-commit run --all-files

Run formatter and linter on all project files

python -m black incipyt
python -m flakehell lint incipyt

Build

python -m build --no-isolation

VSCode recommended : .vscode/settings.json

{
    "git.allowForcePush": true,
    "git.confirmForcePush": false,
    "python.disableInstallationCheck": true,
    "editor.formatOnSave": true,
    "python.formatting.blackPath": ".env/bin/black",
    "python.formatting.provider": "black",
    "python.linting.flake8CategorySeverity.W": "Error",
    "python.linting.flake8Enabled": true,
    "python.linting.flake8Path": ".env/bin/flake8helled",
    "python.terminal.activateEnvInCurrentTerminal": true,
}

Also install pre-commit globally: pipx install pre-commit

Commit your changes using Conventional Commits

feat: project initialization

We decided to use pep517 pyproject.toml with flit, we decided to use
pre-commit to automate linting and stuff.

We decided to use flit over setuptools, poetry and pdm because it is
mostly pep517 and pep621 compatible (unless setuptools) and it just does
the job of building and publishing the package (unless poetry and pdm).

We decided to use pre-commit with a large range of linters to ease the
development between contributors. Among the "stuff" we enabled are: file
sanitizers (line endind, useless whitespaces, line line at end of file),
file checker (python, toml, yaml), linter and formatter (python) and
some security watchdogs (don't commit those private keys!).

We decided to use pytest over unittest, we just want to give that
framework a try. We decided to use the boring sphinx because nothing
else seems funny enough to us.

Closes #3
Clone this wiki locally