Skip to content

Instantly share code, notes, and snippets.

@toloco
Created June 17, 2022 07:54
Show Gist options
  • Save toloco/2a88cb0b1610e46411d8b85ef0a0d695 to your computer and use it in GitHub Desktop.
Save toloco/2a88cb0b1610e46411d8b85ef0a0d695 to your computer and use it in GitHub Desktop.
Python code operations
clean: ## Remove all pyc and caches
@find . -name '*.py[co]' -exec rm -f {} +
@find . -name '\.pytest_cache' -exec rm -fr {} +
@find . -name '\.mypy_cache' -exec rm -fr {} +
@find . -name '__pycache__' -exec rm -fr {} +
@docker ps -aq | xargs -r docker rm -f
@docker volume ls -q | xargs -r docker volume rm -f
@docker images | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi -f
@docker builder prune -f
format: ## Format the code
@python -m isort --atomic runner
@python -m black runner
@python -m autoflake \
--in-place \
--remove-unused-variables \
--remove-all-unused-imports \
--remove-duplicate-keys \
--ignore-init-module-imports \
--recursive runner
lint: ## Static analysis
@python -m isort -c runner
@python -m black --check runner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment