This repository has been archived by the owner on Sep 8, 2022. It is now read-only.
forked from dmarx/psaw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (42 loc) · 1.44 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
PROJECT_NAME=pushshift.py
SRC_PATH=pushshift_py/
TESTS_PATH=tests/
define msg
@printf "\033[36m# %s\033[0m\n" $(1)
endef
test:
$(call msg,"Running tests")
python -m pytest $(TESTS_PATH)
format:
$(call msg,"Running Black Python formatter")
find $(SRC_PATH) $(TESTS_PATH) -iname "*.py" | xargs black
lint:
$(call msg,"Running PyLint (minus TODOs)")
find $(SRC_PATH) $(TESTS_PATH) -iname "*.py" | xargs pylint --disable=fixme
todos:
$(call msg,"Retrieving TODO lines")
find $(SRC_PATH) $(TESTS_PATH) -iname "*.py" | xargs pylint | grep '\[W0511(fixme),*'
code-coverage:
$(call msg,"Running coverage.py")
python -m pytest --cov=$(SRC_PATH) $(TESTS_PATH)
travis-coverage:
$(call msg,"Running coverage.py formatted for build")
python -m pytest --cov-report xml --cov=$(SRC_PATH) $(TESTS_PATH)
create-venv:
$(call msg,"Creating a virtualenv for this project")
virtualenv venv
venv/bin/pip3.7 install -r requirements.txt
echo "$(shell pwd)/$(SRC_PATH)" > venv/lib/python3.7/site-packages/$(PROJECT_NAME).pth
echo "$(shell pwd)/$(TESTS_PATH)" > venv/lib/python3.7/site-packages/test-$(PROJECT_NAME).pth
test-publish:
$(call msg,"Test publishing to PyPI")
rm dist/*.whl | true
rm dist/*.tar.gz | true
python setup.py sdist bdist_wheel
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
publish:
$(call msg,"Publishing to PyPI")
rm dist/*.whl | true
rm dist/*.tar.gz | true
python setup.py sdist bdist_wheel
twine upload dist/*