Skip to main content

reliafy-client — Reliafy from Python and the command line

Fit a model anywhere with SurPyval, then make it a shareable, trackable, citable artifact in Reliafy. Call any Reliafy tool from a script or a shell, send files and photos, and push data from your CMMS.

pip install reliafy-client

The package installs as reliafy-client; you import it as reliafy. It also installs the reliafy command, and the same command as reliafy-client: if some other program called reliafy is already on your path, use reliafy-client.

Pure standard library: no dependencies. You bring SurPyval to do your own fits.

Which server

The client calls Reliafy's tools API (POST /api/v1/{tool}/{action}), which reliafy.com serves; a self-hosted server needs a build that includes it (GET /api/v1/tools answers). Against an older server, the tool calls stop with a clear message (reliafy.ServerTooOld), and everything from 0.2 (reliafy.push, reliafy.models.*, reliafy.data.*, reliafy.strategy.*, reliafy.fleet.*) keeps working.

Quick start

import surpyval as sp
import reliafy

# Fit however you like: censored data, offsets, whatever.
model = sp.Weibull.fit(x=failures, c=censoring_flags)

reliafy.configure(token="rlf_...")            # from Reliafy → API access (Pro)
url = reliafy.push(model, name="Pump bearings — 2026 refit", unit="hours")
print(url)                                    # open it in Reliafy

push() uploads the model and its fitted data by default, so Reliafy shows the full probability plot with confidence bounds, and the model stays editable and refittable in the app, and can be cited as RCM evidence, used in RBD blocks, or tracked against a fleet. Offset, limited-failure-population and zero-inflated fits are detected from the model and reproduced.

# Parameters only (no data upload): functions and life metrics, no plot.
reliafy.push(model, name="From a report", data=False)

# No SurPyval object, just numbers:
reliafy.push_params("weibull", [1200.0, 2.3], name="Handbook value", unit="hours")

Every tool: Client.call

Everything Reliafy's AI tools can do, with the same arguments and results:

from reliafy import Client

rf = Client()                                   # token from RELIAFY_TOKEN or `reliafy login`
rf.call("list", "models")
rf.call("analyse", "fit", data=[120, 340, 510, 700], censored=[0, 0, 1, 0])
rf.call("analyse", "optimal_replacement", distribution_id="weibull",
        params=[{"name": "alpha", "value": 1200}, {"name": "beta", "value": 2.5}],
        planned_cost=200, unplanned_cost=1500)
rf.call("change", "optimal_replacement_save", name="Pump bearings", model_id="…",
        planned_cost=200, unplanned_cost=1500)          # kept under Strategy, worked out again on the server
rf.call("change", "model_fit_degradation", name="Liner wear", dataset_id="…", unit_id_column="pump",
        age_column="hours", value_column="thickness_mm", threshold=10)   # readings to a failure level (Pro)
rf.call("analyse", "maintainability", unit="minutes", lines=[   # Mct, M_max, availability from a parts list
    {"name": "Motor", "quantity": 4, "failure_rate": 180, "elements": {"isolation": 10, "replace": 15}, "maximum": 60},
    {"name": "Flight controller", "failure_rate": 90, "mttr": 80}])
rf.call("guide", topic="life_data")             # a tool without actions
rf.call("analyse", "rbd", rbd_id="…", wait=True)          # waits for a long job

rf.tools()                                      # what you may call
rf.spec()                                       # the OpenAPI spec

Published failure data from Reliafy's reliability data library, each record cited with its licence:

found = rf.call("list", "library", query="motor-driven pump fails to start")
record = rf.call("get", "library_record", id=found["results"][0]["id"])
record["block_model"]                           # the model an RBD block would use

Shortcuts for the common things: rf.list(kind), rf.get(kind, id), rf.fit(data, distribution=…, censored=…, save_as=…), rf.reliability(model_id, times), rf.guide(topic).

reliafy.call(tool, action, **args) does the same with the configured token. A refused call raises reliafy.ReliafyError with status (the HTTP status) and detail (what Reliafy said, in plain words).

Files, photos and data

