-
Notifications
You must be signed in to change notification settings - Fork 47
/
Makefile
84 lines (63 loc) · 2.19 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
.PHONY: docs format
# Absolute path to this make file
THIS_FILE := $(abspath $(lastword $(MAKEFILE_LIST)))
# Directory of this file
DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
docs-files:
cd $(DIR)/docs && sphinx-apidoc -e -f -o . ../src/unitxt
docs-html: docs-files
@$(MAKE) -C $(DIR)/docs html
clear-docs:
echo "Clearing docs build files..."
rm -f $(DIR)/docs/modules.rst
rm -f $(DIR)/docs/unitxt.rst
rm -f $(DIR)/docs/unitxt.*.rst
rm -f $(DIR)/docs/catalog/*.rst
rm -rf $(DIR)/docs/_build/
docs: docs-html
test-docs: docs clear-docs
format:
ruff check . --fix
ruff format .
codespell --toml pyproject.toml
pre-commit:
pre-commit install
pre-commit run --all-files
# command: make version={new_version} new-version
new-version:
bash $(DIR)/utils/update_version $(version)
version-tag:
bash $(DIR)/utils/create_tag_for_new_version
build-docs-server:
cd $(DIR)/docs/_build/html && python3 -m http.server 8478
docs-server: docs
(trap 'make clear-docs; exit' INT TERM EXIT; make build-docs-server)
profile:
bash profile/profile.sh
pypi:
python setup.py sdist bdist_wheel
twine upload dist/*
dataset:
bash $(DIR)/utils/hf/prepare_dataset_imports.sh
python $(DIR)/utils/hf/prepare_dataset.py
metric:
bash $(DIR)/utils/hf/prepare_metric_imports.sh
python $(DIR)/utils/hf/prepare_metric.py
build:
format
pypi
# command: make tag_name=${TAG_NAME} metric-service-build
# example: make tag_name=unitxt-service-metric:b1v0.1 metric-service-build
# Use the unitxt dir as the build context for docker, so the entire codebase
# can be copied into the image. This way the latest code changes are integrated into
# the image, without requiring a formal unitxt release.
metric-service-build:
cd $(DIR) && docker build --tag $(tag_name) --file $(DIR)/src/unitxt/service/metrics/Dockerfile .
# command: make tag_name=${TAG_NAME} metric-service-run-bash
# example: make tag_name=unitxt-service-metric:b1v0.1 metric-service-run-bash
metric-service-run-bash:
docker run -it $(tag_name) /bin/bash
# command: make tag_name=${TAG_NAME} metric-service-run
# example: make tag_name=unitxt-service-metric:b1v0.1 metric-service-run
metric-service-run:
docker run -p 8000:8000 --memory=20g $(tag_name)