Skip to content

Commit e068c3f

Browse files
authored
Merge pull request #140 from awslabs/feat/package-namespace-migration
refactor: consolidate package namespace under src/orb and enhance SDK and API consistency
2 parents e4a3e17 + 2dc364b commit e068c3f

1,103 files changed

Lines changed: 12360 additions & 17859 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.githooks/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ This configures git to use `.githooks/` instead of `.git/hooks/`.
1717
### pre-commit
1818
Runs quality checks via `pre-commit run` (reads `.pre-commit-config.yaml`, skips manual-stage hooks).
1919

20+
### pre-push
21+
Runs pre-push stage hooks from `.pre-commit-config.yaml` (bandit, safety, validate-imports, validate-cqrs, check-architecture, validate-workflows).
22+
2023
## Adding Custom Hooks
2124

2225
Add a new file to `.githooks/` and it will be version controlled:

.githooks/pre-push

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Run pre-push checks (reads .pre-commit-config.yaml, pre-push stage hooks)
5+
pre-commit run --hook-stage pre-push

.github/workflows/dev-containers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ jobs:
161161
fi
162162
163163
- name: Run Trivy security scan
164-
uses: aquasecurity/trivy-action@0.34.0
164+
uses: aquasecurity/trivy-action@0.34.2
165165
with:
166166
image-ref: "${{ needs.config.outputs.container-registry }}/${{ needs.config.outputs.container-image }}:${{ needs.config.outputs.package-version }}-python${{ matrix.python-version }}"
167167
format: 'sarif'

