Skip to content

Instantly share code, notes, and snippets.

@rednafi
Last active December 24, 2024 05:44
Show Gist options
  • Save rednafi/7b3b232a2c4b13875b7d6e6d7e0f8d85 to your computer and use it in GitHub Desktop.
Save rednafi/7b3b232a2c4b13875b7d6e6d7e0f8d85 to your computer and use it in GitHub Desktop.
Applying Black, Flake8, Isort and typechecking with mypy
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
.PHONY: venvcheck ## Check if venv is active
venvcheck:
ifeq ("$(VIRTUAL_ENV)","")
@echo "Venv is not activated!"
@echo "Activate venv first."
@echo
exit 1
endif
install: venvcheck ## Install the dependencies
@poetry install
test: venvcheck ## Run the tests
@tox
lint: venvcheck ## Run Black and Isort linters
@black .
@isort .
upgrade: venvcheck ## Upgrade the dependencies
poetry update
downgrade: venvcheck ## Downgrade the dependencies
git checkout pyproject.toml && git checkout poetry.lock
example: venvcheck ## Run the examples
@python example.py
publish: venvcheck ## Build and publish to PYPI
@poetry build
@poetry publish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment