cython path_matcher added to reduce time on hot operations

This commit is contained in:
Илья Глазунов
2025-12-03 12:54:45 +03:00
parent 6c50a35aa3
commit 5d863bc97c
19 changed files with 1387 additions and 392 deletions
+24 -9
View File
@@ -1,4 +1,4 @@
.PHONY: help install build clean test lint format run dev-install dev-deps check release-patch release-minor release-major pipeline-check
.PHONY: help install build build-cython clean test lint format run dev-install dev-deps check release-patch release-minor release-major pipeline-check benchmark
PYTHON = python3
POETRY = poetry
@@ -21,12 +21,14 @@ help:
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "install-package" "Installing package locally"
@echo ""
@echo "$(YELLOW)Building:$(NC)"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "build" "Building package"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "build" "Building package (with Cython)"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "build-cython" "Building Cython extensions only"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "clean" "Cleaning temporary files"
@echo ""
@echo "$(YELLOW)Testing:$(NC)"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "test" "Running tests"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "test-cov" "Running tests with coverage"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "benchmark" "Running performance benchmarks"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "lint" "Checking code with linters"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "format" "Formatting code"
@printf " $(YELLOW)%-20s$(CYAN) %s$(NC)\n" "check" "Lint and test"
@@ -75,18 +77,27 @@ dev-deps:
@echo "$(GREEN)Installing additional tools...$(NC)"
$(POETRY) add --group dev pytest pytest-cov black isort mypy flake8
build: clean
build: clean build-cython
@echo "$(GREEN)Building package...$(NC)"
$(POETRY) build
build-cython:
@echo "$(GREEN)Building Cython extensions...$(NC)"
$(POETRY) run python scripts/build_cython.py build_ext --inplace || echo "$(YELLOW)Cython build skipped (optional)$(NC)"
clean:
@echo "$(GREEN)Cleaning temporary files...$(NC)"
rm -rf dist/
rm -rf build/
rm -rf *.egg-info/
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true
find . -type f -name "*.pyo" -delete 2>/dev/null || true
@# Cython artifacts
find $(PACKAGE_NAME) -type f -name "*.c" -delete 2>/dev/null || true
find $(PACKAGE_NAME) -type f -name "*.so" -delete 2>/dev/null || true
find $(PACKAGE_NAME) -type f -name "*.pyd" -delete 2>/dev/null || true
find $(PACKAGE_NAME) -type f -name "*.html" -delete 2>/dev/null || true
test:
@echo "$(GREEN)Running tests...$(NC)"
@@ -98,16 +109,20 @@ test-cov:
lint:
@echo "$(GREEN)Checking code with linters...$(NC)"
$(POETRY) run flake8 $(PACKAGE_NAME)/
$(POETRY) run flake8 $(PACKAGE_NAME)/ --exclude='*.pyx,*.pxd'
$(POETRY) run mypy $(PACKAGE_NAME)/
format:
@echo "$(GREEN)Formatting code...$(NC)"
$(POETRY) run black $(PACKAGE_NAME)/
$(POETRY) run isort $(PACKAGE_NAME)/
$(POETRY) run black $(PACKAGE_NAME)/ --exclude='\.pyx$$'
$(POETRY) run isort $(PACKAGE_NAME)/ --skip-glob='*.pyx'
check: lint test
benchmark: build-cython
@echo "$(GREEN)Running benchmarks...$(NC)"
$(POETRY) run python benchmarks/bench_path_matcher.py
run:
@echo "$(GREEN)Starting server in development mode...$(NC)"
$(POETRY) run python run.py --debug