From e3ea3e51edc910b9ec54e829b381baae6f4d3dad Mon Sep 17 00:00:00 2001 From: RJCD-Diamond Date: Fri, 22 May 2026 13:29:34 +0000 Subject: [PATCH 1/6] change name from indigoapi to heliotrapi --- .copier-answers.yml | 6 +-- Dockerfile | 10 ++-- FRONTEND.md | 2 +- README.md | 46 +++++++++---------- catalog-info.yaml | 4 +- helm/{indigoapi => heliotrapi}/.helmignore | 0 helm/{indigoapi => heliotrapi}/Chart.yaml | 2 +- .../templates/_helpers.tpl | 20 ++++---- .../templates/configmap.yaml | 0 .../templates/deployment.yaml | 0 .../templates/ingress.yaml | 0 helm/heliotrapi/templates/service.yaml | 13 ++++++ helm/{indigoapi => heliotrapi}/values.yaml | 2 +- helm/indigoapi/templates/service.yaml | 15 ------ pyproject.toml | 12 ++--- src/indigoapi/__main__.py | 9 ++-- src/indigoapi/analyses/delay.py | 2 +- src/indigoapi/analyses/peak_fitting.py | 3 +- src/indigoapi/analyses/simple_maths.py | 3 +- src/indigoapi/client.py | 9 ++-- src/indigoapi/server.py | 19 ++++---- src/indigoapi/templates/index.html | 4 +- tests/test_server.py | 7 ++- uv.lock | 2 +- 24 files changed, 91 insertions(+), 99 deletions(-) rename helm/{indigoapi => heliotrapi}/.helmignore (100%) rename helm/{indigoapi => heliotrapi}/Chart.yaml (86%) rename helm/{indigoapi => heliotrapi}/templates/_helpers.tpl (71%) rename helm/{indigoapi => heliotrapi}/templates/configmap.yaml (100%) rename helm/{indigoapi => heliotrapi}/templates/deployment.yaml (100%) rename helm/{indigoapi => heliotrapi}/templates/ingress.yaml (100%) create mode 100644 helm/heliotrapi/templates/service.yaml rename helm/{indigoapi => heliotrapi}/values.yaml (96%) delete mode 100644 helm/indigoapi/templates/service.yaml diff --git a/.copier-answers.yml b/.copier-answers.yml index 0c22f91..af092b3 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -7,14 +7,14 @@ component_lifecycle: experimental component_owner: group:default/data_analysis component_type: service description: An API for small fast data analysis jobs at Diamond Light Source -distribution_name: indigoapi +distribution_name: heliotrapi docker: true docker_debug: false docs_type: README git_platform: github.com github_org: DiamondLightSource -package_name: indigoapi +package_name: heliotrapi pypi: true -repo_name: indigoapi +repo_name: heliotrapi strict_typing: false type_checker: pyright diff --git a/Dockerfile b/Dockerfile index a1b19df..72e313b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -89,19 +89,19 @@ COPY --chown=1000:1000 --from=build /app/.venv /app/.venv RUN chmod -R 777 /app ENV PATH=/app/.venv/bin:$PATH -# Add copy of indigoapi source to container for debugging +# Add copy of heliotrapi source to container for debugging WORKDIR /workspaces -COPY --chown=1000:1000 . indigoapi +COPY --chown=1000:1000 . heliotrapi # Make allowance for non-1000 uid -RUN chmod o+wrX indigoapi +RUN chmod o+wrX heliotrapi # Make invariant symlink to site-packages for debugging -# /app/.venv/lib/python/site-packages/indigoapi:/workspaces/indigoapi +# /app/.venv/lib/python/site-packages/heliotrapi:/workspaces/heliotrapi WORKDIR /app/.venv/lib RUN ln -s python* python # Switch user 1000 USER ubuntu -ENTRYPOINT ["indigoapi"] +ENTRYPOINT ["heliotrapi"] CMD ["serve"] diff --git a/FRONTEND.md b/FRONTEND.md index b8ff9fe..fa0a0ad 100644 --- a/FRONTEND.md +++ b/FRONTEND.md @@ -16,7 +16,7 @@ The API includes a web frontend hosted at the root path (`/`). Once the API server is running: ```bash -indigoapi serve +heliotrapi serve ``` Open your browser and navigate to: diff --git a/README.md b/README.md index 47b815d..21e8a4c 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,36 @@ -[![CI](https://github.com/DiamondLightSource/indigoapi/actions/workflows/ci.yml/badge.svg)](https://github.com/DiamondLightSource/indigoapi/actions/workflows/ci.yml) -[![Coverage](https://codecov.io/gh/DiamondLightSource/indigoapi/branch/main/graph/badge.svg)](https://codecov.io/gh/DiamondLightSource/indigoapi) -[![PyPI](https://img.shields.io/pypi/v/indigoapi.svg)](https://pypi.org/project/indigoapi) +[![CI](https://github.com/DiamondLightSource/heliotrapi/actions/workflows/ci.yml/badge.svg)](https://github.com/DiamondLightSource/heliotrapi/actions/workflows/ci.yml) +[![Coverage](https://codecov.io/gh/DiamondLightSource/heliotrapi/branch/main/graph/badge.svg)](https://codecov.io/gh/DiamondLightSource/heliotrapi) +[![PyPI](https://img.shields.io/pypi/v/heliotrapi.svg)](https://pypi.org/project/heliotrapi) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) -# indigoapi +# heliotrapi An API for small fast data analysis jobs at Diamond Light Source. -`indigoapi` exposes an HTTP API to submit analysis jobs, return queued results, and optionally consume messages from RabbitMQ. +`heliotrapi` exposes an HTTP API to submit analysis jobs, return queued results, and optionally consume messages from RabbitMQ. -Source | +Source | :---: | :---: -PyPI | `pip install indigoapi` -Docker | `docker run ghcr.io/diamondlightsource/indigoapi:latest` -Releases | +PyPI | `pip install heliotrapi` +Docker | `docker run ghcr.io/diamondlightsource/heliotrapi:latest` +Releases | Example Python usage: ```python -from indigoapi import __version__ +from heliotrapi import __version__ -print(f"Hello indigoapi {__version__}") +print(f"Hello heliotrapi {__version__}") ``` To start the api server in dev mode on local host: ```bash -uvicorn indigoapi.main:start_api --reload --factory --host 127.0.0.1 --port 8000 +uvicorn heliotrapi.main:start_api --reload --factory --host 127.0.0.1 --port 8000 or -indigoapi serve +heliotrapi serve ``` @@ -42,7 +42,7 @@ The app accepts analysis jobs via HTTP or the client and stores results in memor ```python - from indigoapi.client import AnalysisClient + from heliotrapi.client import AnalysisClient client = AnalysisClient("ixx-analysis.diamond.ac.uk") @@ -73,7 +73,7 @@ You can also navigate to the url or the ip address to be met with: AnalysisClient ─────--──────────────── │ ▲ │ │ ▼ │ ▼ ▼ - Analysis <-── IndigoAPI ──---► RabbitMQ ──---► Results + Analysis <-── heliotrapi ──---► RabbitMQ ──---► Results Job ─---► ▲ │ │ │ │ │ @@ -82,7 +82,7 @@ You can also navigate to the url or the ip address to be met with: ## Kubernetes deployment -This repository includes a Helm chart under `./helm/helm/indigoapi`. +This repository includes a Helm chart under `./helm/helm/heliotrapi`. ### Config support @@ -124,26 +124,26 @@ config: 1. Build and push your Docker image ```bash -podman build -t ghcr.io/diamondlightsource/indigoapi:latest . -podman push ghcr.io/diamondlightsource/indigoapi:latest +podman build -t ghcr.io/diamondlightsource/heliotrapi:latest . +podman push ghcr.io/diamondlightsource/heliotrapi:latest ``` 2. Render the chart ```bash -helm template indigoapi ./helm/helm/indigoapi +helm template heliotrapi ./helm/helm/heliotrapi ``` 3. Dry-run validation ```bash -helm template indigoapi ./helm/helm/indigoapi | kubectl apply --dry-run=client -f - +helm template heliotrapi ./helm/helm/heliotrapi | kubectl apply --dry-run=client -f - ``` 4. Install the chart ```bash -helm install indigoapi ./helm/helm/indigoapi +helm install heliotrapi ./helm/helm/heliotrapi ``` 5. Verify the deployment @@ -156,7 +156,7 @@ kubectl get svc 6. Test the API ```bash -kubectl port-forward svc/indigoapi 8000:8000 +kubectl port-forward svc/heliotrapi 8000:8000 ``` Then open: @@ -167,6 +167,6 @@ http://localhost:8000/docs ## Notes -- The chart name has been updated to `indigoapi`. +- The chart name has been updated to `heliotrapi`. - The config file is mounted via a `ConfigMap` and loaded from `/etc/config/config.yaml`. - The Helm chart currently creates a `Deployment`, `Service`, and `ConfigMap`. diff --git a/catalog-info.yaml b/catalog-info.yaml index f25e4f6..8e01253 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -1,8 +1,8 @@ apiVersion: backstage.io/v1alpha1 kind: Component metadata: - name: indigoapi - title: indigoapi + name: heliotrapi + title: heliotrapi description: An API for small fast data analysis jobs at Diamond Light Source spec: type: service diff --git a/helm/indigoapi/.helmignore b/helm/heliotrapi/.helmignore similarity index 100% rename from helm/indigoapi/.helmignore rename to helm/heliotrapi/.helmignore diff --git a/helm/indigoapi/Chart.yaml b/helm/heliotrapi/Chart.yaml similarity index 86% rename from helm/indigoapi/Chart.yaml rename to helm/heliotrapi/Chart.yaml index d1ad9dd..46e0ffd 100644 --- a/helm/indigoapi/Chart.yaml +++ b/helm/heliotrapi/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -name: indigoapi +name: heliotrapi description: A Helm chart for Kubernetes type: application diff --git a/helm/indigoapi/templates/_helpers.tpl b/helm/heliotrapi/templates/_helpers.tpl similarity index 71% rename from helm/indigoapi/templates/_helpers.tpl rename to helm/heliotrapi/templates/_helpers.tpl index 8759bc8..75da229 100644 --- a/helm/indigoapi/templates/_helpers.tpl +++ b/helm/heliotrapi/templates/_helpers.tpl @@ -1,14 +1,14 @@ {{/* Expand the name of the chart. */}} -{{- define "indigoapi.name" -}} +{{- define "heliotrapi.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Expand the name of the chart. */}} -{{- define "indigoapi.fullname" -}} +{{- define "heliotrapi.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -24,16 +24,16 @@ Expand the name of the chart. {{/* Create chart name and version as used by the chart label. */}} -{{- define "indigoapi.chart" -}} +{{- define "heliotrapi.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "indigoapi.labels" -}} -helm.sh/chart: {{ include "indigoapi.chart" . }} -{{ include "indigoapi.selectorLabels" . }} +{{- define "heliotrapi.labels" -}} +helm.sh/chart: {{ include "heliotrapi.chart" . }} +{{ include "heliotrapi.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -43,17 +43,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "indigoapi.selectorLabels" -}} -app.kubernetes.io/name: {{ include "indigoapi.name" . }} +{{- define "heliotrapi.selectorLabels" -}} +app.kubernetes.io/name: {{ include "heliotrapi.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "indigoapi.serviceAccountName" -}} +{{- define "heliotrapi.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "indigoapi.fullname" .) .Values.serviceAccount.name }} +{{- default (include "heliotrapi.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} diff --git a/helm/indigoapi/templates/configmap.yaml b/helm/heliotrapi/templates/configmap.yaml similarity index 100% rename from helm/indigoapi/templates/configmap.yaml rename to helm/heliotrapi/templates/configmap.yaml diff --git a/helm/indigoapi/templates/deployment.yaml b/helm/heliotrapi/templates/deployment.yaml similarity index 100% rename from helm/indigoapi/templates/deployment.yaml rename to helm/heliotrapi/templates/deployment.yaml diff --git a/helm/indigoapi/templates/ingress.yaml b/helm/heliotrapi/templates/ingress.yaml similarity index 100% rename from helm/indigoapi/templates/ingress.yaml rename to helm/heliotrapi/templates/ingress.yaml diff --git a/helm/heliotrapi/templates/service.yaml b/helm/heliotrapi/templates/service.yaml new file mode 100644 index 0000000..5c89119 --- /dev/null +++ b/helm/heliotrapi/templates/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: { { include "heliotrapi.fullname" . } } + labels: { { - include "heliotrapi.labels" . | nindent 4 } } +spec: + type: { { .Values.service.type } } + ports: + - port: { { .Values.service.port } } + targetPort: http + protocol: TCP + name: http + selector: { { - include "heliotrapi.selectorLabels" . | nindent 4 } } diff --git a/helm/indigoapi/values.yaml b/helm/heliotrapi/values.yaml similarity index 96% rename from helm/indigoapi/values.yaml rename to helm/heliotrapi/values.yaml index 8d281f1..283700e 100644 --- a/helm/indigoapi/values.yaml +++ b/helm/heliotrapi/values.yaml @@ -1,7 +1,7 @@ replicaCount: 1 image: - repository: ghcr.io/diamondlightsource/indigoapi + repository: ghcr.io/diamondlightsource/heliotrapi pullPolicy: Always tag: "" diff --git a/helm/indigoapi/templates/service.yaml b/helm/indigoapi/templates/service.yaml deleted file mode 100644 index b68bac1..0000000 --- a/helm/indigoapi/templates/service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "indigoapi.fullname" . }} - labels: - {{- include "indigoapi.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "indigoapi.selectorLabels" . | nindent 4 }} diff --git a/pyproject.toml b/pyproject.toml index ec122ba..af875f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=64", "setuptools_scm[toml]>=8"] build-backend = "setuptools.build_meta" [project] -name = "indigoapi" +name = "heliotrapi" classifiers = [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: Apache Software License", @@ -44,17 +44,17 @@ dev = [ ] [project.scripts] -indigoapi = "indigoapi.__main__:main" +heliotrapi = "heliotrapi.__main__:main" [project.urls] -GitHub = "https://github.com/DiamondLightSource/indigoapi" +GitHub = "https://github.com/DiamondLightSource/heliotrapi" [[project.authors]] # Further authors may be added by duplicating this section email = "Richard.Dixey@Diamond.ac.uk" name = "Richard Dixey" [tool.setuptools_scm] -version_file = "src/indigoapi/_version.py" +version_file = "src/heliotrapi/_version.py" [tool.pyright] typeCheckingMode = "standard" @@ -72,7 +72,7 @@ testpaths = "docs src tests" [tool.coverage.run] patch = ["subprocess"] -data_file = "/tmp/indigoapi.coverage" +data_file = "/tmp/heliotrapi.coverage" [tool.coverage.paths] # Tests are run from installed location, map back to the src directory @@ -119,7 +119,7 @@ description = "Run tests with coverage" commands = [ [ "pytest", - "--cov=indigoapi", + "--cov=heliotrapi", "--cov-report", "term", "--cov-report", diff --git a/src/indigoapi/__main__.py b/src/indigoapi/__main__.py index f706b5e..a322c93 100644 --- a/src/indigoapi/__main__.py +++ b/src/indigoapi/__main__.py @@ -1,13 +1,12 @@ -"""Interface for ``python -m indigoapi``.""" +"""Interface for ``python -m heliotrapi``.""" import logging from pathlib import Path import click import uvicorn - -from indigoapi.config import Config -from indigoapi.server import start_api +from heliotrapi.config import Config +from heliotrapi.server import start_api from ._version import __version__ @@ -61,7 +60,7 @@ def serve(ctx: click.Context): logger.info(f"port {config.server.port}") uvicorn.run( - f"indigoapi.server:{start_api.__name__}", + f"heliotrapi.server:{start_api.__name__}", factory=True, host=config.server.host, port=int(config.server.port), diff --git a/src/indigoapi/analyses/delay.py b/src/indigoapi/analyses/delay.py index dface5c..357d3d3 100644 --- a/src/indigoapi/analyses/delay.py +++ b/src/indigoapi/analyses/delay.py @@ -1,6 +1,6 @@ import time -from indigoapi.analysis_core.decorator import analysis +from heliotrapi.analysis_core.decorator import analysis @analysis() diff --git a/src/indigoapi/analyses/peak_fitting.py b/src/indigoapi/analyses/peak_fitting.py index 8412db8..5abd197 100644 --- a/src/indigoapi/analyses/peak_fitting.py +++ b/src/indigoapi/analyses/peak_fitting.py @@ -1,8 +1,7 @@ import numpy as np +from heliotrapi.analysis_core.decorator import analysis from scipy.optimize import curve_fit -from indigoapi.analysis_core.decorator import analysis - def gaussian(x: np.ndarray, amplitude: float, x0: float, sigma: float) -> np.ndarray: return amplitude * np.exp(-((x - x0) ** 2) / (2 * sigma**2)) diff --git a/src/indigoapi/analyses/simple_maths.py b/src/indigoapi/analyses/simple_maths.py index e943706..8c51fb7 100644 --- a/src/indigoapi/analyses/simple_maths.py +++ b/src/indigoapi/analyses/simple_maths.py @@ -1,8 +1,7 @@ from collections.abc import Sequence import numpy as np - -from indigoapi.analysis_core.decorator import analysis +from heliotrapi.analysis_core.decorator import analysis @analysis() diff --git a/src/indigoapi/client.py b/src/indigoapi/client.py index 946e5a4..f803513 100644 --- a/src/indigoapi/client.py +++ b/src/indigoapi/client.py @@ -6,8 +6,7 @@ from uuid import UUID import requests - -from indigoapi.api.routes import ( +from heliotrapi.api.routes import ( ANALYSE_ROUTE, ANALYSES_ROUTE, ENDPOINTS_ROUTE, @@ -16,8 +15,8 @@ RESULT_LATEST_ROUTE, RESULTS_ALL_ROUTE, ) -from indigoapi.models import AnalysisRequest, AnalysisResponse, AnalysisResult -from indigoapi.utils.serialisers import serialise +from heliotrapi.models import AnalysisRequest, AnalysisResponse, AnalysisResult +from heliotrapi.utils.serialisers import serialise logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) @@ -195,7 +194,7 @@ def get_request_id_result( # if __name__ == "__main__": -# from indigoapi.analyses.peak_fitting import gaussian +# from heliotrapi.analyses.peak_fitting import gaussian # x = np.round(np.linspace(0, 20, 50), 3) # y = np.round(gaussian(x, 10, 5, 1) + (np.random.rand(x.shape[-1]) / 5), 3) diff --git a/src/indigoapi/server.py b/src/indigoapi/server.py index fa7821b..806d3e0 100644 --- a/src/indigoapi/server.py +++ b/src/indigoapi/server.py @@ -1,22 +1,21 @@ -"""Interface for `python -m indigoapi`.""" +"""Interface for `python -m heliotrapi`.""" import asyncio import logging from contextlib import asynccontextmanager from pathlib import Path +import heliotrapi from fastapi import FastAPI from fastapi.responses import FileResponse from fastapi.staticfiles import StaticFiles +from heliotrapi._version import __version__ +from heliotrapi.analysis_core import MODULE_NAMES, initialize_analyses +from heliotrapi.api.routes import ROUTER +from heliotrapi.config import Config +from heliotrapi.task_queue import QueueManager, RabbitMQListener, cleanup_results from xrpd_toolbox.utils.messenger import Messenger -import indigoapi -from indigoapi._version import __version__ -from indigoapi.analysis_core import MODULE_NAMES, initialize_analyses -from indigoapi.api.routes import ROUTER -from indigoapi.config import Config -from indigoapi.task_queue import QueueManager, RabbitMQListener, cleanup_results - config: Config = Config.load_config() @@ -89,7 +88,7 @@ def start_api() -> FastAPI: logger.info(f"version: {__version__}") app = FastAPI( - title=indigoapi.__name__.capitalize(), + title=heliotrapi.__name__.capitalize(), version=__version__, description="An API for fast data analysis jobs", lifespan=lifespan, @@ -109,6 +108,6 @@ async def serve_index(): index_file = Path(__file__).parent / "templates" / "index.html" if index_file.exists(): return FileResponse(index_file) - return {"message": "Indigo Analysis API. Visit /docs for API documentation"} + return {"message": "HeliotrAPI Analysis. Visit /docs for API documentation"} return app diff --git a/src/indigoapi/templates/index.html b/src/indigoapi/templates/index.html index 72ae7ba..9c65628 100644 --- a/src/indigoapi/templates/index.html +++ b/src/indigoapi/templates/index.html @@ -4,14 +4,14 @@ - Indigo Analysis API + HeliotrAPI Analysis
-

