只有docs寫在.PHONY的定義內,可能是因為相同目錄下有一個docs的目錄
總共有8個target,大量使用pipenv
test-readme
和publish
使用到setup.py
py.test
是一個和pytest套件有關的指令,在pytest3.0後建議使用pytest
flake8
是一個靜態程式碼檢查工具
.PHONY: docs
init:
pip install pipenv --upgrade
pipenv install --dev
test:
# This runs all of the tests, on both Python 2 and Python 3.
detox
ci:
pipenv run py.test -n 8 --boxed --junitxml=report.xml
test-readme:
@pipenv run python setup.py check --restructuredtext --strict && ([ $$? -eq 0 ] && echo "README.rst and HISTORY.rst ok") || echo "Invalid markup in README.rst or HISTORY.rst!"
flake8:
pipenv run flake8 --ignore=E501,F401,E128,E402,E731,F821 requests
coverage:
pipenv run py.test --cov-config .coveragerc --verbose --cov-report term --cov-report xml --cov=requests tests
publish:
pip install 'twine>=1.5.0'
python setup.py sdist bdist_wheel
twine upload dist/*
rm -fr build dist .egg requests.egg-info
docs:
cd docs && make html
@echo "\033[95m\n\nBuild successful! View the docs homepage at docs/_build/html/index.html.\n\033[0m"