Skip to content

Commit

Permalink
Make Makefile targets phony and build extensions before Python tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonwillard committed Sep 30, 2024
1 parent 0bb1417 commit b656883
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
TARGET ?=

.ONESHELL:
.PHONY:
.PHONY: venv setup install install-release build-extension-debug build-extension-release watch-extension watch-extension-release pcc test test-rust test-python bench pybench doc dist clean check-clean-git
.SILENT:

# Create a fresh virtual environment with the latest pip.
Expand All @@ -27,6 +27,14 @@ install:
install-release:
pip install .

# Build only the Rust Python extension (in debug mode)
build-extension-debug:
python setup.py build_rust --inplace --debug

# Build only the Rust Python extension (in release mode)
build-extension-release:
python setup.py build_rust --inplace --release

# Watches changes in the rust bindings and updates the python extension in place.
watch-extension:
cargo watch -x 'run-script build-python-extension' -w src -w Cargo.toml
Expand All @@ -39,12 +47,14 @@ watch-extension-release:
pcc:
pre-commit run --all-files

test: test-python test-rust

# Run rust tests.
test:
test-rust:
cargo test "$(TARGET)"

# Run python tests.
pytest:
test-python: build-extension-debug
pytest -svv tests -k "$(TARGET)" \
--cov=outlines_core \
--cov-report=term-missing:skip-covered
Expand All @@ -69,10 +79,6 @@ endif
doc:
cargo doc --document-private-items --open

# Build the documentation of the python package and open it.
pydoc:
echo "Unable to perform the action as it's not implemented yet."

# Create wheels for distribution.
dist:
pip install build
Expand Down

0 comments on commit b656883

Please sign in to comment.