-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
64 lines (54 loc) · 1.67 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# python version used to bootstrap local development environment
PYTHON_VERSION=3.9.6
PROJECT_NAME=dockerfile-recover
# create virtual environment using pyenv
create-venv:
# install target python version if it does not exist
pyenv install --skip-existing ${PYTHON_VERSION}
# create virtual environment
pyenv virtualenv --force ${PYTHON_VERSION} ${PROJECT_NAME}
# automatically activate virtual environment
pyenv local ${PROJECT_NAME}
# remove all installed packages from active virtual environment
clean:
pip freeze | cut -d ' ' -f1 | xargs --no-run-if-empty pip uninstall -y
# install project dependencies
install:
# use latest pip
python -m pip install --upgrade pip
# use poetry for dependency management
poetry install
# export dependencies for external build process
lock:
# ensure lock file is up to date
poetry lock
# export requirements to simplify external build processes
poetry export --dev --without-hashes --output requirements-dev.txt
poetry export --without-hashes --output requirements-container.txt
# run tests
test:
pytest
coverage:
coverage run -m pytest
coverage report --fail-under=100
# lint code
lint:
# sort import statements
isort .
# format code with black
black .
# run static type checker
mypy dockerfile_recover tests --ignore-missing-imports
# run static code analysis
pylint dockerfile_recover tests
# check linting without changing source files
check-lint:
# check imports
isort --check-only .
# check code formatting
black --check .
# build and test the entire project
build: lock install lint coverage
# install poetry
get-poetry:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -