Skip to content

Commit

Permalink
taskfile
Browse files Browse the repository at this point in the history
  • Loading branch information
orsinium committed Jan 14, 2021
1 parent db0fa67 commit f76f6f8
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.mypy_cache/
.pytest_cache/
__pycache__/
/venvs/
91 changes: 91 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# https://taskfile.dev/
version: "3"

vars:
PYTHON_BIN: python3.7
VENVS: ./venvs/
FLAKE8_ENV: "{{.VENVS}}flake8"
MYPY_ENV: "{{.VENVS}}mypy"
FLIT_ENV: "{{.VENVS}}flit"
PYTEST_ENV: "{{.VENVS}}pytest"
SPHINX_ENV: "{{.VENVS}}sphinx"
ISORT_ENV: "{{.VENVS}}isort"

env:
FLIT_ROOT_INSTALL: "1"

tasks:
venv:create:
status:
- "test -f {{.ENV}}/bin/activate"
cmds:
- "{{.PYTHON_BIN}} -m venv {{.ENV}}"
- "{{.ENV}}/bin/python3 -m pip install -U pip setuptools wheel"
flit:init:
status:
- "test -f {{.FLIT_ENV}}/bin/flit"
deps:
- task: venv:create
vars:
ENV: "{{.FLIT_ENV}}"
cmds:
- "{{.FLIT_ENV}}/bin/python3 -m pip install flit"
flit:install:
sources:
- pyproject.toml
- "{{.ENV}}/bin/activate"
deps:
- flit:init
- task: venv:create
vars:
ENV: "{{.ENV}}"
cmds:
- >
{{.FLIT_ENV}}/bin/flit install
--python={{.ENV}}/bin/python3
--deps=production
--extras={{.EXTRA}}
flake8:run:
sources:
- "**/*.py"
deps:
- task: flit:install
vars:
ENV: "{{.FLAKE8_ENV}}"
EXTRA: dev
cmds:
- "{{.FLAKE8_ENV}}/bin/flake8 ."

mypy:run:
sources:
- deal/**/*.py
deps:
- task: flit:install
vars:
ENV: "{{.MYPY_ENV}}"
EXTRA: dev
cmds:
- "{{.MYPY_ENV}}/bin/mypy --ignore-missing-imports --allow-redefinition deal/"

pytest:run:
sources:
- deal/
deps:
- task: flit:install
vars:
ENV: "{{.PYTEST_ENV}}"
EXTRA: plugins,dev
cmds:
- "{{.PYTEST_ENV}}/bin/pytest tests/"

isort:run:
sources:
- "**/*.py"
deps:
- task: flit:install
vars:
ENV: "{{.ISORT_ENV}}"
EXTRA: plugins,dev
cmds:
- "{{.ISORT_ENV}}/bin/isort ."
6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
max-line-length = 120
ignore = C408
exclude =
setup.py
venvs/

0 comments on commit f76f6f8

Please sign in to comment.