Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ git push origin feature/my-improvement
```bash
# Format with black
black refactron tests

# Sort imports
isort refactron tests
```
Expand Down
1 change: 0 additions & 1 deletion setup_dev.bat
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,3 @@ echo venv\Scripts\activate
echo.
echo Happy coding! 🚀
pause

28 changes: 17 additions & 11 deletions setup_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Comment on lines +80 to +82
Copy link

Copilot AI Dec 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error handling assumes that pre-commit should have been installed from requirements-dev.txt, but the script only attempts to install it if requirements-dev.txt exists AND contains a line matching the grep pattern. If requirements-dev.txt doesn't exist or doesn't contain pre-commit, the error message will be misleading. Consider checking if requirements-dev.txt exists and contains pre-commit before assuming it should have been installed from there.

Suggested change
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"
if [ -f "requirements-dev.txt" ] && grep -q -E '^[[:space:]]*pre-commit' requirements-dev.txt; then
echo "pre-commit appears to be listed in requirements-dev.txt but was not installed."
echo "You may need to rerun this script or install it manually:"
echo " pip install pre-commit"
else
echo "pre-commit is not installed and does not appear to be listed in requirements-dev.txt."
echo "Please add pre-commit to your development dependencies (e.g., requirements-dev.txt) or install it manually:"
echo " pip install pre-commit"
fi

Copilot uses AI. Check for mistakes.
exit 1
Comment on lines +79 to +83
Copy link

Copilot AI Dec 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exit 1 here will terminate the script if pre-commit is not available, which may be too strict. If pre-commit is truly optional or can be installed later, consider making this a warning instead of a fatal error. Alternatively, the script could attempt to install pre-commit directly if it's missing.

Suggested change
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
echo "⚠️ Warning: pre-commit is not installed in this environment."
echo " Pre-commit hooks will not be installed automatically."
echo " To enable pre-commit hooks, ensure 'pre-commit' is listed in requirements-dev.txt"
echo " or install it manually in this environment with:"
echo " pip install pre-commit"

Copilot uses AI. Check for mistakes.
fi

# Verify installation
echo ""
Expand Down Expand Up @@ -125,4 +132,3 @@ echo "💡 To activate the environment in the future, run:"
echo " source venv/bin/activate"
echo ""
echo "Happy coding! 🚀"