Skip to content

Commit

Permalink
Create Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
umut-sahin authored and brandonwillard committed Sep 18, 2024
1 parent 498fa3c commit d85a8f9
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Optional target to test/benchmark.
TARGET ?=

.ONESHELL:
.PHONY:
.SILENT:

# Create a fresh virtual environment with the latest pip.
venv:
rm -rf .venv
python -m venv .venv
source .venv/bin/activate
pip install -U pip

# Setup the active virtual environment for development.
setup:
pip install -e .[test]

# Build the latest changes in the rust bindings and install it to the active environment.
install:
pip install -e .

# Run pre-commit checks.
pcc:
pre-commit run --all-files

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

# Run python tests.
pytest: install
pytest -svv tests -k "$(TARGET)" \
--cov=outlines_core \
--cov-report=term-missing:skip-covered

# Run rust benchmarks.
bench:
ifeq ($(TARGET),)
cargo bench
else
cargo bench -- $(TARGET)
endif

# Run python benchmarks.
pybench: check-clean-git
ifeq ($(TARGET),)
asv run --config benchmarks/asv.conf.json
else
asv run --config benchmarks/asv.conf.json -b "$(TARGET)"
endif

# Build the documentation of the rust crate and open it.
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
python -m build

# Clean build and distribution files.
clean:
cargo clean
rm -rf dist

# Make sure that git diff is clean.
check-clean-git:
git diff-index --quiet HEAD \
|| (echo "Unable to perform the action due to uncommited local changes." && exit 1)

0 comments on commit d85a8f9

Please sign in to comment.