Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the Makefile #694

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 58 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,43 +1,73 @@
dev:
python3 -m venv .venv
.PHONY: dev
dev: ## Create virtual environment and install development dependencies.
@echo "Creating virtual environment..."
@python3 -m venv .venv
@echo "Activating virtual environment..."
ifeq ($(OS), Windows_NT)
.venv\Scripts\activate
else
. .venv/bin/activate
endif
pip install '.[dev]'
@echo "Installing development dependencies..."
@pip install '.[dev]'

install:
pip install .
.PHONY: install
install: ## Install the package.
@echo "Installing the package..."
@pip install .

fmt:
yapf -pri databricks tests
autoflake -ri databricks tests
isort databricks tests
.PHONY: fmt
fmt: ## Format the code in 'databricks' and 'tests' directories.
@echo "Formatting code..."
@yapf -pri databricks tests
@autoflake -ri databricks tests
@isort databricks tests

fmte:
yapf -pri examples
autoflake -ri examples
isort examples
.PHONY: fmte
fmte: ## Format the code in 'examples' directory.
@echo "Formatting examples..."
@yapf -pri examples
@autoflake -ri examples
@isort examples

lint:
pycodestyle databricks
autoflake --check-diff --quiet --recursive databricks
.PHONY: lint
lint: ## Lint the code in 'databricks' directory.
@echo "Linting code..."
@pycodestyle databricks
@autoflake --check-diff --quiet --recursive databricks

test:
pytest -m 'not integration and not benchmark' --cov=databricks --cov-report html tests
.PHONY: test
test: ## Run unit tests.
@echo "Running unit tests..."
@pytest -m 'not integration and not benchmark' --cov=databricks --cov-report html tests

integration:
pytest -n auto -m 'integration and not benchmark' --reruns 2 --dist loadgroup --cov=databricks --cov-report html tests
.PHONY: integration
integration: ## Run integration tests.
@echo "Running integration tests..."
@pytest -n auto -m 'integration and not benchmark' --reruns 2 --dist loadgroup --cov=databricks --cov-report html tests

benchmark:
pytest -m 'benchmark' tests
.PHONY: benchmark
benchmark: ## Run benchmark tests.
@echo "Running benchmark tests..."
@pytest -m 'benchmark' tests

coverage: test
open htmlcov/index.html
.PHONY: coverage
coverage: test ## Generate and open the coverage report.
@echo "Opening coverage report..."
@open htmlcov/index.html

dist:
python3 setup.py bdist_wheel sdist
.PHONY: dist
dist: ## Build distribution packages.
@echo "Building distribution packages..."
@python3 setup.py bdist_wheel sdist

clean:
rm -fr dist *.egg-info .pytest_cache build htmlcov
.PHONY: clean
clean: ## Clean up build artifacts.
@echo "Cleaning up build artifacts..."
@rm -fr dist *.egg-info .pytest_cache build htmlcov

.PHONY: help
help: ## Show help for the commands.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

.DEFAULT_GOAL := help