Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
33 changes: 23 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
.PHONY: test
.PHONY: test # Declare the 'test' target as phony to avoid conflicts with files named 'test'

# Variables to store the paths of the python, pip, pytest, and ruff executables
PYTHON := $(shell which python)
PIP := $(shell which pip)
PYTEST := $(shell which pytest)
RUFF := $(shell which ruff)

# Target to create a Python virtual environment
.venv:
python3 -m venv .venv
$(PYTHON) -m venv $(shell dirname $(PYTHON))

# Target to install development dependencies in the virtual environment
install_dev: .venv
.venv/bin/pip install -e ".[test]"
$(PIP) install -e ".[test]"

# Target to run tests with pytest, using 2 parallel processes and only non-marked tests
test: .venv
.venv/bin/pytest -v -rsx -n 2 tests/ --non-marked-only
$(PYTEST) -v -rsx -n 2 tests/ --non-marked-only

# Target to run all tests with pytest, including slow tests, using 2 parallel processes
test_all: .venv
RUN_SLOW=1 .venv/bin/pytest -v -rsx -n 2 tests/
RUN_SLOW=1 $(PYTEST) -v -rsx -n 2 tests/

# Target to generate a table by running a Python script
table:
.venv/bin/python misc/generate_table.py
$(PYTHON) misc/generate_table.py

# Target to generate a table for timm by running a Python script
table_timm:
.venv/bin/python misc/generate_table_timm.py
$(PYTHON) misc/generate_table_timm.py

# Target to fix and format code using ruff
fixup:
.venv/bin/ruff check --fix
.venv/bin/ruff format
$(RUFF) check --fix
$(RUFF) format

# Target to run code formatting and tests
all: fixup test

Loading
Loading