-
Notifications
You must be signed in to change notification settings - Fork 3
quick setup added for Mac/Linux and Windows #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
df7de43
8d79504
4f58917
89c4b39
e3c2561
97e515a
06ed405
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| @echo off | ||
| REM Refactron Development Setup Script for Windows | ||
| REM This script automates the setup of the development environment | ||
|
|
||
| echo π Setting up Refactron development environment... | ||
| echo. | ||
|
|
||
| REM Check if Python is available | ||
| python --version >nul 2>&1 | ||
| if errorlevel 1 ( | ||
| echo β Error: Python is required but not found. | ||
| echo Please install Python 3.8 or higher and try again. | ||
| exit /b 1 | ||
| ) | ||
|
|
||
omsherikar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| REM Check Python version (must be 3.8 or higher) | ||
| python -c "import sys; sys.exit(0 if sys.version_info >= (3, 8) else 1)" >nul 2>&1 | ||
| if errorlevel 1 ( | ||
| echo β Error: Python 3.8 or higher is required. | ||
| echo Detected Python version is lower than 3.8. | ||
| exit /b 1 | ||
| ) | ||
| echo β Python detected | ||
| echo. | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| REM Create virtual environment if it doesn't exist | ||
| if not exist "venv" ( | ||
| echo π¦ Creating virtual environment... | ||
| python -m venv venv | ||
| echo β Virtual environment created | ||
| ) else ( | ||
| echo β Virtual environment already exists | ||
| ) | ||
|
|
||
| echo. | ||
| echo π Activating virtual environment... | ||
| call venv\Scripts\activate.bat | ||
|
|
||
| REM Upgrade pip | ||
| echo. | ||
| echo β¬οΈ Upgrading pip... | ||
| python -m pip install --upgrade pip --quiet | ||
| if errorlevel 1 ( | ||
| echo β Error: Failed to upgrade pip | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| REM Install the package in editable mode with dev dependencies | ||
| echo. | ||
| echo π₯ Installing Refactron in development mode... | ||
| python -m pip install -e ".[dev]" --quiet | ||
| if errorlevel 1 ( | ||
| echo β Error: Failed to install Refactron in development mode | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| REM Install additional dev dependencies if requirements-dev.txt exists | ||
| if exist "requirements-dev.txt" ( | ||
| echo π₯ Installing additional development dependencies... | ||
| python -m pip install -r requirements-dev.txt --quiet | ||
| if errorlevel 1 ( | ||
| echo β Error: Failed to install development dependencies | ||
| exit /b 1 | ||
| ) | ||
| ) | ||
omsherikar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| 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 | ||
| exit /b 1 | ||
| ) | ||
| echo β Pre-commit hooks installed | ||
|
|
||
| REM Verify installation | ||
| echo. | ||
| echo π§ͺ Verifying installation... | ||
| python -c "import refactron; print('β Refactron imported successfully')" 2>nul | ||
| if errorlevel 1 ( | ||
| echo β Error: Could not import refactron | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| REM Check CLI | ||
| echo. | ||
| echo π Checking CLI... | ||
| refactron --version >nul 2>&1 | ||
| if errorlevel 1 ( | ||
| echo β Error: CLI not working | ||
| exit /b 1 | ||
| ) else ( | ||
| for /f "tokens=*" %%i in ('refactron --version') do set VERSION=%%i | ||
| echo β CLI working: %VERSION% | ||
| ) | ||
|
|
||
| REM Run test suite with pytest to verify setup | ||
| echo. | ||
| echo π§ͺ Running test suite with pytest... | ||
| pytest | ||
| if errorlevel 1 ( | ||
| echo β οΈ Warning: Some tests failed. Please review the pytest output above. | ||
| ) else ( | ||
| echo β All tests passed successfully. | ||
| ) | ||
|
|
||
| echo. | ||
omsherikar marked this conversation as resolved.
Show resolved
Hide resolved
omsherikar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| echo β¨ Development environment setup complete! | ||
| echo. | ||
| echo π Next steps: | ||
| echo 1. Activate the virtual environment: venv\Scripts\activate | ||
| echo 2. Make your changes | ||
| echo 3. Run tests: pytest | ||
| echo 4. Format code: black refactron tests | ||
| echo 5. Check code quality: flake8 refactron | ||
| echo. | ||
| echo π‘ To activate the environment in the future, run: | ||
| echo venv\Scripts\activate | ||
| echo. | ||
| echo Happy coding! π | ||
| pause | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Refactron Development Setup Script | ||
| # This script automates the setup of the development environment | ||
|
|
||
| set -e # Exit on any error | ||
|
|
||
| echo "π Setting up Refactron development environment..." | ||
| echo "" | ||
|
|
||
| # Check if Python 3 is available | ||
| if ! command -v python3 &> /dev/null; then | ||
| echo "β Error: Python 3 is required but not found." | ||
| echo "Please install Python 3.8 or higher and try again." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Check Python version (must be 3.8+) | ||
| PYTHON_VERSION=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))') | ||
| if ! python3 -c "import sys; exit(0 if sys.version_info >= (3, 8) else 1)" 2>/dev/null; then | ||
| echo "β Error: Python 3.8 or higher is required. Found Python $PYTHON_VERSION" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "β Python $PYTHON_VERSION detected" | ||
|
|
||
| # Create virtual environment if it doesn't exist | ||
| if [ ! -d "venv" ]; then | ||
| echo "" | ||
| echo "π¦ Creating virtual environment..." | ||
| python3 -m venv venv | ||
| echo "β Virtual environment created" | ||
| else | ||
| echo "β Virtual environment already exists" | ||
| fi | ||
|
|
||
| # Activate virtual environment | ||
| echo "" | ||
| echo "π Activating virtual environment..." | ||
| source venv/bin/activate | ||
|
|
||
| # Upgrade pip | ||
| echo "" | ||
| echo "β¬οΈ Upgrading pip..." | ||
| pip install --upgrade pip --quiet | ||
|
|
||
| # Install the package in editable mode with dev dependencies | ||
| echo "" | ||
| echo "π₯ Installing Refactron in development mode..." | ||
| pip install -e ".[dev]" --quiet | ||
|
|
||
| # Install additional (non-core) dev dependencies if requirements-dev.txt exists | ||
| # NOTE: | ||
| # - 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. | ||
| 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) | ||
|
|
||
| if [ -n "$DOC_REQUIREMENTS" ]; then | ||
| echo "$DOC_REQUIREMENTS" | xargs -n1 pip install --quiet | ||
| else | ||
| echo "βΉοΈ No additional documentation 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 | ||
| 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" | ||
| fi | ||
|
Comment on lines
+76
to
+84
|
||
|
|
||
| # Verify installation | ||
| echo "" | ||
| echo "π§ͺ Verifying installation..." | ||
| # Use python3 for consistency (venv should have it, but python3 is more reliable) | ||
| if python3 -c "import refactron; print('β Refactron imported successfully')" 2>/dev/null; then | ||
omsherikar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| echo "β Installation verified" | ||
| else | ||
| echo "β Error: Could not import refactron" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Check CLI | ||
| echo "" | ||
| echo "π Checking CLI..." | ||
| if refactron --version &> /dev/null; then | ||
| VERSION=$(refactron --version) | ||
| echo "β CLI working: $VERSION" | ||
| else | ||
| echo "β Error: CLI not working" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Run tests to verify everything works | ||
| echo "" | ||
| echo "π§ͺ Running tests to verify setup..." | ||
| if pytest --version &> /dev/null; then | ||
| if ! pytest tests/ -v --tb=short -x; then | ||
| echo "" | ||
| echo "β οΈ Some tests failed, but setup is complete." | ||
| echo "You can investigate test failures later." | ||
| fi | ||
| else | ||
| echo "β οΈ pytest not found. Setup complete, but tests couldn't run." | ||
| fi | ||
|
|
||
| echo "" | ||
| echo "β¨ Development environment setup complete!" | ||
| echo "" | ||
| echo "π Next steps:" | ||
| echo " 1. Activate the virtual environment: source venv/bin/activate" | ||
| echo " 2. Make your changes" | ||
| echo " 3. Run tests: pytest" | ||
| echo " 4. Format code: black refactron tests" | ||
| echo " 5. Check code quality: flake8 refactron" | ||
| echo "" | ||
| echo "π‘ To activate the environment in the future, run:" | ||
| echo " source venv/bin/activate" | ||
| echo "" | ||
| echo "Happy coding! π" | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add newline at end of file (flagged by pre-commit). The pre-commit hook detected that the file is missing a trailing newline, which is required by POSIX standards for text files. Add a blank line after line 120 to fix this issue. π€ Prompt for AI Agents |
||
Uh oh!
There was an error while loading. Please reload this page.