|
2 | 2 |
|
3 | 3 | ## Quick Start |
4 | 4 |
|
5 | | -1. **Install dependencies:** |
6 | | - ```bash |
7 | | - # Install core package first (required by CLI and API) |
8 | | - cd packages/core |
9 | | - pip install -e . |
10 | | - |
11 | | - # Install CLI package |
12 | | - cd ../cli |
13 | | - pip install -e . |
| 5 | +1. **Install uv:** |
14 | 6 |
|
15 | | - # Install API package (optional) |
16 | | - cd ../api |
17 | | - pip install -e . |
| 7 | + ```bash |
| 8 | + curl -LsSf https://astral.sh/uv/install.sh | sh |
| 9 | + # or |
| 10 | + pip install uv |
18 | 11 | ``` |
19 | 12 |
|
20 | | -2. **Test the core package:** |
| 13 | +2. **Install dependencies:** |
| 14 | + |
21 | 15 | ```bash |
22 | | - cd packages/core |
23 | | - python -c "from core.domain.entities.shelly_device import ShellyDevice; print('Core package working!')" |
| 16 | + # Install all workspace packages with dev dependencies |
| 17 | + uv sync --extra dev |
24 | 18 | ``` |
25 | 19 |
|
26 | | -3. **Test CLI and API:** |
| 20 | +3. **Test packages:** |
| 21 | + |
27 | 22 | ```bash |
28 | | - # CLI |
29 | | - cd packages/cli && python -m cli --help |
| 23 | + # Test everything |
| 24 | + make test |
30 | 25 |
|
31 | | - # API |
32 | | - cd packages/api && python -m api |
| 26 | + # Test specific packages |
| 27 | + make test-core |
| 28 | + make test-api |
| 29 | + make test-cli |
33 | 30 | ``` |
34 | 31 |
|
35 | 32 | ## Development Installation |
36 | 33 |
|
37 | | -### Local Package Dependencies |
38 | | -Since the core package is not published to PyPI, install packages in this order: |
| 34 | +### Workspace Setup |
| 35 | + |
| 36 | +The project uses uv workspace dependencies for consistent version management: |
39 | 37 |
|
40 | 38 | ```bash |
41 | | -# 1. Install core package first (required by CLI and API) |
42 | | -cd packages/core |
43 | | -pip install -e . |
| 39 | +# Install everything |
| 40 | +uv sync --extra dev |
44 | 41 |
|
45 | | -# 2. Install CLI package |
46 | | -cd ../cli |
47 | | -pip install -e . |
| 42 | +# Install without dev dependencies |
| 43 | +uv sync --no-dev |
48 | 44 |
|
49 | | -# 3. Install API package (optional) |
50 | | -cd ../api |
51 | | -pip install -e . |
| 45 | +# Install specific package |
| 46 | +uv sync --package shelly-manager-core |
52 | 47 | ``` |
53 | 48 |
|
54 | | -### Virtual Environment Setup (Recommended) |
| 49 | +### Running Applications |
| 50 | + |
55 | 51 | ```bash |
56 | | -# For CLI development |
57 | | -cd packages/cli |
58 | | -python -m venv venv |
59 | | -source venv/bin/activate |
60 | | -pip install -e ../core |
61 | | -pip install -e ".[dev]" |
62 | | - |
63 | | -# For API development |
64 | | -cd packages/api |
65 | | -python -m venv venv |
66 | | -source venv/bin/activate |
67 | | -pip install -e ../core |
68 | | -pip install -e ".[dev]" |
| 52 | +# CLI |
| 53 | +uv run shelly-manager --help |
| 54 | + |
| 55 | +# API server |
| 56 | +uv run --package shelly-manager-api python -m api.main |
69 | 57 | ``` |
70 | 58 |
|
71 | 59 | ## Development Workflow |
72 | 60 |
|
73 | 61 | ### Code formatting and linting |
74 | | -```bash |
75 | | -# Format code with black |
76 | | -black . |
77 | 62 |
|
78 | | -# Check with ruff |
79 | | -ruff check . |
| 63 | +```bash |
| 64 | +# Format code |
| 65 | +make format |
80 | 66 |
|
81 | | -# Type checking |
82 | | -mypy . |
| 67 | +# Check linting |
| 68 | +make lint |
83 | 69 | ``` |
84 | 70 |
|
85 | 71 | ### Testing |
| 72 | + |
86 | 73 | ```bash |
87 | 74 | # Run all tests |
88 | | -pytest |
| 75 | +make test |
89 | 76 |
|
90 | 77 | # Run with coverage |
91 | | -pytest --cov=core --cov=app |
| 78 | +make test-coverage |
92 | 79 |
|
93 | | -# Run specific test types |
94 | | -pytest tests/unit/ |
95 | | -pytest tests/integration/ |
| 80 | +# Run specific package tests |
| 81 | +uv run --package shelly-manager-core pytest packages/core/tests/ |
96 | 82 | ``` |
97 | 83 |
|
98 | 84 | ### Running the Application |
| 85 | + |
99 | 86 | ```bash |
100 | | -# Core functionality (verified working) |
101 | | -cd packages/core |
102 | | -python -c "from core.settings import settings; print(f'✅ Settings: {settings.api.host}:{settings.api.port}')" |
103 | | - |
104 | | -# CLI usage (may require additional setup) |
105 | | -cd packages/cli |
106 | | -python -m cli scan 192.168.1.0/24 |
107 | | -python -m cli status 192.168.1.100 |
108 | | -python -m cli update 192.168.1.100 |
109 | | - |
110 | | -# API server (may require additional setup) |
111 | | -cd packages/api |
112 | | -python -m api.run_server |
| 87 | +# Core functionality |
| 88 | +uv run --package shelly-manager-core python -c "from core.domain.entities.shelly_device import ShellyDevice; print('✅ Core package working!')" |
| 89 | + |
| 90 | +# CLI usage |
| 91 | +uv run shelly-manager scan --help |
| 92 | +uv run shelly-manager device status --help |
| 93 | + |
| 94 | +# API server |
| 95 | +uv run --package shelly-manager-api python -m api.main |
113 | 96 | # Then visit http://localhost:8000/docs |
114 | 97 | ``` |
115 | | - |
116 | | -> **Note**: CLI and API packages may need additional dependency resolution. |
117 | | -> All core business logic and domain functionality is working correctly. |
0 commit comments