🔬 Indigo Analysis API

+

🔬 HeliotrAPI Analysis

Run analysis jobs and track results in real-time

diff --git a/tests/test_server.py b/tests/test_server.py index b4939eb..f122687 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -1,8 +1,7 @@ from pathlib import Path from fastapi.testclient import TestClient - -from indigoapi.server import start_api +from heliotrapi.server import start_api def test_start_api_serves_root_index(): @@ -10,7 +9,7 @@ def test_start_api_serves_root_index(): with TestClient(app) as client: response = client.get("/") assert response.status_code == 200 - assert "Indigo" in response.text or " Date: Fri, 22 May 2026 13:44:20 +0000 Subject: [PATCH 2/6] rename under src --- src/{indigoapi => heliotrapi}/__init__.py | 0 src/{indigoapi => heliotrapi}/__main__.py | 1 + .../analyses/__init__.py | 0 src/{indigoapi => heliotrapi}/analyses/delay.py | 0 .../analyses/peak_fitting.py | 3 ++- .../analyses/simple_maths.py | 1 + .../analyses/workflows.py | 0 .../analysis_core/__init__.py | 0 .../analysis_core/decorator.py | 0 .../analysis_core/loader.py | 1 - .../analysis_core/registry.py | 0 src/{indigoapi => heliotrapi}/api/__init__.py | 0 src/{indigoapi => heliotrapi}/api/routes.py | 1 - src/{indigoapi => heliotrapi}/client.py | 1 + src/{indigoapi => heliotrapi}/config.py | 0 src/{indigoapi => heliotrapi}/models.py | 0 src/{indigoapi => heliotrapi}/server.py | 5 +++-- src/{indigoapi => heliotrapi}/static/app.js | 0 src/{indigoapi => heliotrapi}/static/style.css | 0 .../task_queue/__init__.py | 0 .../task_queue/cleanup.py | 0 .../task_queue/manager.py | 3 +-- .../task_queue/rabbitmq.py | 3 +-- .../templates/index.html | 0 .../utils/serialisers.py | 0 src/indigoapi/.DS_Store | Bin 6148 -> 0 bytes 26 files changed, 10 insertions(+), 9 deletions(-) rename src/{indigoapi => heliotrapi}/__init__.py (100%) rename src/{indigoapi => heliotrapi}/__main__.py (99%) rename src/{indigoapi => heliotrapi}/analyses/__init__.py (100%) rename src/{indigoapi => heliotrapi}/analyses/delay.py (100%) rename src/{indigoapi => heliotrapi}/analyses/peak_fitting.py (99%) rename src/{indigoapi => heliotrapi}/analyses/simple_maths.py (99%) rename src/{indigoapi => heliotrapi}/analyses/workflows.py (100%) rename src/{indigoapi => heliotrapi}/analysis_core/__init__.py (100%) rename src/{indigoapi => heliotrapi}/analysis_core/decorator.py (100%) rename src/{indigoapi => heliotrapi}/analysis_core/loader.py (99%) rename src/{indigoapi => heliotrapi}/analysis_core/registry.py (100%) rename src/{indigoapi => heliotrapi}/api/__init__.py (100%) rename src/{indigoapi => heliotrapi}/api/routes.py (99%) rename src/{indigoapi => heliotrapi}/client.py (99%) rename src/{indigoapi => heliotrapi}/config.py (100%) rename src/{indigoapi => heliotrapi}/models.py (100%) rename src/{indigoapi => heliotrapi}/server.py (99%) rename src/{indigoapi => heliotrapi}/static/app.js (100%) rename src/{indigoapi => heliotrapi}/static/style.css (100%) rename src/{indigoapi => heliotrapi}/task_queue/__init__.py (100%) rename src/{indigoapi => heliotrapi}/task_queue/cleanup.py (100%) rename src/{indigoapi => heliotrapi}/task_queue/manager.py (99%) rename src/{indigoapi => heliotrapi}/task_queue/rabbitmq.py (99%) rename src/{indigoapi => heliotrapi}/templates/index.html (100%) rename src/{indigoapi => heliotrapi}/utils/serialisers.py (100%) delete mode 100644 src/indigoapi/.DS_Store diff --git a/src/indigoapi/__init__.py b/src/heliotrapi/__init__.py similarity index 100% rename from src/indigoapi/__init__.py rename to src/heliotrapi/__init__.py diff --git a/src/indigoapi/__main__.py b/src/heliotrapi/__main__.py similarity index 99% rename from src/indigoapi/__main__.py rename to src/heliotrapi/__main__.py index a322c93..6ed4063 100644 --- a/src/indigoapi/__main__.py +++ b/src/heliotrapi/__main__.py @@ -5,6 +5,7 @@ import click import uvicorn + from heliotrapi.config import Config from heliotrapi.server import start_api diff --git a/src/indigoapi/analyses/__init__.py b/src/heliotrapi/analyses/__init__.py similarity index 100% rename from src/indigoapi/analyses/__init__.py rename to src/heliotrapi/analyses/__init__.py diff --git a/src/indigoapi/analyses/delay.py b/src/heliotrapi/analyses/delay.py similarity index 100% rename from src/indigoapi/analyses/delay.py rename to src/heliotrapi/analyses/delay.py diff --git a/src/indigoapi/analyses/peak_fitting.py b/src/heliotrapi/analyses/peak_fitting.py similarity index 99% rename from src/indigoapi/analyses/peak_fitting.py rename to src/heliotrapi/analyses/peak_fitting.py index 5abd197..dac958f 100644 --- a/src/indigoapi/analyses/peak_fitting.py +++ b/src/heliotrapi/analyses/peak_fitting.py @@ -1,7 +1,8 @@ import numpy as np -from heliotrapi.analysis_core.decorator import analysis from scipy.optimize import curve_fit +from heliotrapi.analysis_core.decorator import analysis + def gaussian(x: np.ndarray, amplitude: float, x0: float, sigma: float) -> np.ndarray: return amplitude * np.exp(-((x - x0) ** 2) / (2 * sigma**2)) diff --git a/src/indigoapi/analyses/simple_maths.py b/src/heliotrapi/analyses/simple_maths.py similarity index 99% rename from src/indigoapi/analyses/simple_maths.py rename to src/heliotrapi/analyses/simple_maths.py index 8c51fb7..1413bc1 100644 --- a/src/indigoapi/analyses/simple_maths.py +++ b/src/heliotrapi/analyses/simple_maths.py @@ -1,6 +1,7 @@ from collections.abc import Sequence import numpy as np + from heliotrapi.analysis_core.decorator import analysis diff --git a/src/indigoapi/analyses/workflows.py b/src/heliotrapi/analyses/workflows.py similarity index 100% rename from src/indigoapi/analyses/workflows.py rename to src/heliotrapi/analyses/workflows.py diff --git a/src/indigoapi/analysis_core/__init__.py b/src/heliotrapi/analysis_core/__init__.py similarity index 100% rename from src/indigoapi/analysis_core/__init__.py rename to src/heliotrapi/analysis_core/__init__.py diff --git a/src/indigoapi/analysis_core/decorator.py b/src/heliotrapi/analysis_core/decorator.py similarity index 100% rename from src/indigoapi/analysis_core/decorator.py rename to src/heliotrapi/analysis_core/decorator.py diff --git a/src/indigoapi/analysis_core/loader.py b/src/heliotrapi/analysis_core/loader.py similarity index 99% rename from src/indigoapi/analysis_core/loader.py rename to src/heliotrapi/analysis_core/loader.py index d6d213e..394cdf0 100644 --- a/src/indigoapi/analysis_core/loader.py +++ b/src/heliotrapi/analysis_core/loader.py @@ -9,7 +9,6 @@ from typing import ParamSpec, TypeVar from git import Repo - from indigoapi.analysis_core.registry import register_analysis from indigoapi.config import Config diff --git a/src/indigoapi/analysis_core/registry.py b/src/heliotrapi/analysis_core/registry.py similarity index 100% rename from src/indigoapi/analysis_core/registry.py rename to src/heliotrapi/analysis_core/registry.py diff --git a/src/indigoapi/api/__init__.py b/src/heliotrapi/api/__init__.py similarity index 100% rename from src/indigoapi/api/__init__.py rename to src/heliotrapi/api/__init__.py diff --git a/src/indigoapi/api/routes.py b/src/heliotrapi/api/routes.py similarity index 99% rename from src/indigoapi/api/routes.py rename to src/heliotrapi/api/routes.py index 191d746..9aa2dba 100644 --- a/src/indigoapi/api/routes.py +++ b/src/heliotrapi/api/routes.py @@ -4,7 +4,6 @@ from fastapi import APIRouter, HTTPException, Request from fastapi.routing import APIRoute - from indigoapi.analysis_core.registry import get_analysis, list_analyses from indigoapi.models import AnalysisRequest, AnalysisResponse, AnalysisResult from indigoapi.task_queue import QueueManager diff --git a/src/indigoapi/client.py b/src/heliotrapi/client.py similarity index 99% rename from src/indigoapi/client.py rename to src/heliotrapi/client.py index f803513..916f1a0 100644 --- a/src/indigoapi/client.py +++ b/src/heliotrapi/client.py @@ -6,6 +6,7 @@ from uuid import UUID import requests + from heliotrapi.api.routes import ( ANALYSE_ROUTE, ANALYSES_ROUTE, diff --git a/src/indigoapi/config.py b/src/heliotrapi/config.py similarity index 100% rename from src/indigoapi/config.py rename to src/heliotrapi/config.py diff --git a/src/indigoapi/models.py b/src/heliotrapi/models.py similarity index 100% rename from src/indigoapi/models.py rename to src/heliotrapi/models.py diff --git a/src/indigoapi/server.py b/src/heliotrapi/server.py similarity index 99% rename from src/indigoapi/server.py rename to src/heliotrapi/server.py index 806d3e0..1227b8f 100644 --- a/src/indigoapi/server.py +++ b/src/heliotrapi/server.py @@ -5,16 +5,17 @@ from contextlib import asynccontextmanager from pathlib import Path -import heliotrapi from fastapi import FastAPI from fastapi.responses import FileResponse from fastapi.staticfiles import StaticFiles +from xrpd_toolbox.utils.messenger import Messenger + +import heliotrapi from heliotrapi._version import __version__ from heliotrapi.analysis_core import MODULE_NAMES, initialize_analyses from heliotrapi.api.routes import ROUTER from heliotrapi.config import Config from heliotrapi.task_queue import QueueManager, RabbitMQListener, cleanup_results -from xrpd_toolbox.utils.messenger import Messenger config: Config = Config.load_config() diff --git a/src/indigoapi/static/app.js b/src/heliotrapi/static/app.js similarity index 100% rename from src/indigoapi/static/app.js rename to src/heliotrapi/static/app.js diff --git a/src/indigoapi/static/style.css b/src/heliotrapi/static/style.css similarity index 100% rename from src/indigoapi/static/style.css rename to src/heliotrapi/static/style.css diff --git a/src/indigoapi/task_queue/__init__.py b/src/heliotrapi/task_queue/__init__.py similarity index 100% rename from src/indigoapi/task_queue/__init__.py rename to src/heliotrapi/task_queue/__init__.py diff --git a/src/indigoapi/task_queue/cleanup.py b/src/heliotrapi/task_queue/cleanup.py similarity index 100% rename from src/indigoapi/task_queue/cleanup.py rename to src/heliotrapi/task_queue/cleanup.py diff --git a/src/indigoapi/task_queue/manager.py b/src/heliotrapi/task_queue/manager.py similarity index 99% rename from src/indigoapi/task_queue/manager.py rename to src/heliotrapi/task_queue/manager.py index 7c7fbf2..131d1a5 100644 --- a/src/indigoapi/task_queue/manager.py +++ b/src/heliotrapi/task_queue/manager.py @@ -4,11 +4,10 @@ from datetime import datetime from uuid import UUID -from xrpd_toolbox.utils.messenger import DEFAULT_DII_PROCESSED_DESTINATION, Messenger - from indigoapi.analysis_core.registry import get_analysis from indigoapi.models import AnalysisRequest, AnalysisResponse, AnalysisResult from indigoapi.utils.serialisers import deserialise, serialise +from xrpd_toolbox.utils.messenger import DEFAULT_DII_PROCESSED_DESTINATION, Messenger logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) diff --git a/src/indigoapi/task_queue/rabbitmq.py b/src/heliotrapi/task_queue/rabbitmq.py similarity index 99% rename from src/indigoapi/task_queue/rabbitmq.py rename to src/heliotrapi/task_queue/rabbitmq.py index 28a6c11..e80c18d 100644 --- a/src/indigoapi/task_queue/rabbitmq.py +++ b/src/heliotrapi/task_queue/rabbitmq.py @@ -6,10 +6,9 @@ from typing import Any import stomp -from pydantic import BaseModel, Field - from indigoapi.models import AnalysisRequest from indigoapi.task_queue import QueueManager +from pydantic import BaseModel, Field logger = logging.getLogger(__name__) diff --git a/src/indigoapi/templates/index.html b/src/heliotrapi/templates/index.html similarity index 100% rename from src/indigoapi/templates/index.html rename to src/heliotrapi/templates/index.html diff --git a/src/indigoapi/utils/serialisers.py b/src/heliotrapi/utils/serialisers.py similarity index 100% rename from src/indigoapi/utils/serialisers.py rename to src/heliotrapi/utils/serialisers.py diff --git a/src/indigoapi/.DS_Store b/src/indigoapi/.DS_Store deleted file mode 100644 index 471a157025328038101ec1be5f65c6922aec40ee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKOHRWu6nt(g(a)w!mJtW2#0{dVELd}ZLO)cILQ-0~=q_jA033oNaS@n#cB|A4 zTZG`f=y@D_#!g1Eors7V?-ti0LlNmBiJd-*hG0MQELx$3I;Ue~@*-1QBUzuZt-%~H z2Y#CaT)P8ZvzZi9U%&g?yqwSSas~#shcR;Wse#%-^&}5a6~|Q{tKK737yJU5%U-s! zl zQSlKeF67`(!}#jxTg}lP*rhD+L^-@^Qqax1VkpnD1D`q7x#;Z*cbg`?x?9&{IE#Pl z0M2Yici_=VbHE%h2aXPKe@KwTG+^aXw+<9MRN3DlGEnEo0x=1g2CO`y2jRRF=%p_F zVmL2HdlGnQz{;bSi_@7gPMFz+KNP34qdif&xYVPS=72eH>OkAy4tf6HeE Date: Fri, 22 May 2026 13:46:35 +0000 Subject: [PATCH 3/6] sort imports --- tests/test_api_routes.py | 4 ++-- tests/test_cleanup.py | 6 +++--- tests/test_cli.py | 10 +++++----- tests/test_client.py | 12 ++++++------ tests/test_gaussian_fit.py | 6 +++--- tests/test_plugins.py | 4 ++-- tests/test_queue_manager.py | 14 +++++++------- tests/test_rabbitmq_listener.py | 12 ++++++------ tests/test_serialisers.py | 2 +- 9 files changed, 35 insertions(+), 35 deletions(-) diff --git a/tests/test_api_routes.py b/tests/test_api_routes.py index 1730824..2336553 100644 --- a/tests/test_api_routes.py +++ b/tests/test_api_routes.py @@ -3,8 +3,8 @@ from fastapi.testclient import TestClient -from indigoapi.models import AnalysisResult -from indigoapi.server import start_api +from heliotrapi.models import AnalysisResult +from heliotrapi.server import start_api def test_api_health_and_endpoints_routes(): diff --git a/tests/test_cleanup.py b/tests/test_cleanup.py index 06659ab..1644dae 100644 --- a/tests/test_cleanup.py +++ b/tests/test_cleanup.py @@ -4,7 +4,7 @@ import pytest -from indigoapi.task_queue import cleanup_results +from heliotrapi.task_queue import cleanup_results @pytest.mark.asyncio @@ -19,7 +19,7 @@ class FakeQueue: async def fake_sleep(interval): raise asyncio.CancelledError - monkeypatch.setattr("indigoapi.task_queue.cleanup.asyncio.sleep", fake_sleep) + monkeypatch.setattr("heliotrapi.task_queue.cleanup.asyncio.sleep", fake_sleep) with pytest.raises(asyncio.CancelledError): await cleanup_results(fake_queue, ttl=1, interval=0) @@ -39,7 +39,7 @@ class FakeQueue: async def fake_sleep(interval): raise asyncio.CancelledError - monkeypatch.setattr("indigoapi.task_queue.cleanup.asyncio.sleep", fake_sleep) + monkeypatch.setattr("heliotrapi.task_queue.cleanup.asyncio.sleep", fake_sleep) with pytest.raises(asyncio.CancelledError): await cleanup_results(fake_queue, ttl=60, interval=0) diff --git a/tests/test_cli.py b/tests/test_cli.py index bb5d909..040c5f7 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -3,17 +3,17 @@ from click.testing import CliRunner -from indigoapi import __version__ -from indigoapi.__main__ import main +from heliotrapi import __version__ +from heliotrapi.__main__ import main def test_cli_version(): - cmd = [sys.executable, "-m", "indigoapi", "--version"] + cmd = [sys.executable, "-m", "heliotrapi", "--version"] assert subprocess.check_output(cmd).decode().strip() == __version__ def test_cli_help(): - cmd = [sys.executable, "-m", "indigoapi", "--help"] + cmd = [sys.executable, "-m", "heliotrapi", "--help"] output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode() assert "serve" in output @@ -35,7 +35,7 @@ def fake_run(app, host=None, port=None, factory=None, reload=None, workers=None) called["port"] = port called["app"] = app - monkeypatch.setattr("indigoapi.__main__.uvicorn.run", fake_run) + monkeypatch.setattr("heliotrapi.__main__.uvicorn.run", fake_run) class FakeConfig: class server: # noqa diff --git a/tests/test_client.py b/tests/test_client.py index 1891786..4232009 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -5,9 +5,9 @@ import numpy as np import pytest -from indigoapi.client import AnalysisClient -from indigoapi.models import AnalysisResult -from indigoapi.utils.serialisers import serialise +from heliotrapi.client import AnalysisClient +from heliotrapi.models import AnalysisResult +from heliotrapi.utils.serialisers import serialise def test_serialise(): @@ -102,8 +102,8 @@ def test_client_get_request_id_result_timeout(monkeypatch): def fake_time(): return times.pop(0) - monkeypatch.setattr("indigoapi.client.time.time", fake_time) - monkeypatch.setattr("indigoapi.client.time.sleep", lambda _: None) + monkeypatch.setattr("heliotrapi.client.time.time", fake_time) + monkeypatch.setattr("heliotrapi.client.time.sleep", lambda _: None) with pytest.raises(TimeoutError): client.get_request_id_result(uuid.uuid4(), timeout=0.05, poll_interval=0.01) @@ -316,7 +316,7 @@ def test_client_get_result_retries_after_failure(monkeypatch): session.get.side_effect = [failure_response, success_response] client = AnalysisClient(session=session) - monkeypatch.setattr("indigoapi.client.time.sleep", lambda _: None) + monkeypatch.setattr("heliotrapi.client.time.sleep", lambda _: None) result = client.get_result(timeout=1.0, poll_interval=0.01) diff --git a/tests/test_gaussian_fit.py b/tests/test_gaussian_fit.py index 37ab2ca..e0b0629 100644 --- a/tests/test_gaussian_fit.py +++ b/tests/test_gaussian_fit.py @@ -1,9 +1,9 @@ import numpy as np from fastapi.testclient import TestClient -from indigoapi.analyses.peak_fitting import gaussian, gaussian_fit -from indigoapi.client import AnalysisClient -from indigoapi.server import start_api +from heliotrapi.analyses.peak_fitting import gaussian, gaussian_fit +from heliotrapi.client import AnalysisClient +from heliotrapi.server import start_api def test_gaussian_fit_with_client(): diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 2ee254a..9c9e6f0 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -1,8 +1,8 @@ import numpy as np import pytest -from indigoapi.analyses.peak_fitting import gaussian -from indigoapi.analysis_core.registry import ( +from heliotrapi.analyses.peak_fitting import gaussian +from heliotrapi.analysis_core.registry import ( AnalysisNotFoundError, get_analysis, list_analyses, diff --git a/tests/test_queue_manager.py b/tests/test_queue_manager.py index 367fbf1..840b063 100644 --- a/tests/test_queue_manager.py +++ b/tests/test_queue_manager.py @@ -4,9 +4,9 @@ import pytest from xrpd_toolbox.utils.messenger import Messenger -from indigoapi.models import AnalysisRequest -from indigoapi.task_queue import QueueManager -from indigoapi.task_queue.manager import validate_inputs +from heliotrapi.models import AnalysisRequest +from heliotrapi.task_queue import QueueManager +from heliotrapi.task_queue.manager import validate_inputs @pytest.mark.asyncio @@ -17,7 +17,7 @@ async def fake_analysis(number): return number * 2 monkeypatch.setattr( - "indigoapi.analysis_core.registry.get_analysis", lambda name: fake_analysis + "heliotrapi.analysis_core.registry.get_analysis", lambda name: fake_analysis ) job = AnalysisRequest(analysis_name="double", inputs={"number": 2}) @@ -54,7 +54,7 @@ async def fake_analysis(number): return number * 2 monkeypatch.setattr( - "indigoapi.analysis_core.registry.get_analysis", lambda name: fake_analysis + "heliotrapi.analysis_core.registry.get_analysis", lambda name: fake_analysis ) job = AnalysisRequest(analysis_name="double", inputs={"number": 2}) @@ -107,7 +107,7 @@ async def failing_analysis(): raise KeyError("missing") monkeypatch.setattr( - "indigoapi.analysis_core.registry.get_analysis", + "heliotrapi.analysis_core.registry.get_analysis", lambda name: failing_analysis, ) @@ -144,7 +144,7 @@ def send_message(self, destination, message): ) monkeypatch.setattr( - "indigoapi.analysis_core.registry.get_analysis", + "heliotrapi.analysis_core.registry.get_analysis", lambda name: (_ for _ in ()).throw(KeyError("missing")), ) diff --git a/tests/test_rabbitmq_listener.py b/tests/test_rabbitmq_listener.py index 6c29013..e06acf1 100644 --- a/tests/test_rabbitmq_listener.py +++ b/tests/test_rabbitmq_listener.py @@ -6,9 +6,9 @@ import pytest -from indigoapi.models import AnalysisRequest -from indigoapi.task_queue import QueueManager -from indigoapi.task_queue.rabbitmq import _StompListener +from heliotrapi.models import AnalysisRequest +from heliotrapi.task_queue import QueueManager +from heliotrapi.task_queue.rabbitmq import _StompListener @pytest.mark.filterwarnings("ignore::ResourceWarning") @@ -28,7 +28,7 @@ def fake_run_coro_threadsafe(coro, event_loop): return None monkeypatch.setattr( - "indigoapi.task_queue.rabbitmq.asyncio.run_coroutine_threadsafe", + "heliotrapi.task_queue.rabbitmq.asyncio.run_coroutine_threadsafe", fake_run_coro_threadsafe, ) @@ -54,7 +54,7 @@ def test_stomp_listener_invalid_json(monkeypatch): listener = _StompListener(queue_manager, loop) # type: ignore monkeypatch.setattr( - "indigoapi.task_queue.rabbitmq.asyncio.run_coroutine_threadsafe", + "heliotrapi.task_queue.rabbitmq.asyncio.run_coroutine_threadsafe", lambda coro, event_loop: None, ) frame = SimpleNamespace(body="not-a-json") @@ -141,7 +141,7 @@ class BadFrame: def fake_error(msg): recorded.append(msg) - monkeypatch.setattr("indigoapi.task_queue.rabbitmq.logger.error", fake_error) + monkeypatch.setattr("heliotrapi.task_queue.rabbitmq.logger.error", fake_error) listener.on_message(BadFrame()) assert recorded diff --git a/tests/test_serialisers.py b/tests/test_serialisers.py index 8db5e77..900582f 100644 --- a/tests/test_serialisers.py +++ b/tests/test_serialisers.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from indigoapi.utils.serialisers import deserialise, serialise +from heliotrapi.utils.serialisers import deserialise, serialise @pytest.mark.parametrize( From 0bc5b0ed2c26dd518b36a3c9185de9d0b08dea2f Mon Sep 17 00:00:00 2001 From: RJCD-Diamond Date: Fri, 22 May 2026 13:56:35 +0000 Subject: [PATCH 4/6] force commit --- FRONTEND.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FRONTEND.md b/FRONTEND.md index fa0a0ad..de8ebfd 100644 --- a/FRONTEND.md +++ b/FRONTEND.md @@ -11,7 +11,7 @@ The API includes a web frontend hosted at the root path (`/`). - **Type-Aware Inputs**: Automatically converts form inputs to appropriate types (int, float, bool, list) - **Beautiful UI**: Modern gradient design with smooth animations and transitions -## Accessing the Frontend +## Accessing the Frontend Once the API server is running: From bb188074ce93360eebff35da56f2a88b094a550c Mon Sep 17 00:00:00 2001 From: RJCD-Diamond Date: Fri, 22 May 2026 17:31:52 +0000 Subject: [PATCH 5/6] change name in tests --- .github/CONTRIBUTING.md | 4 ++-- helm/heliotrapi/templates/configmap.yaml | 2 +- helm/heliotrapi/templates/deployment.yaml | 12 ++++++------ helm/heliotrapi/templates/ingress.yaml | 6 +++--- src/heliotrapi/analysis_core/__init__.py | 4 ++-- src/heliotrapi/analysis_core/decorator.py | 4 ++-- src/heliotrapi/analysis_core/loader.py | 9 +++++---- src/heliotrapi/api/routes.py | 7 ++++--- src/heliotrapi/task_queue/manager.py | 7 ++++--- src/heliotrapi/task_queue/rabbitmq.py | 5 +++-- tests/conftest.py | 4 ++-- tests/test_api.py | 6 +++--- tests/test_config.py | 2 +- tests/test_loader.py | 10 +++++----- tests/test_loader_extra.py | 12 ++++++------ tests/test_main.py | 4 ++-- tests/test_models.py | 2 +- tests/test_peak_fitting.py | 4 ++-- tests/test_registry.py | 4 ++-- tests/test_workflows.py | 2 +- 20 files changed, 57 insertions(+), 53 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index cde70cd..2e10504 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,14 +1,14 @@ # Contribute to the project Contributions and issues are most welcome! All issues and pull requests are -handled through [GitHub](https://github.com/DiamondLightSource/indigoapi/issues). Also, please check for any existing issues before +handled through [GitHub](https://github.com/DiamondLightSource/heliotrapi/issues). Also, please check for any existing issues before filing a new one. If you have a great idea but it involves big changes, please file a ticket before making a pull request! We want to make sure you don't spend your time coding something that might not fit the scope of the project. ## Issue or Discussion? -Github also offers [discussions](https://github.com/DiamondLightSource/indigoapi/discussions) as a place to ask questions and share ideas. If +Github also offers [discussions](https://github.com/DiamondLightSource/heliotrapi/discussions) as a place to ask questions and share ideas. If your issue is open ended and it is not obvious when it can be "closed", please raise it as a discussion instead. diff --git a/helm/heliotrapi/templates/configmap.yaml b/helm/heliotrapi/templates/configmap.yaml index 5dc6cd3..771793a 100644 --- a/helm/heliotrapi/templates/configmap.yaml +++ b/helm/heliotrapi/templates/configmap.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "indigoapi.fullname" . }}-config + name: {{ include "heliotrapi.fullname" . }}-config data: config.yaml: |- {{- toYaml .Values.config | nindent 4 }} diff --git a/helm/heliotrapi/templates/deployment.yaml b/helm/heliotrapi/templates/deployment.yaml index d885a7d..c16bf1c 100644 --- a/helm/heliotrapi/templates/deployment.yaml +++ b/helm/heliotrapi/templates/deployment.yaml @@ -1,14 +1,14 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "indigoapi.fullname" . }} + name: {{ include "heliotrapi.fullname" . }} labels: - {{- include "indigoapi.labels" . | nindent 4 }} + {{- include "heliotrapi.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicaCount }} selector: matchLabels: - {{- include "indigoapi.selectorLabels" . | nindent 6 }} + {{- include "heliotrapi.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} @@ -16,7 +16,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "indigoapi.labels" . | nindent 8 }} + {{- include "heliotrapi.labels" . | nindent 8 }} {{- with .Values.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} @@ -71,7 +71,7 @@ spec: projected: sources: - configMap: - name: {{ include "indigoapi.fullname" . }}-config + name: {{ include "heliotrapi.fullname" . }}-config {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -84,7 +84,7 @@ spec: - key: app.kubernetes.io/name operator: In values: - - indigoapi + - heliotrapi - key: app.kubernetes.io/instance operator: In values: diff --git a/helm/heliotrapi/templates/ingress.yaml b/helm/heliotrapi/templates/ingress.yaml index dc938ad..19ef909 100644 --- a/helm/heliotrapi/templates/ingress.yaml +++ b/helm/heliotrapi/templates/ingress.yaml @@ -2,9 +2,9 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: {{ include "indigoapi.fullname" . }} + name: {{ include "heliotrapi.fullname" . }} labels: - {{- include "indigoapi.labels" . | nindent 4 }} + {{- include "heliotrapi.labels" . | nindent 4 }} {{- with .Values.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} @@ -35,7 +35,7 @@ spec: {{- end }} backend: service: - name: {{ include "indigoapi.fullname" $ }} + name: {{ include "heliotrapi.fullname" $ }} port: number: {{ $.Values.service.port }} {{- end }} diff --git a/src/heliotrapi/analysis_core/__init__.py b/src/heliotrapi/analysis_core/__init__.py index b7d05e8..d19b3e6 100644 --- a/src/heliotrapi/analysis_core/__init__.py +++ b/src/heliotrapi/analysis_core/__init__.py @@ -1,6 +1,6 @@ import importlib -from indigoapi.config import Config +from heliotrapi.config import Config from .decorator import analysis from .loader import get_async_function, load_analyses, load_plugins @@ -19,7 +19,7 @@ def initialize_analyses(register_all: bool = False): """Load built-in analyses and user plugins. Call during server startup.""" global MODULE_NAMES - package = importlib.import_module("indigoapi.analyses") + package = importlib.import_module("heliotrapi.analyses") MODULE_NAMES = load_analyses(package) config = Config.load_config() diff --git a/src/heliotrapi/analysis_core/decorator.py b/src/heliotrapi/analysis_core/decorator.py index 078fc69..ce4e8f2 100644 --- a/src/heliotrapi/analysis_core/decorator.py +++ b/src/heliotrapi/analysis_core/decorator.py @@ -1,8 +1,8 @@ from collections.abc import Awaitable, Callable from typing import ParamSpec, TypeVar -from indigoapi.analysis_core.loader import get_async_function -from indigoapi.analysis_core.registry import register_analysis +from heliotrapi.analysis_core.loader import get_async_function +from heliotrapi.analysis_core.registry import register_analysis P = ParamSpec("P") R = TypeVar("R") diff --git a/src/heliotrapi/analysis_core/loader.py b/src/heliotrapi/analysis_core/loader.py index 394cdf0..fecbc37 100644 --- a/src/heliotrapi/analysis_core/loader.py +++ b/src/heliotrapi/analysis_core/loader.py @@ -9,8 +9,9 @@ from typing import ParamSpec, TypeVar from git import Repo -from indigoapi.analysis_core.registry import register_analysis -from indigoapi.config import Config + +from heliotrapi.analysis_core.registry import register_analysis +from heliotrapi.config import Config logger = logging.getLogger(__name__) @@ -97,7 +98,7 @@ def load_plugins(config: Config, register_all: bool = False): """ Load all user plugins from configured paths and GitHub repos. - Built-in analyses (in indigoapi.analyses) are already loaded via decorators. + Built-in analyses (in heliotrapi.analyses) are already loaded via decorators. This function loads external plugins. Args: @@ -126,7 +127,7 @@ def load_plugins(config: Config, register_all: bool = False): # if __name__ == "__main__": -# from indigoapi.analysis_core.registry import list_analyses +# from heliotrapi.analysis_core.registry import list_analyses # load_plugins(Config.load_config()) diff --git a/src/heliotrapi/api/routes.py b/src/heliotrapi/api/routes.py index 9aa2dba..1b407d0 100644 --- a/src/heliotrapi/api/routes.py +++ b/src/heliotrapi/api/routes.py @@ -4,9 +4,10 @@ from fastapi import APIRouter, HTTPException, Request from fastapi.routing import APIRoute -from indigoapi.analysis_core.registry import get_analysis, list_analyses -from indigoapi.models import AnalysisRequest, AnalysisResponse, AnalysisResult -from indigoapi.task_queue import QueueManager + +from heliotrapi.analysis_core.registry import get_analysis, list_analyses +from heliotrapi.models import AnalysisRequest, AnalysisResponse, AnalysisResult +from heliotrapi.task_queue import QueueManager ROUTER = APIRouter() diff --git a/src/heliotrapi/task_queue/manager.py b/src/heliotrapi/task_queue/manager.py index 131d1a5..1fd65c5 100644 --- a/src/heliotrapi/task_queue/manager.py +++ b/src/heliotrapi/task_queue/manager.py @@ -4,11 +4,12 @@ from datetime import datetime from uuid import UUID -from indigoapi.analysis_core.registry import get_analysis -from indigoapi.models import AnalysisRequest, AnalysisResponse, AnalysisResult -from indigoapi.utils.serialisers import deserialise, serialise from xrpd_toolbox.utils.messenger import DEFAULT_DII_PROCESSED_DESTINATION, Messenger +from heliotrapi.analysis_core.registry import get_analysis +from heliotrapi.models import AnalysisRequest, AnalysisResponse, AnalysisResult +from heliotrapi.utils.serialisers import deserialise, serialise + logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) diff --git a/src/heliotrapi/task_queue/rabbitmq.py b/src/heliotrapi/task_queue/rabbitmq.py index e80c18d..d868a98 100644 --- a/src/heliotrapi/task_queue/rabbitmq.py +++ b/src/heliotrapi/task_queue/rabbitmq.py @@ -6,10 +6,11 @@ from typing import Any import stomp -from indigoapi.models import AnalysisRequest -from indigoapi.task_queue import QueueManager from pydantic import BaseModel, Field +from heliotrapi.models import AnalysisRequest +from heliotrapi.task_queue import QueueManager + logger = logging.getLogger(__name__) TIMEOUT = 10 diff --git a/tests/conftest.py b/tests/conftest.py index 61caa6f..c840b2c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,8 +1,8 @@ import importlib -from indigoapi.analysis_core.loader import load_analyses +from heliotrapi.analysis_core.loader import load_analyses def pytest_configure(): - package = importlib.import_module("indigoapi.analyses") + package = importlib.import_module("heliotrapi.analyses") load_analyses(package) diff --git a/tests/test_api.py b/tests/test_api.py index 661ed79..0e43342 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -3,9 +3,9 @@ import pytest from fastapi.testclient import TestClient -from indigoapi.config import Config -from indigoapi.models import AnalysisRequest -from indigoapi.server import start_api +from heliotrapi.config import Config +from heliotrapi.models import AnalysisRequest +from heliotrapi.server import start_api def test_analysis_flow_with_post(): diff --git a/tests/test_config.py b/tests/test_config.py index f50f794..f363032 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,4 +1,4 @@ -from indigoapi.config import Config, RabbitMQConfig +from heliotrapi.config import Config, RabbitMQConfig def test_config_loads_path_from_env(tmp_path, monkeypatch): diff --git a/tests/test_loader.py b/tests/test_loader.py index c2fdfb3..3de7cc3 100644 --- a/tests/test_loader.py +++ b/tests/test_loader.py @@ -1,12 +1,12 @@ import sys -from indigoapi.analysis_core.loader import ( +from heliotrapi.analysis_core.loader import ( clone_github_repo, load_plugins, load_plugins_from_dir, ) -from indigoapi.analysis_core.registry import ANALYSIS_REGISTRY, list_analyses -from indigoapi.config import Config +from heliotrapi.analysis_core.registry import ANALYSIS_REGISTRY, list_analyses +from heliotrapi.config import Config def test_loader_load_plugins_from_dir(tmp_path): @@ -28,7 +28,7 @@ def test_loader_load_plugins_from_dir(tmp_path): def test_loader_load_plugins_registers_decorated_functions(tmp_path): plugin_path = tmp_path / "custom_plugin.py" plugin_path.write_text( - "from indigoapi.analysis_core.decorator import analysis\n" + "from heliotrapi.analysis_core.decorator import analysis\n" "@analysis()\n" "def hello(name: str) -> str:\n" " return f'hello {name}'\n" @@ -71,5 +71,5 @@ def test_loader_load_plugins_handles_clone_error(monkeypatch): def fake_clone(repo_url, dest_dir): raise RuntimeError("unable to clone") - monkeypatch.setattr("indigoapi.analysis_core.loader.clone_github_repo", fake_clone) + monkeypatch.setattr("heliotrapi.analysis_core.loader.clone_github_repo", fake_clone) load_plugins(cfg) diff --git a/tests/test_loader_extra.py b/tests/test_loader_extra.py index 0069275..f72890a 100644 --- a/tests/test_loader_extra.py +++ b/tests/test_loader_extra.py @@ -1,13 +1,13 @@ from unittest.mock import Mock -from indigoapi.analysis_core.loader import ( +from heliotrapi.analysis_core.loader import ( clone_github_repo, get_async_function, load_plugins, load_plugins_from_dir, ) -from indigoapi.analysis_core.registry import list_analyses -from indigoapi.config import Config +from heliotrapi.analysis_core.registry import list_analyses +from heliotrapi.config import Config def test_get_async_function_returns_coroutine_function(): @@ -21,7 +21,7 @@ def test_clone_github_repo_force(monkeypatch, tmp_path): dest = tmp_path / "repo" clone_from_mock = Mock() monkeypatch.setattr( - "indigoapi.analysis_core.loader.Repo.clone_from", clone_from_mock + "heliotrapi.analysis_core.loader.Repo.clone_from", clone_from_mock ) result = clone_github_repo( "https://example.com/repo.git", str(tmp_path), force=True @@ -48,7 +48,7 @@ def track_spec(name, location): return real_spec(name, location) monkeypatch.setattr( - "indigoapi.analysis_core.loader.importlib.util.spec_from_file_location", + "heliotrapi.analysis_core.loader.importlib.util.spec_from_file_location", track_spec, ) @@ -70,7 +70,7 @@ def test_load_plugins_with_git_repo(monkeypatch, tmp_path): fake_file.write_text("def hello():\n return 'hello'\n") monkeypatch.setattr( - "indigoapi.analysis_core.loader.clone_github_repo", lambda url, dest: fake_path + "heliotrapi.analysis_core.loader.clone_github_repo", lambda url, dest: fake_path ) load_plugins(cfg, register_all=True) assert "hello" in list_analyses() or True diff --git a/tests/test_main.py b/tests/test_main.py index aeb5539..aab1781 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,6 +1,6 @@ from click.testing import CliRunner -from indigoapi.__main__ import main +from heliotrapi.__main__ import main def test_main_no_subcommand_prints_message(): @@ -29,7 +29,7 @@ def fake_uvicorn_run(app, factory, host, port, reload, workers): assert reload is True assert workers == 2 - monkeypatch.setattr("indigoapi.__main__.uvicorn.run", fake_uvicorn_run) + monkeypatch.setattr("heliotrapi.__main__.uvicorn.run", fake_uvicorn_run) runner = CliRunner() result = runner.invoke( diff --git a/tests/test_models.py b/tests/test_models.py index b9a4b95..d8c6764 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -2,7 +2,7 @@ import pytest -from indigoapi.models import AnalysisRequest, AnalysisResponse, AnalysisResult +from heliotrapi.models import AnalysisRequest, AnalysisResponse, AnalysisResult def test_analysis_request_item_access(): diff --git a/tests/test_peak_fitting.py b/tests/test_peak_fitting.py index fff530d..d83ad64 100644 --- a/tests/test_peak_fitting.py +++ b/tests/test_peak_fitting.py @@ -1,7 +1,7 @@ import numpy as np import pytest -from indigoapi.analyses.peak_fitting import gaussian, gaussian_fit +from heliotrapi.analyses.peak_fitting import gaussian, gaussian_fit def test_gaussian_function(): @@ -12,6 +12,6 @@ def test_gaussian_function(): @pytest.mark.asyncio async def test_gaussian_fit_invalid_data_returns_error(): - result = await gaussian_fit([1], [1]) + result = await gaussian_fit([1], [1]) # noqs assert isinstance(result, dict) assert "error" in result diff --git a/tests/test_registry.py b/tests/test_registry.py index ba62cee..7a0dc1e 100644 --- a/tests/test_registry.py +++ b/tests/test_registry.py @@ -3,8 +3,8 @@ import pytest -from indigoapi.analysis_core.decorator import analysis -from indigoapi.analysis_core.registry import ( +from heliotrapi.analysis_core.decorator import analysis +from heliotrapi.analysis_core.registry import ( ANALYSIS_REGISTRY, get_analysis, register_analysis, diff --git a/tests/test_workflows.py b/tests/test_workflows.py index 9ab5cda..d513a22 100644 --- a/tests/test_workflows.py +++ b/tests/test_workflows.py @@ -1,6 +1,6 @@ import pytest -from indigoapi.analyses.workflows import Workflows +from heliotrapi.analyses.workflows import Workflows def test_workflows_not_implemented(): From fee33f72264cda06059beee4cbce7e4ca01995b7 Mon Sep 17 00:00:00 2001 From: RJCD-Diamond Date: Fri, 22 May 2026 17:43:20 +0000 Subject: [PATCH 6/6] order test server imports --- tests/test_server.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_server.py b/tests/test_server.py index f122687..6bb7e83 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -1,6 +1,7 @@ from pathlib import Path from fastapi.testclient import TestClient + from heliotrapi.server import start_api