rf.upload_dataset("bearings.xlsx", name="Bearings")      # CSV or .xlsx
rf.add_measurements(dataset_id, "vibration.csv")         # readings on its units: unit id, age, value
rf.import_rbd("plant.xml")                               # BlockSim, Open-PSA, Galileo, RePyability
rf.import_rcm("fmea.csv", position_id="…", dry_run=True)  # an RCM worksheet or task plan (CSV or .xlsx)
rf.add_photo("nameplate.jpg", target_id="…")             # Reliafy Maintenance
rf.add_document("manual.pdf", target_id="…", kind="manual")  # a PDF, at most 20 MB
rf.download_document(document_id, "manual.pdf")

reliafy.push_usage(fleet_id, [{"name": "Truck 01", "current_use": 5230}])
reliafy.push_readings([{"tag": "PT-101", "value": 4.2}])
reliafy.push_lives(dataset_id, file="new_failures.csv")

Files are streamed from disk, not read into memory.

Many maintenance changes in one call

Reliafy Maintenance's tools can run as a batch: a list of their actions, in order, with @refs between them, checked on a copy of the workspace before anything is written. Build a position with its RCM, tasks and parts in one call:

done = rf.apply([
    {"ref": "p", "do": "positions.create", "args": {"name": "Feed pump A", "parent_id": "…"}},
    {"ref": "f", "do": "failure_modes.add_function", "args": {"position_id": "@p", "text": "Deliver 40 L/s"}},
    {"ref": "ff", "do": "failure_modes.add_functional_failure", "args": {"function_id": "@f", "text": "No flow"}},
    {"ref": "m", "do": "failure_modes.add", "args": {"position_id": "@p", "functional_failure_id": "@ff",
                                                     "text": "Bearing worn"}},
    {"do": "failure_modes.decide", "args": {"failure_mode_id": "@m", "consequence": "operational",
             "decision": {"outcome": "on_condition", "task": "Vibration check", "interval": 3,
                          "interval_unit": "months"}}},
    {"do": "tasks.create", "args": {"position_id": "@p", "name": "Grease bearings", "interval": 500,
                                    "unit": "hours", "source": "oem"}},
], dry_run=False)
done["applied"], done["undo"]      # 6, and the operations that reverse it

A delete in a batch (retire, remove_*, void, cancel, merge, disconnect) names what it deletes with confirm; a batch that deletes, or has over 25 operations, is a dry run unless dry_run=False. From the command line, reliafy apply ops.json dry-runs a file of operations and reliafy apply ops.json --run writes them, leaving ops.undo.json beside it.

The command line

reliafy login                                    # saves your token (only you can read the file)
reliafy tools                                    # every tool and action you may call
reliafy <tool> <action> --arg value …            # any of them; --help on each
reliafy models list
reliafy fit failures.csv --dist weibull --censor-column status --c-invert
reliafy fit failures.csv --dist best --criterion bic   # Best fit ranked by aic (default), aic_c, bic or neg_ll
reliafy push model.json                          # {distribution, params | data, name?, unit?}
reliafy upload bearings.xlsx --name Bearings
reliafy import rbd plant.xml
reliafy import rcm fmea.csv --position POSITION_ID --dry-run   # an RCM worksheet or task plan, previewed
reliafy analyse fault_tree --fault-tree-id TREE_ID  # a saved fault tree's top event, cut sets and importance
reliafy photo add IMG_*.jpg --to POSITION_ID --caption Nameplate
reliafy photo link PHOTO_ID --to LOCATION_ID      # show it there too
reliafy photo move PHOTO_ID --to POSITION_ID      # only there
reliafy document add manual.pdf --to ITEM_ID --kind manual
reliafy document get DOCUMENT_ID -o manual.pdf
reliafy ingest usage meters.csv --fleet FLEET_ID
reliafy ingest readings readings.csv
reliafy ingest snapshot burst.json               # a signal channel's snapshot (JSON; docs/signal-snapshots.md)
reliafy maintenance progression.time_to_limit --point-id BAND_POINT_ID   # when a watched band reaches its limit (a range, not a date)
reliafy maintenance progression.series --point-id BAND_POINT_ID          # the band as a degradation series (rows and CSV)
reliafy maintenance products.build --product-id PRODUCT_ID --serial 0007            # what it would make (a dry run)
reliafy maintenance products.build --product-id PRODUCT_ID --serial 0007 --dry-run false   # build the item
reliafy maintenance get.design_rollup --id DESIGN_POSITION_ID   # one design position across every item built
reliafy maintenance get.item_class --id ITEM_CLASS_ID --fleet true   # a class's positions, with risk now where a model is linked
reliafy apply ops.json --run                     # maintenance changes in one call (dry run without --run)
reliafy list search --q "oil filter"            # anything you can open, by name, tag, serial or part number
reliafy list library --query "check valve" --record-kind rate   # published failure data
reliafy get library_record --id nrc-inl-2020:ckv-fto
reliafy get library_record --id mil-hdbk-217f-n2:9-1-rc-11 --environment GF   # a handbook rate, ground fixed
reliafy change library_create --name "Site pumps" --description "Our fleet's fitted models"   # a library of your own
reliafy change library_add --library-id LIBRARY_ID --model-id MODEL_ID   # a snapshot (or --dataset-id)
reliafy list libraries                           # yours, shared with you, public and the built-in handbooks
reliafy change library_use --library-id LIBRARY_ID --entry-id ENTRY_ID   # copy an entry into your workspace
reliafy analyse prediction --environment GF --mission-time 1000 \
  --lines '[{"name": "Ceramic capacitors", "record_id": "mil-hdbk-217f-n2:10-1-ck-11015", "quantity": 48}]'   # a parts count
