57 lines
2.8 KiB
Makefile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Команды разработки tabular-parser. Backend — api/.venv; запуск из корня репозитория.
VENV := api/.venv
BIN := $(CURDIR)/$(VENV)/bin
STATEMENTS_DIR ?= ../pylib_ai_arm_statements
COMPOSE_FILE ?= ../docs/dev/docker-compose.yml
.PHONY: venv install lint test test-integration test-fixtures golden-update golden-check check docker-build check-full up
# Python 3.11; пропускаем внутренние raisa_* и устанавливаемые локально pylib_ai*
venv:
cd api && uv venv --python 3.11 --allow-existing .venv
cd api && grep -Ev '^(raisa_|pylib_ai)' requirements.txt | uv pip install --python .venv/bin/python -r -
cd api && grep -v '^-r' requirements-dev.txt | uv pip install --python .venv/bin/python -r -
uv pip install --python "$(BIN)/python" --reinstall-package pylib-ai-arm-statements "$(STATEMENTS_DIR)"
# Установить или переустановить библиотеку в окружение backend.
install:
uv venv --python 3.11 --allow-existing "$(VENV)"
uv pip install --python "$(BIN)/python" --reinstall-package pylib-ai-arm-statements "$(STATEMENTS_DIR)"
lint:
cd api && $(BIN)/ruff check .
cd api && $(BIN)/ruff format --check .
cd api && $(BIN)/mypy src
test:
cd api && $(BIN)/pytest -m "not integration"
test-integration:
cd api && $(BIN)/pytest -m integration
# Тесты на реальных данных из ../fixtures (ARM_KA_FIXTURES): golden-снимки, покрытие словарей, property-тест
test-fixtures:
cd api && $(BIN)/pytest -m fixtures
# Golden-снимки разбора ОСВ: перезапись в ../fixtures/golden/expected_osv_parse/ + unified diff изменившихся.
# Результат обязательно просмотреть и коммитить в репозиторий fixtures отдельным коммитом (снимок — регрессия, не оракул)
golden-update:
cd api && ENV_FILE=.env.test $(BIN)/python scripts/golden_update.py
# То же без записи: код возврата 1, если снимки расходятся с разбором
golden-check:
cd api && ENV_FILE=.env.test $(BIN)/python scripts/golden_update.py --check
check: lint test
# Сборка образа из корня репозитория
docker-build:
docker build --build-context arm_statements="$(STATEMENTS_DIR)" -t tabular-parser .
# Полная проверка перед PR: быстрые проверки, затем NATS/MinIO из compose (make up), затем образ
check-full: check test-integration docker-build
# Только инфраструктура, нужная сервису (без arm-core): NATS и MinIO; postgres — для общей среды compose
up:
docker compose -f $(COMPOSE_FILE) up -d --wait postgres nats minio