Move the inline route definitions out of __init__.py into a new core/routes package (registry, base_models, helpers, settings, version). Add the JobProgressTracker utility in core/progress.py and extract version discovery logic into core/version.py. Update tests to cover the refactored structure.
18 lines
554 B
Python
18 lines
554 B
Python
"""Version endpoint registration."""
|
|
|
|
import asyncio
|
|
|
|
from .. import version as version_service
|
|
|
|
|
|
def register_version_routes(routes, web, json_api_endpoint):
|
|
"""Register the endpoint exposing local and remote project versions."""
|
|
|
|
@routes.get("/model_resolver/version")
|
|
@json_api_endpoint("version")
|
|
async def get_project_version(request):
|
|
"""Return the installed version and the latest GitHub version."""
|
|
return web.json_response(
|
|
await asyncio.to_thread(version_service._get_project_version_info)
|
|
)
|