diff --git a/.gitignore b/.gitignore index c4d217d..adf9917 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ parts/ sdist/ var/ wheels/ +*.whl pip-wheel-metadata/ share/python-wheels/ *.egg-info/ 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/requirements-dev.txt b/requirements-dev.txt index 03552f6..b731afc 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -10,6 +10,7 @@ black>=23.0.0 mypy>=1.0.0 flake8>=6.0.0 isort>=5.12.0 +pre-commit==4.0.1 # Documentation sphinx>=7.0.0 diff --git a/setup_dev.bat b/setup_dev.bat index 71d0f0c..9d31361 100644 --- a/setup_dev.bat +++ b/setup_dev.bat @@ -67,11 +67,6 @@ if exist "requirements-dev.txt" ( REM Install pre-commit hooks echo. echo 🔧 Setting up pre-commit hooks... -python -m pip install pre-commit --quiet -if errorlevel 1 ( - echo ❌ Error: Failed to install pre-commit - exit /b 1 -) pre-commit install if errorlevel 1 ( echo ❌ Error: Failed to install pre-commit hooks @@ -125,4 +120,3 @@ echo venv\Scripts\activate echo. echo Happy coding! 🚀 pause - diff --git a/setup_dev.sh b/setup_dev.sh index 41f560e..5e4166b 100755 --- a/setup_dev.sh +++ b/setup_dev.sh @@ -54,33 +54,33 @@ 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..." -if command -v pre-commit &> /dev/null || pip show pre-commit &> /dev/null; then +if command -v pre-commit &> /dev/null; then pre-commit install echo "✅ Pre-commit hooks installed" else - echo "âš ī¸ pre-commit not found. Installing..." - pip install pre-commit --quiet - pre-commit install - echo "✅ Pre-commit hooks installed" + 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 @@ -132,4 +132,3 @@ echo "💡 To activate the environment in the future, run:" echo " source venv/bin/activate" echo "" echo "Happy coding! 🚀" -