diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1346880..8cbd907 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -190,7 +190,7 @@ git push origin feature/my-improvement ```bash # Format with black black refactron tests - + # Sort imports isort refactron tests ``` diff --git a/setup_dev.bat b/setup_dev.bat index 34c325b..9d31361 100644 --- a/setup_dev.bat +++ b/setup_dev.bat @@ -120,4 +120,3 @@ echo venv\Scripts\activate echo. echo Happy coding! 🚀 pause - diff --git a/setup_dev.sh b/setup_dev.sh index 46fb1d8..5e4166b 100755 --- a/setup_dev.sh +++ b/setup_dev.sh @@ -54,27 +54,34 @@ pip install -e ".[dev]" --quiet # - Core development tools (pytest, black, mypy, flake8, isort, etc.) are installed # via the [dev] extra in pyproject.toml (see the pip install -e ".[dev]" above). # - To avoid redundant installations and version conflicts, we only use -# requirements-dev.txt for *extra* tools such as documentation dependencies. +# requirements-dev.txt for *extra* tools such as documentation dependencies and pre-commit. if [ -f "requirements-dev.txt" ]; then echo "đŸ“Ĩ Installing additional documentation/development dependencies from requirements-dev.txt..." - # Extract Sphinx-related requirements (e.g., sphinx, sphinx-rtd-theme) from - # requirements-dev.txt and install only those. This avoids re-installing tools - # that are already provided by the [dev] extra. - DOC_REQUIREMENTS=$(grep -E '^[[:space:]]*sphinx' requirements-dev.txt || true) + # Extract Sphinx-related and pre-commit requirements from requirements-dev.txt. + # This avoids re-installing tools that are already provided by the [dev] extra. + EXTRA_REQUIREMENTS=$(grep -E '^[[:space:]]*(sphinx|pre-commit)' requirements-dev.txt || true) - if [ -n "$DOC_REQUIREMENTS" ]; then - echo "$DOC_REQUIREMENTS" | xargs -n1 pip install --quiet + if [ -n "$EXTRA_REQUIREMENTS" ]; then + echo "$EXTRA_REQUIREMENTS" | xargs -n1 pip install --quiet else - echo "â„šī¸ No additional documentation dependencies detected in requirements-dev.txt; skipping." + echo "â„šī¸ No additional documentation or pre-commit dependencies detected in requirements-dev.txt; skipping." fi fi # Install pre-commit hooks echo "" echo "🔧 Setting up pre-commit hooks..." -pre-commit install -echo "✅ Pre-commit hooks installed" +if command -v pre-commit &> /dev/null; then + pre-commit install + echo "✅ Pre-commit hooks installed" +else + echo "❌ Error: pre-commit is not installed in this environment." + echo "This should have been installed from requirements-dev.txt." + echo "Please ensure pre-commit is listed in requirements-dev.txt or install it manually:" + echo " pip install pre-commit" + exit 1 +fi # Verify installation echo "" @@ -125,4 +132,3 @@ echo "💡 To activate the environment in the future, run:" echo " source venv/bin/activate" echo "" echo "Happy coding! 🚀" -