reliafy change prediction_save --name "Controller box" --environment GF --lines @parts.json   # ... saved
reliafy list predictions

Values are read as their argument's type: text, numbers, true/false, JSON for lists and objects (--times 100,500,1000 works too), and @file reads a file. --args '{…}' gives all the arguments as one JSON object. Add --json for JSON output. reliafy photo add and reliafy document add report each file and exit non-zero if any failed.

reliafy fit never guesses what a flag column means: Reliafy reads censoring as 0 = failed, 1 = still running; if yours is 1 = failed, add --c-invert.

Configuration

  • RELIAFY_TOKEN and RELIAFY_BASE_URL, or reliafy login, which saves them in ~/.config/reliafy/config.json (%APPDATA%\reliafy on Windows; RELIAFY_CONFIG_DIR to choose).
  • Self-hosted: reliafy.configure(token=…, base_url="https://reliafy.mycompany.com"), Client(base_url=…) or reliafy login --base-url …. A local server with sign-in off needs no token.

Notes

  • The token is a personal API token, created on the API access page in Reliafy. On Reliafy Cloud this is a Pro feature; self-hosted instances have it unconditionally. A token's scopes (read, write, ingest) decide what it may do.
  • Supported distributions for push: Weibull, Exponential, Normal, LogNormal, Gamma, LogLogistic, Exponentiated Weibull, Gumbel, Logistic.
  • The API in full: docs/api.md, and online: the Python client and the command line.
  • Changes: CHANGELOG.md.

Metadata

Release files for reliafy-client 0.12.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reliafy-client 0.12.3
File Size Uploaded Provenance Actions
reliafy_client-0.12.3.tar.gz 34.4 kB Without provenance Details for reliafy_client-0.12.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for reliafy-client 0.12.3
File Interpreter ABI Platform Actions
reliafy_client-0.12.3-py3-none-any.whl Python 3 none any Details for reliafy_client-0.12.3-py3-none-any.whl

Total release size: 66.5 kB

Release files / reliafy_client-0.12.3.tar.gz

Download URL reliafy_client-0.12.3.tar.gz
Size 34.4 kB
Tags Source
SHA-256 checksum
How to use checksums
81c08a8215f2af4427edcb13cd2f1581df412c384a018a98d59ac3f9f4f76d4d
BLAKE2b-256 checksum
How to use checksums
643b923c0fce1dc5df14f92751c27e5a8620ef6c562bb3941567ca9ca37e687f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Release files / reliafy_client-0.12.3-py3-none-any.whl

Download URL reliafy_client-0.12.3-py3-none-any.whl
Size 32.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e80935580aed8b32fc0f85865ed8e7e7e0c54ebaef6ea5e18b436f326c18ae8
BLAKE2b-256 checksum
How to use checksums
7d8f08979e1835991920bdb140847506f6f09bd7986a56de74925be7043aedba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Security for reliafy-client 0.12.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page