-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
Makefile
99 lines (75 loc) · 3.52 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Run Django dev server with Sqlite
run-dev:
DJANGO_DB=sqlite LOG_DIR=tmp DEBUG=true LOG_LEVEL=DEBUG DJANGO_SETTINGS_MODULE=core.settings.label_studio poetry run python label_studio/manage.py runserver
# Run Django dev migrations with Sqlite
migrate-dev:
DJANGO_DB=sqlite LOG_DIR=tmp DEBUG=true LOG_LEVEL=DEBUG DJANGO_SETTINGS_MODULE=core.settings.label_studio poetry run python label_studio/manage.py migrate
# Run Django dev make migrations with Sqlite
makemigrations-dev:
DJANGO_DB=sqlite LOG_DIR=tmp DEBUG=true LOG_LEVEL=DEBUG DJANGO_SETTINGS_MODULE=core.settings.label_studio poetry run python label_studio/manage.py makemigrations
# Run Django dev shell environment with Sqlite
shell-dev:
DJANGO_DB=sqlite LOG_DIR=tmp DEBUG=true LOG_LEVEL=DEBUG DJANGO_SETTINGS_MODULE=core.settings.label_studio poetry run python label_studio/manage.py shell_plus
env-dev-setup:
if [ ! -f .env ]; then \
cp .env.development .env; \
fi
docker-dev-override:
if [ ! -f docker-compose.override.yml ]; then \
cp docker-compose.override.example.yml docker-compose.override.yml; \
fi
# Configure Django dev server with Hot Module Replacement in docker
docker-dev-setup: env-dev-setup docker-dev-override
docker-run-dev:
docker-compose up --build
docker-migrate-dev:
docker-compose run app python3 /label-studio/label_studio/manage.py migrate
# Install modules
frontend-install:
cd web && yarn install --frozen-lockfile;
# Alias for backward compatibility
frontend-setup: frontend-install
# Run frontend dev server in Hot Module Replacement mode
# For more information on HMR, see the "Environment Configuration" section in:
# web/README.md
frontend-dev:
cd web && yarn run dev
# Build frontend continuously on files changes
frontend-watch:
cd web && yarn run watch
# Build production-ready optimized bundle
frontend-build: frontend-setup
cd web && yarn run build
frontend-storybook-serve: frontend-setup
cd web && yarn run ui:serve
# Run tests
test:
cd label_studio && DJANGO_DB=sqlite pytest -v -m "not integration_tests"
# Build image which includes test dependencies, for unit testing within docker
build-testing-image:
docker build -t heartexlabs/label-studio:latest . && docker build -t heartexlabs/label-studio:latest-testing -f Dockerfile.testing .
# Run an interactive shell inside a testing container. Label studio dir will be mounted as a volume
# to avoid need for rebuilds. Run `make build-testing-image` first.
docker-testing-shell:
docker run --volume ./label_studio:/label-studio/label_studio --volume ./mydata:/label-studio/data:rw -it heartexlabs/label-studio:latest-testing /bin/bash
# Update urls
update-urls:
DJANGO_DB=sqlite LOG_DIR=tmp DEBUG=true LOG_LEVEL=DEBUG DJANGO_SETTINGS_MODULE=core.settings.label_studio poetry run python label_studio/manage.py show_urls --format pretty-json > ./label_studio/core/all_urls.json
# Format changed files on branch
fmt:
pre-commit run --config .pre-commit-dev.yaml --hook-stage manual
# Format all files in repo
fmt-all:
pre-commit run --config .pre-commit-dev.yaml --hook-stage manual --all-files
# Check for lint issues on this branch
fmt-check:
pre-commit run --hook-stage pre-push
# Check for lint issues in entire repo
fmt-check-all:
pre-commit run --hook-stage pre-push --all-files
# Configure pre-push hook using pre-commit
configure-hooks:
pre-commit install --hook-type pre-push
# Generate swagger.json
generate-swagger:
DJANGO_DB=sqlite LOG_DIR=tmp DEBUG=true LOG_LEVEL=DEBUG DJANGO_SETTINGS_MODULE=core.settings.label_studio poetry run python label_studio/manage.py generate_swagger swagger.json