juniper-recurrence
Project: Juniper — Cascade Correlation Neural Network Research Platform Application: juniper-recurrence (FastAPI + CLI service) Author: Paul Calnon License: MIT License Version: 0.2.0
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
pip install "juniper-recurrence[torch]" # adds the torch MLP readout (DP-3 Rung 2b)
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/crossval |
POST | Walk-forward cross-validation over the dataset's _full split (synchronous); returns aggregated per-fold metrics. |
/v1/crossval/status |
GET | Most recent cross-validation result (aggregate + per-fold). |
/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. |
/v1/metrics |
GET | Prometheus metrics — IP-allowlist gated; needs the [observability] extra. |
/docs |
GET | OpenAPI / Swagger UI (exempt). |
Both POST /v1/train and POST /v1/crossval run inline (closed-form solves) and return
their result in the response — no background jobs or WebSocket streams in v1. A second
cross-validation run while one is in progress returns 409.
POST /v1/train and POST /v1/crossval accept a readout selector (DP-3): "linear"
(default, closed-form least squares), "rff" (nonlinear random-Fourier-features readout, with
rff_features / rff_gamma), or "mlp" (a torch MLP with the mlp_* knobs — needs the [torch]
extra; returns 503 if torch is not installed). ridge accepts a float or "gcv" (closed-form
generalized-cross-validation selection). See the juniper-recurrence-model README for the spectrum.
# 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.
# Cut a GitHub Release on a juniper-recurrence-v* tag (the ecosystem convention — not a
# bare `git push <tag>`); the Release drives publish-recurrence-app.yml (TestPyPI → PyPI).
gh release create juniper-recurrence-v0.2.0 --generate-notes
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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file juniper_recurrence-0.3.0.tar.gz.
File metadata
- Download URL: juniper_recurrence-0.3.0.tar.gz
- Upload date:
- Size: 50.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6db83f966e46ff137b7e1ccc415b874ed1da7b97079652afa0b0a8efdd06fff
|
|
| MD5 |
9f814c990e43fee23c0c8ae6089b68e2
|
|
| BLAKE2b-256 |
7beef5e8ac9bf0dfc4186c8dbd4d9493cc16cd3e52522fe432417e790d3a72be
|
Provenance
The following attestation bundles were made for juniper_recurrence-0.3.0.tar.gz:
Publisher:
publish-recurrence-app.yml on pcalnon/juniper-recurrence
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
juniper_recurrence-0.3.0.tar.gz -
Subject digest:
f6db83f966e46ff137b7e1ccc415b874ed1da7b97079652afa0b0a8efdd06fff - Sigstore transparency entry: 2281132525
- Sigstore integration time:
-
Permalink:
pcalnon/juniper-recurrence@df895d125a97d9e08cc321924bb74382337b27c2 -
Branch / Tag:
refs/tags/juniper-recurrence-v0.3.0 - Owner: https://github.com/pcalnon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-recurrence-app.yml@df895d125a97d9e08cc321924bb74382337b27c2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file juniper_recurrence-0.3.0-py3-none-any.whl.
File metadata
- Download URL: juniper_recurrence-0.3.0-py3-none-any.whl
- Upload date:
- Size: 37.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6d2c57336b36fade82f8da3857ef01c7c63c7217cccc61e72a6360dfc172591
|
|
| MD5 |
533ec14893e0f49d11e962a0b4a751f5
|
|
| BLAKE2b-256 |
0ef904f746e74e3ccdc0e378e05c227dbf4c5c0e5ae2d4603537c942ba880e75
|
Provenance
The following attestation bundles were made for juniper_recurrence-0.3.0-py3-none-any.whl:
Publisher:
publish-recurrence-app.yml on pcalnon/juniper-recurrence
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
juniper_recurrence-0.3.0-py3-none-any.whl -
Subject digest:
e6d2c57336b36fade82f8da3857ef01c7c63c7217cccc61e72a6360dfc172591 - Sigstore transparency entry: 2281132543
- Sigstore integration time:
-
Permalink:
pcalnon/juniper-recurrence@df895d125a97d9e08cc321924bb74382337b27c2 -
Branch / Tag:
refs/tags/juniper-recurrence-v0.3.0 - Owner: https://github.com/pcalnon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-recurrence-app.yml@df895d125a97d9e08cc321924bb74382337b27c2 -
Trigger Event:
release
-
Statement type: