Skip to content

Instantly share code, notes, and snippets.

@reetasingh
Last active January 4, 2021 20:13
Show Gist options
  • Save reetasingh/0cf2b9415e48de48da38b4269d8a698f to your computer and use it in GitHub Desktop.
Save reetasingh/0cf2b9415e48de48da38b4269d8a698f to your computer and use it in GitHub Desktop.
Makefile for python3 project.
# change <repo> with name of your actual repo
test: # run make setup before this
@echo *************Running tests*************; \
source .venv/bin/activate; \
pytest --junitxml htmlcov/codecov-results.xml --cov . --cov-config test/.coveragerc --cov-report html --cov-report xml
lint: # run make setup before this
@echo *************Running lint*************; \
source .venv/bin/activate; \
pylint <repo>/
format: # run make setup before this
@echo *************Formatting code using black*************; \
source .venv/bin/activate; \
black <repo>/ --exclude \.<repo>/vendor/*
build: # run make setup before this
@echo *************Buildr*************; \
source .venv/bin/activate; \
python3 setup.py -q sdist bdist_wheel
install: # run make setup and make build before this
source .venv/bin/activate; \
pip3 install -q dist/<repo>-*.whl
pip3 install .
uninstall:
pip3 uninstall <repo>
clean:
@echo *************Removing files for cleanup*************; \
rm -rf .venv
rm -rf dist/
rm -rf build/
rm -rf *.egg-info*
rm -rf build/bdist*
rm -rf build/lib.*
rm coverage.xml
rm test_results.xml
rm -rf .cache/
rm -rf .coverage
rf -rf package
rm pylint.out
setup:
@echo *************Setting up virtual env*************; \
pip3 install virtualenv; \
virtualenv -p python3 .venv
source .venv/bin/activate; \
pip3 install -r requirements.txt; \
@reetasingh
Copy link
Author

reetasingh commented Dec 23, 2020

change <repo> with name of your actual repo.
commands are run within a virtual env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment