Skip to main content

FastAPI + CLI service wrapping the Δt-native LMU recurrence model on the juniper-service-core framework

Project description

juniper-recurrence

Project: Juniper — Cascade Correlation Neural Network Research Platform Application: juniper-recurrence (FastAPI + CLI service) Author: Paul Calnon License: MIT License Version: 0.1.1

FastAPI + CLI service that wraps the Δt-native Legendre Memory Unit regressor (juniper-recurrence-model) on the shared juniper-service-core framework. It loads 3-D windowed sequences (equities_seq, the WS-1 irregular-Δt contract) through juniper-data-client and trains / serves the LMU over HTTP.

This is the application layer (WS-4b): the first real consumer of service-core's create_app + TrainingLifecycle. The model, the data foundation, and the service framework ship separately; this package is the glue + the HTTP/CLI surface.

Install

pip install juniper-recurrence

All upstreams resolve from PyPI: juniper-service-core, juniper-model-core, juniper-recurrence-model, juniper-data-client, plus fastapi / uvicorn.

Run

# Serve the API (single worker, in-process state). Binds 0.0.0.0:8210 by default;
# set JUNIPER_RECURRENCE_HOST=127.0.0.1 for local-only.
juniper-recurrence serve
juniper-recurrence serve --host 127.0.0.1 --port 8210

Once running, the API exposes (every /v1/* route below requires X-API-Key when API keys are configured; health + docs are always exempt):

Route Method Behavior
/v1/health, /v1/health/ready GET Liveness / readiness (exempt).
/v1/train POST Train the LMU on a dataset (synchronous); returns the TrainResult.
/v1/training/status GET idle / trained + last metrics + training events.
/v1/predict POST Continuous predictions for inline X (+ dt) or a dataset ref.
/v1/model GET Current model topology + regression metrics.
/v1/dataset GET Descriptor of the trained-on dataset.
/docs GET OpenAPI / Swagger UI (exempt).

Training runs inline (a one-shot closed-form solve), so POST /v1/train returns the result in the response — no background jobs or WebSocket streams in v1.

# Train on a juniper-data dataset, then inspect the model.
curl -sX POST localhost:8210/v1/train \
  -H 'Content-Type: application/json' \
  -d '{"dataset": {"dataset_id": "<id>"}, "d": 16}'
curl -s localhost:8210/v1/model

Train (headless CLI)

# Fit the LMU on a dataset and persist it — no server.
juniper-recurrence train --dataset <id> --d 16 --out model.npz
juniper-recurrence train --name equities_seq_v1 --split train

Configuration

All settings read the JUNIPER_RECURRENCE_ environment namespace (e.g. JUNIPER_RECURRENCE_PORT). Secrets honor the Docker _FILE indirection (JUNIPER_RECURRENCE_API_KEYS_FILE, JUNIPER_DATA_API_KEY_FILE). When no API keys are configured, authentication is disabled (open access — development default).

Variable Default Purpose
JUNIPER_RECURRENCE_HOST 0.0.0.0 Bind host (container default; 127.0.0.1 locally).
JUNIPER_RECURRENCE_PORT 8210 Bind port (deploy maps host 8211 → container 8210).
JUNIPER_RECURRENCE_API_KEYS (unset) CSV or JSON-array of valid X-API-Key values.
JUNIPER_DATA_URL http://localhost:8100 Upstream juniper-data base URL.
JUNIPER_DATA_API_KEY (unset) Outbound X-API-Key to juniper-data.

Development

pip install -e ".[test]"
pytest tests/ -v

Publishing

Releases are published to PyPI via GitHub Actions (.github/workflows/publish-recurrence-app.yml) on a juniper-recurrence-v* tag — TestPyPI first (with a --no-deps install verification), then PyPI, via OIDC trusted publishing (no API tokens). The model package (juniper-recurrence-model) publishes separately on juniper-recurrence-model-v* tags.

git tag juniper-recurrence-v0.1.0
git push origin juniper-recurrence-v0.1.0

Ecosystem

Part of the Juniper ML research platform. See the WS-4b build plan (notes/JUNIPER_RECURRENCE_WS4B_APP_BUILD_PLAN_2026-06-15.md in juniper-ml) for the design of record.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

juniper_recurrence-0.2.0.tar.gz (40.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

juniper_recurrence-0.2.0-py3-none-any.whl (31.6 kB view details)

Uploaded Python 3

File details

Details for the file juniper_recurrence-0.2.0.tar.gz.

File metadata

  • Download URL: juniper_recurrence-0.2.0.tar.gz
  • Upload date:
  • Size: 40.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for juniper_recurrence-0.2.0.tar.gz
Algorithm Hash digest
SHA256 24b574650baaea2a8483582a2eddf002f4a2d73134125d4fed5e4503d9aa7143
MD5 0c5ccbfd8594c4ff1c7faf2efc1a1097
BLAKE2b-256 fae59c4672185137ad83905a6d3634ac4bafec8f1cf06bf8efbac5f90895fb23

See more details on using hashes here.

Provenance

The following attestation bundles were made for juniper_recurrence-0.2.0.tar.gz:

Publisher: publish-recurrence-app.yml on pcalnon/juniper-recurrence

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file juniper_recurrence-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for juniper_recurrence-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71ffcaa7e09d76e08fafd7b6dd4c1c4a30f94aecc9d1023e8d3af3116a260267
MD5 7421b00c0f026fbb91a89ec7ffce28f4
BLAKE2b-256 f2f2dc5ffeed68206989867da9bebd6da96f456e9a4f56be92f09c06d26ab383

See more details on using hashes here.

Provenance

The following attestation bundles were made for juniper_recurrence-0.2.0-py3-none-any.whl:

Publisher: publish-recurrence-app.yml on pcalnon/juniper-recurrence

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page