Spaces:
Paused
Paused
File size: 2,007 Bytes
211e423 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
#!/usr/bin/env python3
"""Development setup script for KYB Tech Dots.OCR."""
import subprocess
import sys
from pathlib import Path
def run_command(cmd, description):
"""Run a command and handle errors."""
print(f"π {description}...")
try:
result = subprocess.run(cmd, shell=True, check=True, capture_output=True, text=True)
print(f"β
{description} completed")
return True
except subprocess.CalledProcessError as e:
print(f"β {description} failed: {e}")
print(f"Error output: {e.stderr}")
return False
def main():
"""Set up development environment."""
print("π Setting up KYB Tech Dots.OCR development environment...")
# Check if uv is installed
if not run_command("uv --version", "Checking uv installation"):
print("π¦ Installing uv...")
if not run_command("curl -LsSf https://astral.sh/uv/install.sh | sh", "Installing uv"):
print("β Failed to install uv. Please install it manually from https://github.com/astral-sh/uv")
sys.exit(1)
# Create virtual environment
if not run_command("uv venv", "Creating virtual environment"):
sys.exit(1)
# Install dependencies
if not run_command("uv pip install -e .", "Installing package in development mode"):
sys.exit(1)
# Install development dependencies
if not run_command("uv pip install -e .[dev]", "Installing development dependencies"):
sys.exit(1)
print("\nπ Development environment setup complete!")
print("\nπ Next steps:")
print("1. Activate the virtual environment:")
print(" source .venv/bin/activate # On Unix/macOS")
print(" .venv\\Scripts\\activate # On Windows")
print("\n2. Run the application:")
print(" python main.py")
print("\n3. Run tests:")
print(" pytest")
print("\n4. Run linting:")
print(" ruff check .")
print(" black .")
if __name__ == "__main__":
main()
|