Download setup-dev.sh from lin7zhi/2api: direct link, hf CLI and curl.
- Browser
- Download file 2.51 kB
-
https://huggingface.co/spaces/lin7zhi/2api/resolve/main/setup-dev.sh
- Command line
-
hf download hf://spaces/lin7zhi/2api/setup-dev.sh
-
curl -L -o setup-dev.sh https://huggingface.co/spaces/lin7zhi/2api/resolve/main/setup-dev.sh
2.51 kB
| # Development setup script for gcli2api | |
| # This script sets up the development environment | |
| set -e | |
| echo "==========================================" | |
| echo "gcli2api Development Setup" | |
| echo "==========================================" | |
| echo | |
| # Check Python version | |
| echo "Checking Python version..." | |
| python_version=$(python --version 2>&1 | awk '{print $2}') | |
| required_version="3.12" | |
| if ! python -c "import sys; exit(0 if sys.version_info >= (3, 12) else 1)"; then | |
| echo "β Error: Python 3.12 or higher is required. Found: $python_version" | |
| exit 1 | |
| fi | |
| echo "β Python $python_version" | |
| echo | |
| # Create virtual environment if it doesn't exist | |
| if [ ! -d "venv" ]; then | |
| echo "Creating virtual environment..." | |
| python -m venv venv | |
| echo "β Virtual environment created" | |
| else | |
| echo "β Virtual environment already exists" | |
| fi | |
| echo | |
| # Activate virtual environment | |
| echo "Activating virtual environment..." | |
| source venv/bin/activate | |
| echo "β Virtual environment activated" | |
| echo | |
| # Upgrade pip | |
| echo "Upgrading pip..." | |
| pip install --upgrade pip -q | |
| echo "β pip upgraded" | |
| echo | |
| # Install production dependencies | |
| echo "Installing production dependencies..." | |
| pip install -r requirements.txt -q | |
| echo "β Production dependencies installed" | |
| echo | |
| # Install development dependencies | |
| echo "Installing development dependencies..." | |
| pip install -r requirements-dev.txt -q | |
| echo "β Development dependencies installed" | |
| echo | |
| # Copy .env.example to .env if it doesn't exist | |
| if [ ! -f ".env" ]; then | |
| echo "Creating .env file from .env.example..." | |
| cp .env.example .env | |
| echo "β .env file created" | |
| echo "β οΈ Please edit .env file with your configuration" | |
| else | |
| echo "β .env file already exists" | |
| fi | |
| echo | |
| # Install pre-commit hooks | |
| echo "Installing pre-commit hooks..." | |
| pre-commit install | |
| echo "β Pre-commit hooks installed" | |
| echo | |
| echo "==========================================" | |
| echo "β Development setup complete!" | |
| echo "==========================================" | |
| echo | |
| echo "Next steps:" | |
| echo " 1. Edit .env with your configuration" | |
| echo " 2. Run 'make test' to verify setup" | |
| echo " 3. Run 'make run' to start the application" | |
| echo | |
| echo "Available commands:" | |
| echo " make help - Show all available commands" | |
| echo " make test - Run tests" | |
| echo " make lint - Run linters" | |
| echo " make format - Format code" | |
| echo " make run - Run the application" | |
| echo | |
| echo "To activate the virtual environment in the future:" | |
| echo " source venv/bin/activate" | |
| echo | |