Created
June 24, 2024 00:19
-
-
Save ourway/9a895ba7f6e90822211b22392baf6bdf to your computer and use it in GitHub Desktop.
Content of Makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Variables | |
PYTHON = python3.12 | |
VENV = .venv | |
PIP = $(VENV)/bin/pip | |
PYTHON_BIN = $(VENV)/bin/python | |
ISORT = $(VENV)/bin/isort | |
BLACK = $(VENV)/bin/black | |
MYPY = $(VENV)/bin/mypy | |
PYTEST = $(VENV)/bin/pytest | |
# Directories | |
SRC_DIR = src | |
TESTS_DIR = tests | |
# Default target | |
all: install lint test | |
# Create virtual environment | |
$(VENV): | |
$(PYTHON) -m venv $(VENV) | |
# Install dependencies | |
install: $(VENV) | |
$(PIP) install -r requirements.txt | |
$(PIP) install -r requirements-dev.txt | |
# Linting with isort | |
lint-isort: | |
$(ISORT) $(SRC_DIR) $(TESTS_DIR) | |
# Formatting with black | |
format-black: | |
$(BLACK) $(SRC_DIR) $(TESTS_DIR) | |
# Type checking with mypy | |
type-check: | |
$(MYPY) $(SRC_DIR) | |
# Run tests with pytest | |
test: | |
$(PYTEST) | |
# Combined linting, formatting, and type checking | |
lint: lint-isort format-black type-check | |
# Clean up | |
clean: | |
rm -rf $(VENV) | |
.PHONY: all install lint lint-isort format-black type-check test clean | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment