Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ jobs:
strategy:
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
Expand All @@ -30,8 +29,8 @@ jobs:
POETRY_VIRTUALENVS_CREATE: false
- name: Check formatting
run: poetry run black --check .
- name: Lint with flakehell
run: poetry run flakehell lint pydpkg test
- name: Lint with flakeheaven
run: poetry run flakeheaven lint pydpkg test
- name: Lint with pylint
run: poetry run pylint -d R0912 -d W0511 pydpkg/
- name: Lint with pycodestyle (aka pep8)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
POETRY_VIRTUALENVS_CREATE: false
- name: Check formatting
run: poetry run black --check .
- name: Lint with flakehell
run: poetry run flakehell lint pydpkg test
- name: Lint with flakeheaven
run: poetry run flakeheaven lint pydpkg test
- name: Lint with pylint
run: poetry run pylint -d R0912 -d W0511 pydpkg/
- name: Lint with pycodestyle (aka pep8)
Expand Down
47 changes: 25 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ SHELL = /bin/bash
NAME := pydpkg
PYMAJOR := 3
PYREV := 10
PYPATCH := 0
PYPATCH := 7
PYVERSION := ${PYMAJOR}.${PYREV}.${PYPATCH}
PYENV := ${HOME}/.pyenv/versions/${PYVERSION}
VENV_NAME := ${NAME}-${PYVERSION}
VENV := ${PYENV}/envs/${VENV_NAME}
PYTHON_BIN := ${VENV}/bin/python
POETRY_BIN := ${VENV}/bin/poetry
EGGLINK := ${VENV}/lib/python${PYMAJOR}.${PYREV}/site-packages/${NAME}.egg-link
export VIRTUAL_ENV := ${VENV}
export PYENV_VERSION := ${VENV_NAME}
Expand Down Expand Up @@ -45,23 +47,23 @@ else
endif

${PYENV}: ${BREW_SSL} ${BREW_READLINE} ${PYENV_BIN}
${ARCH_PREFIX} pyenv install -s ${PYVERSION}
${ARCH_PREFIX} ${PYENV_BIN} install -s ${PYVERSION}

${VENV}: ${PYENV}
${ARCH_PREFIX} ${PYENV_BIN} virtualenv ${PYVERSION} ${VENV_NAME}
${ARCH_PREFIX} python -m pip install -U pip setuptools wheel
${ARCH_PREFIX} python -m pip install -U poetry
${ARCH_PREFIX} poetry config virtualenvs.create false --local
${ARCH_PREFIX} poetry config virtualenvs.in-project false --local
${ARCH_PREFIX} ${PYTHON_BIN} -m pip install -U pip setuptools wheel
${ARCH_PREFIX} ${PYTHON_BIN} -m pip install -U poetry
${ARCH_PREFIX} ${POETRY_BIN} config virtualenvs.create false --local
${ARCH_PREFIX} ${POETRY_BIN} config virtualenvs.in-project false --local

.python-version: ${VENV}
echo ${VENV_NAME} >.python-version
echo ${PYVERSION}/envs/${VENV_NAME} >.python-version

poetry.lock:
poetry lock
${ARCH_PREFIX} ${POETRY_BIN} lock

${EGGLINK}: poetry.lock
poetry install
${ARCH_PREFIX} ${POETRY_BIN} install
touch ${EGGLINK}

setup: .python-version ${EGGLINK}
Expand All @@ -72,41 +74,42 @@ clean:
nuke:
git clean -fdx -e '*.ipynb'
rm -f .python-version
pyenv uninstall -f ${VENV_NAME}
${ARCH_PREFIX} ${PYENV_BIN} uninstall -f ${PYVERSION}/envs/${VENV_NAME}

update: pyproject.toml
poetry install
poetry update
${ARCH_PREFIX} ${POETRY_BIN} lock
${ARCH_PREFIX} ${POETRY_BIN} install
${ARCH_PREFIX} ${POETRY_BIN} update

format: setup
poetry run isort . && poetry run black .
${ARCH_PREFIX} ${POETRY_BIN} run isort . && poetry run black .

format-check: setup
poetry run isort --check . && poetry run black --check .
${ARCH_PREFIX} ${POETRY_BIN} run isort --check . && poetry run black --check .

test: black pylint flakehell pycodestyle pytest
test: black pylint flakeheaven pycodestyle pytest
@echo "Running all tests"

pytest: setup
@echo "Running unit tests"
poetry run pytest -p no:warnings tests
${ARCH_PREFIX} ${POETRY_BIN} run pytest -p no:warnings tests

black: setup
@echo "Checking code formatting and imports..."
poetry run black --check .
${ARCH_PREFIX} ${POETRY_BIN} run black --check .

pylint: setup
@echo "Linting code style with pylint..."
poetry run pylint -d R0912 -d W0511 ${NAME}
${ARCH_PREFIX} ${POETRY_BIN} run pylint -d R0912 -d W0511 ${NAME}

flakehell: setup
@echo "Linting code style with flakehell..."
poetry run flakehell lint ${NAME} test
flakeheaven: setup
@echo "Linting code style with flakeheaven..."
${ARCH_PREFIX} ${POETRY_BIN} run flakeheaven lint ${NAME} test

pycodestyle: setup
@echo "Linting codestyle with pycodestyle (formerly pep8)"
@# ignore E203 because pep8 and black disagree about whitespace before ':'
poetry run pycodestyle --max-line-length=120 --ignore=E203 ${NAME}
${ARCH_PREFIX} ${POETRY_BIN} run pycodestyle --max-line-length=120 --ignore=E203 ${NAME}

install: setup

Expand Down
Loading