.github/workflows/package-testing.yml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ jobs:
8484
8585
# Test core imports always work
8686
try:
87-
import run
88-
from bootstrap import Application
89-
from domain.base.exceptions import DomainException
90-
from infrastructure.logging.logger import get_logger
87+
import orb.run
88+
from orb.bootstrap import Application
89+
from orb.domain.base.exceptions import DomainException
90+
from orb.infrastructure.logging.logger import get_logger
9191
print('PASS: Core imports successful')
9292
except ImportError as e:
9393
print(f'FAIL: Core import failed: {e}')
@@ -97,20 +97,20 @@ jobs:
9797
- name: Test CLI functionality
9898
run: |
9999
# Test basic CLI works
100-
python -m run --help
101-
python -m run --version
102-
100+
python -m orb --help
101+
python -m orb --version
102+
103103
# Test commands that should work in all variants
104-
python -m run templates list --help || echo "Templates command help failed (expected in some cases)"
104+
python -m orb templates list --help || echo "Templates command help failed (expected in some cases)"
105105
106106
- name: Test CLI Rich formatting
107107
if: matrix.variant.test_cli_rich
108108
run: |
109109
python -c "
110110
try:
111-
from cli.formatters import format_generic_table
112-
from cli.console import get_console
113-
111+
from orb.cli.formatters import format_generic_table
112+
from orb.cli.console import get_console
113+
114114
# Test Rich table formatting
115115
test_data = [{'id': '1', 'name': 'test'}]
116116
result = format_generic_table(test_data, 'Test Items')
@@ -137,9 +137,9 @@ jobs:
137137
print('PASS: Rich correctly not available in minimal variant')
138138
139139
# Test CLI still works with fallbacks
140-
from cli.formatters import format_generic_table
141-
from cli.console import get_console
142-
140+
from orb.cli.formatters import format_generic_table
141+
from orb.cli.console import get_console
142+
143143
test_data = [{'id': '1', 'name': 'test'}]
144144
result = format_generic_table(test_data, 'Test Items')
145145
print('PASS: CLI fallback formatting works')
@@ -154,7 +154,7 @@ jobs:
154154
run: |
155155
python -c "
156156
try:
157-
from api.server import create_fastapi_app
157+
from orb.api.server import create_fastapi_app
158158
print('PASS: FastAPI imports successful')
159159
160160
# Test app creation (basic test)
@@ -177,7 +177,7 @@ jobs:
177177
178178
# Test that API server creation fails gracefully
179179
try:
180-
from api.server import create_fastapi_app
180+
from orb.api.server import create_fastapi_app
181181
try:
182182
create_fastapi_app(None)
183183
print('FAIL: API should have failed without FastAPI')
@@ -197,7 +197,7 @@ jobs:
197197
run: |
198198
python -c "
199199
try:
200-
from monitoring.health import HealthCheck
200+
from orb.monitoring.health import HealthCheck
201201
print('PASS: Monitoring imports successful')
202202
203203
# Test basic monitoring functionality
@@ -225,7 +225,7 @@ jobs:
225225
226226
# Monitoring should still import but with limited functionality
227227
try:
228-
from monitoring.health import HealthCheck
228+
from orb.monitoring.health import HealthCheck
229229
print('PASS: Monitoring module imports with limited functionality')
230230
except ImportError as e:
231231
print(f'FAIL: Monitoring module should import even without optional deps: {e}')
@@ -262,7 +262,7 @@ jobs:
262262
# Test CLI without Rich
263263
with patch.dict(sys.modules, {'rich': None, 'rich.console': None, 'rich.table': None}):
264264
try:
265-
from cli.console import get_console, print_success
265+
from orb.cli.console import get_console, print_success
266266
console = get_console()
267267
print('PASS: CLI console works without Rich')
268268
except Exception as e:
@@ -272,7 +272,7 @@ jobs:
272272
# Test API without FastAPI
273273
with patch.dict(sys.modules, {'fastapi': None}):
274274
try:
275-
from api.server import create_fastapi_app
275+
from orb.api.server import create_fastapi_app
276276
try:
277277
create_fastapi_app(None)
278278
print('FAIL: API should fail without FastAPI')
@@ -322,13 +322,13 @@ jobs:
322322
print(f'PASS: {dep} correctly not available')
323323
324324
# Test that core functionality still works
325-
import run
326-
from bootstrap import Application
327-
from domain.base.exceptions import DomainException
325+
import orb.run
326+
from orb.bootstrap import Application
327+
from orb.domain.base.exceptions import DomainException
328328
print('PASS: Core functionality works without optional deps')
329-
329+
330330
# Test CLI with fallbacks
331-
from cli.console import get_console
331+
from orb.cli.console import get_console
332332
console = get_console()
333333
console.print('Test message')
334334
print('PASS: CLI works with fallbacks')
@@ -360,7 +360,7 @@ jobs:
360360
361361
# Test API error message
362362
try:
363-
from api.server import create_fastapi_app
363+
from orb.api.server import create_fastapi_app
364364
try:
365365
create_fastapi_app(None)
366366
print('FAIL: API should have failed')
@@ -404,10 +404,10 @@ jobs:
404404
# Test all functionality works together
405405
python -c "
406406
# Test all imports work
407-
from cli.formatters import format_generic_table
408-
from cli.console import get_console
409-
from api.server import create_fastapi_app
410-
from monitoring.health import HealthCheck
407+
from orb.cli.formatters import format_generic_table
408+
from orb.cli.console import get_console
409+
from orb.api.server import create_fastapi_app
410+
from orb.monitoring.health import HealthCheck
411411
412412
print('PASS: All modules import successfully')
413413
@@ -426,8 +426,8 @@ jobs:
426426
427427
- name: Test CLI commands
428428
run: |
429-
python -m run --help
430-
python -m run --version
429+
python -m orb --help
430+
python -m orb --version
431431
echo "PASS: CLI commands work"
432432
433433
summary:

.github/workflows/reusable-security.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
# Trivy Filesystem Scan
7575
- name: Run Trivy filesystem vulnerability scanner
7676
if: inputs.scan-type == 'trivy-fs'
77-
uses: aquasecurity/trivy-action@0.34.0
77+
uses: aquasecurity/trivy-action@0.34.2
7878
with:
7979
scan-type: 'fs'
8080
scan-ref: '.'

