From 3d0b0b1a4cd10a2eb7efc209f36ede93319cddc8 Mon Sep 17 00:00:00 2001 From: chris48s Date: Sat, 2 Sep 2023 21:06:09 +0100 Subject: [PATCH] use local .venv, manage venv via makefile --- .flake8 | 1 + .github/workflows/test.yml | 2 +- .gitignore | 3 +++ CONTRIBUTING.md | 5 +++++ Makefile | 21 +++++++++++++++++---- 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/.flake8 b/.flake8 index a6f727b..d5d875c 100644 --- a/.flake8 +++ b/.flake8 @@ -1,2 +1,3 @@ [flake8] ignore = E501, W503 +exclude = .venv diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a6a850d..f2c06c6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,7 +29,7 @@ jobs: run: make lint - name: Ensure package builds - run: flit build + run: make build - name: Upload coverage report to codecov uses: codecov/codecov-action@v3 diff --git a/.gitignore b/.gitignore index 5eb6da6..03c4533 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ pip_abandoned.egg-info/ # test coverage .coverage coverage.xml + +# venv +.venv diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 83bb745..50eee14 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,3 +13,8 @@ Development Tasks: * Run the test suite: `make test` * Run lint checks: `make lint` * Auto-format: `make format` + +Virtual Env Management: + +* `source .venv/bin/activate` +* `deactivate` diff --git a/Makefile b/Makefile index db60868..4bd5c19 100644 --- a/Makefile +++ b/Makefile @@ -1,28 +1,41 @@ SHELL := /bin/bash -.PHONY: help format install lint test release +.PHONY: build help format install lint test release venv help: @grep '^\.PHONY' Makefile | cut -d' ' -f2- | tr ' ' '\n' +venv: + python3 -m venv .venv + format: - isort --profile black . + source .venv/bin/activate && \ + isort --profile black . && \ black . install: + python3 -m venv .venv + source .venv/bin/activate && \ pip install -e .[dev] lint: - isort --profile black -c --diff . - black --check . + source .venv/bin/activate && \ + isort --profile black -c --diff . && \ + black --check . && \ flake8 . test: + source .venv/bin/activate && \ pytest --cov=pip_abandoned --cov-report term --cov-report xml ./tests +build: + source .venv/bin/activate && \ + flit build + release: # usage: `make release version=0.0.0` make test @echo "" make lint @echo "" + source .venv/bin/activate && \ ./release.sh "$(version)"