Skip to content

Commit

Permalink
* added Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
asofter committed Sep 11, 2023
1 parent 615c3ff commit db33f0e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Documentation moved to `mkdocs`
- Benchmarks in the documentation
- Added documentation about [adding more scanners](docs/add_scanner.md)
- `Makefile` with useful commands

### Fixed
-
Expand Down
50 changes: 50 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.PHONY: help lint test benchmark-prompt-scanners benchmark-output-scanners build docs-serve install-dev publish clean

help:
@echo "Available commands:"
@echo "make lint - Check code with linters using pre-commit."
@echo "make test - Run unit tests using pytest."
@echo "make benchmark-prompt-scanners - Benchmark prompt scanners."
@echo "make benchmark-output-scanners - Benchmark output scanners."
@echo "make build - Build the package for PyPI."
@echo "make docs-serve - Serve documentation using mkdocs."
@echo "make install-dev - Install development dependencies."
@echo "make publish - Publish to PyPI."

install-dev:
@echo "Installing development dependencies..."
@pip install -U -r requirements.txt -r requirements-dev.txt
@python -m spacy download en_core_web_trf
@pre-commit install

lint:
@echo "Running linters..."
@pre-commit run --all-files

test:
@echo "Running tests..."
@pytest --exitfirst --verbose --failed-first --cov=.

benchmark-prompt-scanners:
@echo "Running benchmarks for prompt scanners..."
@pytest ./benchmarks/scan_prompt_latency.py

benchmark-output-scanners:
@echo "Running benchmarks for output scanners..."
@pytest ./benchmarks/scan_output_latency.py

build:
@echo "Building for PyPI..."
@python setup.py sdist bdist_wheel

publish:
@echo "Publishing to PyPI..."
@twine upload dist/*

docs-serve:
@echo "Serving documentation..."
@mkdocs serve -a localhost:8080

clean:
@echo "Cleaning up..."
@rm -rf build dist .pytest_cache .egg-info

0 comments on commit db33f0e

Please sign in to comment.