Advertisement
britodfbr

Makefile_v1

Dec 10th, 2021 (edited)
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.36 KB | None | 0 0
  1. .DEFAULT_GOAL := help
  2.  
  3. setup: ## setup environment python with poetry
  4. setup:
  5.     @poetry env use 3.10
  6.  
  7. install:  ## Install this package using poetry
  8. install: setup
  9.     @poetry add incolumepy.makefilelicense
  10.  
  11.  
  12. .PHONY: clean clean-all flake8 format help lint mypy prerelease release test tox
  13.  
  14. help:  ## Show this instructions
  15.     @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
  16.  
  17. mypy: ## mypy checking
  18.     @echo "mypy checking .."
  19.     @mypy incolumepy/
  20.  
  21. flake8: ## flake8 checking
  22.     @echo "flake8 checking .."
  23.     @flake8 --config pyproject.toml incolumepy/
  24.  
  25. check-isort:  ## check isort
  26.     @echo "isort checking .."
  27.     @isort --check --atomic --py all incolumepy/ tests/
  28.  
  29. isort:  ## isort apply
  30.     @isort --atomic --py all incolumepy/ tests/ && git commit -m "Applied Code style isort format automaticly at `date +"%F %T"`" . || echo
  31.     @echo ">>>  Applied code style isort format automaticly  <<<"
  32.  
  33. check-black: ## black checking
  34.     @echo "Black checking .."
  35.     @black --check incolumepy/ tests/
  36.  
  37. black:  ##Apply code style black format
  38.     @poetry run black incolumepy/ tests/ && git commit -m "Applied Code style Black format automaticly at `date +"%F %T"`" . || echo
  39.     @echo ">>>  Applied code style Black format automaticly  <<<"
  40.  
  41. .PHONY: check-docstyle
  42. check-docstyle: ## docstring checking
  43.     @echo "docstyle checking .."
  44.     @pydocstyle incolumepy/ tests/
  45.  
  46. pylint:  ## pylint checking
  47.     @echo "pylint checking .."
  48.     @pylint incolumepy/ tests/
  49.  
  50. lint:  ## Run all linters (check-isort, check-black, flake8, pylint, mypy, docstyle)
  51. lint: mypy pylint flake8 check-docstyle check-isort check-black
  52.  
  53. test: ## Run all tests avaliable and generate html coverage
  54. test: lint
  55.     @pytest  tests/ -vv --cov=incolumepy.makefilelicense --cov-report='html'
  56.  
  57. clean: ## Shallow clean into environment (.pyc, .cache, .egg, .log, et all)
  58.     @echo -n "Cleanning environment .."
  59.     @find ./ -name '*.pyc' -exec rm -f {} \;
  60.     @find ./ -name '*~' -exec rm -f {} \;
  61.     @find ./ -name 'Thumbs.db' -exec rm -f {} \;
  62.     @find ./ -name '*.log' -exec rm -f {} \;
  63.     @find ./ -name ".cache" -exec rm -fr {} \;
  64.     @find ./ -name "*.egg-info" -exec rm -rf {} \;
  65.     @find ./ -name "*.coverage" -exec rm -rf {} \;
  66.     @rm -rf docs/_build
  67.     @echo " Ok."
  68.  
  69. clean-all: ## Deep cleanning into environment (dist, build, htmlcov, .tox, *_cache, et all)
  70. clean-all: clean
  71.     @echo -n "Deep cleanning .."
  72.     @rm -rf dist
  73.     @rm -rf build
  74.     @rm -rf htmlcov
  75.     @rm -rf .tox
  76.     @rm -rf ".pytest_cache" ".mypy_cache"
  77.     @#fuser -k 8000/tcp &> /dev/null
  78.     @poetry env list|awk '{print $1}'|while read a; do poetry env remove $${a}; done
  79.     @echo " Ok."
  80.  
  81. prerelease: ## Generate new prerelease commit version default semver
  82. prerelease: test format
  83.     @v=$$(poetry version prerelease); poetry run pytest tests/ && git commit -m "$$v" pyproject.toml $$(find -name version.txt)  #sem tag
  84.  
  85. release: test ## Generate new release commit with version/tag default semver
  86.     @msg=$$(poetry version patch); poetry run pytest tests/; \
  87. git commit -m "$$msg" pyproject.toml $$(find -name version.txt) \
  88. && git tag -f $$(poetry version -s) -m "$$msg"; \
  89. git checkout main; git merge --no-ff dev -m "$$msg" \
  90. && git tag -f $$(poetry version -s) -m "$$msg" \
  91. && git checkout dev
  92.  
  93. format: ## Formate project code with code style (isort, black)
  94. format: clean isort black
  95.  
  96. tox: ## Run tox completly
  97.     @poetry run tox
  98.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement