Spaces:
Sleeping
Sleeping
| # Makefile for Hugging Face Spaces Project | |
| # Provides convenient commands for development, testing, and deployment | |
| .PHONY: help install test test-unit test-integration test-coverage test-fast test-slow clean lint format type-check security-check build run dev docs | |
| # Default target | |
| help: | |
| # Installation | |
| install: | |
| pip install -r requirements.txt | |
| pip install -e . | |
| # Testing commands | |
| test: | |
| pytest -v | |
| test-unit: | |
| pytest tests/unit/ -v -m "unit or not integration" | |
| test-integration: | |
| pytest tests/integration/ -v -m integration --runintegration | |
| test-coverage: | |
| pytest --cov=src --cov=. --cov-report=html --cov-report=term-missing --cov-report=xml | |
| test-fast: | |
| pytest -v -m "not slow" | |
| test-slow: | |
| pytest -v -m slow --runslow | |
| test-parallel: | |
| pytest -n auto -v | |
| test-watch: | |
| pytest-watch -- -v | |
| test-debug: | |
| pytest -v -s --pdb | |
| # Code quality commands | |
| lint: | |
| flake8 src/ tests/ --max-line-length=88 --extend-ignore=E203,W503 | |
| pylint src/ --rcfile=.pylintrc || true | |
| format: | |
| black src/ tests/ --line-length=88 | |
| isort src/ tests/ --profile black | |
| format-check: | |
| black src/ tests/ --check --line-length=88 | |
| isort src/ tests/ --check-only --profile black | |
| type-check: | |
| mypy src/ --ignore-missing-imports --no-strict-optional | |
| security-check: | |
| bandit -r src/ -f json -o reports/security-report.json || true | |
| safety check --json --output reports/safety-report.json || true | |
| # Cleanup commands | |
| clean: | |
| find . -type f -name "*.pyc" -delete | |
| find . -type d -name "__pycache__" -delete | |
| find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true | |
| rm -rf build/ dist/ .coverage htmlcov/ .pytest_cache/ .mypy_cache/ | |
| rm -rf reports/*.xml reports/*.json reports/*.html | |
| clean-cache: | |
| rm -rf cache/ai_cache/* | |
| rm -rf .pytest_cache/ | |
| rm -rf __pycache__/ | |
| # Build and run commands | |
| build: | |
| python setup.py build | |
| run: | |
| python app.py | |
| dev: | |
| GRADIO_SERVER_NAME=0.0.0.0 GRADIO_SERVER_PORT=7860 python app.py | |
| # Development tools | |
| shell: | |
| python -i -c "import sys; sys.path.insert(0, 'src')" | |
| jupyter: | |
| jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser | |
| # Documentation | |
| docs: | |
| sphinx-build -b html docs/ docs/_build/html/ | |
| docs-serve: | |
| python -m http.server 8000 --directory docs/_build/html/ | |
| # Database commands | |
| db-init: | |
| python -c "from src.core.database_logger import DatabaseLogger; DatabaseLogger.init_database()" | |
| db-migrate: | |
| python scripts/migrate_database.py | |
| db-reset: | |
| rm -f logs/application.db | |
| make db-init | |
| # Log analysis commands | |
| logs-analyze: | |
| python scripts/log_analysis/advanced_log_analyzer.py | |
| logs-monitor: | |
| python scripts/log_analysis/realtime_monitor.py | |
| logs-demo: | |
| python scripts/log_analysis/demo.py | |
| # Performance commands | |
| profile: | |
| python -m cProfile -o profile_results.prof app.py | |
| profile-view: | |
| python -c "import pstats; p = pstats.Stats('profile_results.prof'); p.sort_stats('cumulative'); p.print_stats(20)" | |
| benchmark: | |
| pytest tests/ -m performance --benchmark-only | |
| # Git hooks | |
| pre-commit: | |
| make format-check | |
| make lint | |
| make type-check | |
| make test-fast | |
| pre-push: | |
| make test | |
| make security-check | |
| # CI/CD commands | |
| ci-test: | |
| pytest --junitxml=reports/junit.xml --cov=src --cov-report=xml --cov-report=term | |
| ci-quality: | |
| make lint | |
| make type-check | |
| make security-check | |
| ci-build: | |
| make clean | |
| make install | |
| make ci-quality | |
| make ci-test | |
| # Docker commands (if using Docker) | |
| docker-build: | |
| docker build -t huggingface-spaces . | |
| docker-run: | |
| docker run -p 7860:7860 huggingface-spaces | |
| docker-test: | |
| docker run --rm huggingface-spaces make test | |
| # Utility commands | |
| check-deps: | |
| pip list --outdated | |
| update-deps: | |
| pip-review --local --interactive | |
| freeze-deps: | |
| pip freeze > requirements-frozen.txt | |
| # Environment setup | |
| setup-dev: | |
| python -m venv venv | |
| setup-hooks: | |
| echo "#!/bin/bash\nmake pre-commit" > .git/hooks/pre-commit | |
| echo "#!/bin/bash\nmake pre-push" > .git/hooks/pre-push | |
| chmod +x .git/hooks/pre-commit .git/hooks/pre-push | |
| # Release commands | |
| version-patch: | |
| bump2version patch | |
| version-minor: | |
| bump2version minor | |
| version-major: | |
| bump2version major | |
| release: | |
| make ci-build | |
| make version-patch | |
| git push origin main --tags | |
| # Health check | |
| health-check: | |
| # All-in-one commands | |
| full-check: | |
| make clean | |
| make install | |
| make format-check | |
| make lint | |
| make type-check | |
| make test-coverage | |
| make security-check | |
| quick-check: | |
| make format-check | |
| make test-fast |