.github/workflows/test-matrix.yml

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -106,38 +106,40 @@ jobs:
106106
run: |
107107
python -c "
108108
import sys
109-
109+
variant = '${{ matrix.package-variant }}'
110+
110111
# Test basic imports (should always work)
111112
try:
112-
import orb_py
113-
print('✓ Basic orb_py import works')
113+
import orb
114+
print('✓ Basic orb import works')
114115
except ImportError as e:
115-
print(f'✗ Basic orb_py import failed: {e}')
116+
print(f'✗ Basic orb import failed: {e}')
116117
sys.exit(1)
117118
118-
# Test CLI imports
119-
try:
120-
from cli.formatters import format_table
121-
print('✓ CLI formatters import works')
122-
except ImportError as e:
123-
if '${{ matrix.package-variant }}' in ['.', '.[api]', '.[monitoring]']:
124-
print(f'✓ Expected CLI import failure for ${{ matrix.package-variant }}: {e}')
125-
else:
126-
print(f'✗ Unexpected CLI import failure: {e}')
119+
# Test CLI flag: RICH_AVAILABLE reflects whether rich is installed
120+
from orb.cli.console import RICH_AVAILABLE
121+
if variant in ['.[cli]', '.[all]']:
122+
if not RICH_AVAILABLE:
123+
print(f'✗ Expected RICH_AVAILABLE=True for {variant} but got False')
127124
sys.exit(1)
125+
print(f'✓ RICH_AVAILABLE=True as expected for {variant}')
126+
else:
127+
print(f'✓ RICH_AVAILABLE={RICH_AVAILABLE} (rich not required for {variant})')
128128
129-
# Test API imports
129+
# Test API imports: fastapi is only available with .[api] or .[all]
130130
try:
131-
from interface.serve_command_handler import handle_serve_command
132-
print('✓ API handler import works')
131+
from orb.api.routers.machines import router
132+
if variant in ['.', '.[cli]', '.[monitoring]']:
133+
print(f'✗ Expected API import to fail for {variant} but it succeeded')
134+
sys.exit(1)
135+
print(f'✓ API router import works for {variant}')
133136
except ImportError as e:
134-
if '${{ matrix.package-variant }}' in ['.', '.[cli]', '.[monitoring]']:
135-
print(f'✓ Expected API import failure for ${{ matrix.package-variant }}: {e}')
136-
else:
137-
print(f'✗ Unexpected API import failure: {e}')
137+
if variant in ['.[api]', '.[all]']:
138+
print(f'✗ Unexpected API import failure for {variant}: {e}')
138139
sys.exit(1)
139-
140-
print('✓ All import tests passed for ${{ matrix.package-variant }}')
140+
print(f'✓ Expected API import failure for {variant}')
141+
142+
print(f'✓ All import tests passed for {variant}')
141143
"
142144
143145
e2e-tests:

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,15 @@ coverage.xml
120120
.hypothesis/
121121
.pytest_cache/
122122
.mypy_cache/
123+
pytest-of-*/
124+
125+
# CLI tool caches
126+
*_cache_*/
123127

124128
# Documentation
125129
docs-backup/
126130
site/
131+
docs/site/
127132

128133
# Internal
129134
memory-bank/

.project.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ project:
77
pypi_name: orb-py # PyPI distribution name
88
short_name: orb # CLI command name
99
version: 1.1.2
10-
description: "Cloud provider integration plugin for IBM Spectrum Symphony Host Factory"
10+
description: "Open Resource Broker (ORB) — dynamic cloud resource provisioning via CLI and REST API"
1111
author: "AWS Professional Services"
1212
email: "aws-proserve@amazon.com"
1313
license: "Apache-2.0"
@@ -20,6 +20,7 @@ repository:
2020
registry: ghcr.io # Container registry
2121
build:
2222
platforms: [linux/amd64, linux/arm64] # Container platforms
23+
package_root: src/orb
2324
ci:
2425
test_timeout: 300 # Test timeout in seconds
2526
coverage_threshold: 70 # Minimum coverage percentage

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ RUN uv pip install --no-cache /tmp/*.whl \
5959

6060
# Copy only runtime files needed
6161
COPY config/ ./config/
62-
COPY src/infrastructure/scheduler/hostfactory/scripts/ ./scripts/
62+
COPY src/orb/infrastructure/scheduler/hostfactory/scripts/ ./scripts/
6363
COPY deployment/docker/docker-entrypoint.sh ./docker-entrypoint.sh
6464

6565
# Set permissions and environment in single layer

0 commit comments

Comments
 (0)