-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (34 loc) · 1.07 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
.PHONY: help
help:
@echo 'Targets:'
@echo ' help - show this help message'
@echo ' hooks - install pre-commit hooks'
@echo ' check - lint and format using ruff'
@echo ' test - run tests with pytest'
@echo ' docs - build the docs'
@echo ' build - build cnlp-transformers for distribution'
.PHONY: hooks
hooks:
pre-commit install
.PHONY: check
check:
ruff check --fix
ruff format
.PHONY: test
test:
pytest test/
.PHONY: docs
docs:
# this script is copied from the old build_doc_source.sh script
find docs -maxdepth 1 ! -name 'index.rst' -name '*.rst' -type f -exec rm -f {} +
rm -f transformer_objects.inv
sphobjinv convert zlib docs/transformer_objects.txt --quiet
SPHINX_APIDOC_OPTIONS=members,show-inheritance sphinx-apidoc -feT -o docs src/cnlpt
echo " :noindex:" >> docs/cnlpt.rst
.PHONY: build
build:
@printf "Are you sure? This will remove everything currently in dist/ and create a new build. [y/N] " && read ans && [ $${ans:-N} = y ]
rm -f dist/*
@if python -m build; then\
echo 'To upload to PyPI run: `python -m twine upload dist/*`';\
fi