Skip to main content

cognix-sdk

Se instala cognix-sdk y se importa cgx, como pillow→PIL. En PyPI, cognix es de otro proyecto y cgx está reservado por alguien más; cgx es el identificador que CogniX ya usa en sus API keys (cgx_<feature>_…), así que se queda en el módulo y en el binario.

Empaqueta tu modelo como un bundle de CogniX y compruébalo en tu máquina antes de publicarlo.

uv add cognix-sdk
uv add "cognix-sdk[sklearn]"   # si quieres exportar un modelo de scikit-learn a ONNX

Qué problema resuelve

El modelo lo entrenas tú, con lo que quieras. Lo que hay que hacer bien es el artefacto, y ahí hay una trampa que no da ningún error:

el extractor de features se escribe dos veces — tu featurize() en Python para entrenar, y features.star (Starlark) que evalúa Go en producción. Cuando se separan, el modelo sigue contestando: sólo que sobre otra entrada.

No hay excepción, ni traza, ni métrica que baje. Este paquete existe para que eso falle en tu portátil.

Uso

import cgx
from cgx import starlark
import pandas as pd
from sklearn.linear_model import LogisticRegression
from sklearn.preprocessing import StandardScaler

# 1. tus datos (exportados con: wolfctl exports download-export --id <uuid> > datos.parquet)
df = pd.DataFrame([json.loads(r) for r in pd.read_parquet("datos.parquet")["RESULT"]])
schema = ["current_a", "vibration", "temperature"]

# 2. tu modelo, como lo entrenas siempre
scaler = StandardScaler().fit(df[schema].to_numpy())
clf = LogisticRegression(max_iter=1000).fit(scaler.transform(df[schema].to_numpy()), df["fault_label"])

# 3. el artefacto
onnx = cgx.to_onnx(clf, n_features=len(schema))

b = cgx.Bundle(
    domain="motor_faults",
    feature="classix",
    schema=schema,
    featurizer=starlark.identity_featurizer(schema),
    starlark=starlark.identity("motor_faults", schema),
    onnx_path=onnx,
    output_names=cgx.onnx.scores_output(onnx),   # el tensor de scores, no `label`
    output_kind="probabilities",                    # skl2onnx ya las emite normalizadas
    payloads=df[schema].head(8).to_dict("records"),   # payloads representativos
    labels=sorted(df["fault_label"].unique()),
    mean=scaler.mean_.tolist(),
    std=scaler.scale_.tolist(),
)

b.check()        # escribe el bundle y lo verifica; levanta BundleError si algo no cuadra

check() hace dos cosas, en este orden:

  1. En Python: que tu featurize() devuelva tantos números como features declaras, para cada payload. Un fallo aquí es tuyo y se ve al instante.
  2. Con el binario cgx, que viene dentro de este paquete: valida el manifest contra el contrato de la feature y corre verify-parity — tu Python contra el Starlark real.

El paso 2 lo hace el binario, no una reimplementación de Starlark en Python. Un segundo intérprete sería una segunda implementación que puede diferir del motor de producción, o sea el mismo problema que esto viene a detectar, movido un nivel. Si el binario no está en el PATH, check() lo dice y no finge un OK.

Falta una tercera comprobación, verify-bundle, que reproduce el resultado completo —clase, probabilidades, puerta OOD— contra una fixture grabada al entrenar. Esa ejecuta el modelo, o sea el motor, y vive en el binario cognix: si lo tienes en el PATH, check() lo usa; si no, dice exactamente qué queda sin cubrir. Un bundle traído de fuera casi nunca trae esa fixture de todos modos, porque la escribe el trainer de la feature.

Y ya se puede servir:

cognix classix serve --bundles dist
cognix classix infer --bundle dist/motor_faults --json '{"current_a":18.5,"vibration":1.2,"temperature":97.0}'

Si tu featurización no es la identidad

starlark.identity() sólo cubre el caso "cada feature es un campo numérico del payload". Para cualquier otra cosa —una razón entre dos campos, un one-hot, una saturación— escribes tu features.star a mano y se lo pasas en starlark=.

⛔ No hay traducción automática de Python a Starlark, y es deliberado. Traducir un featurize() cualquiera leyendo su AST es la funcionalidad que enamora y la que puede traducir mal en silencio — exactamente la clase de fallo que este SDK existe para cazar. check() funciona con el extractor que sea, y esa es la garantía que importa.

Lo que este paquete NO es

No es un cliente de la API REST de WolfOps, y no lo será a mano: un wrapper de ~100 endpoints envejece con cada endpoint nuevo y se convierte en otro sitio donde algo se queda fuera en silencio. Para los datos ya tienes dos líneas que no hay que mantener:

wolfctl exports download-export --id <uuid> > datos.parquet
df = pd.read_parquet("datos.parquet")

Su contrato es el formato del bundle (v3), que está versionado y cambia a propósito, no una superficie que cambia cada semana.

Referencia

Bundle(...) el artefacto: .manifest(), .payload_schema(), .save(dir), .check(dir)
to_onnx(model, n_features) export de scikit-learn con el opset y la salida que espera el motor
starlark.identity(domain, schema) el features.star del caso identidad
starlark.identity_featurizer(schema) su gemelo Python, para pasarlo a featurizer=

El bloque de tarea de cada feature (calibración, intervalos conformes, puerta OOD, fallbacks) se declara en extra_manifest=: es lo específico de cada una y pertenece a la feature, no a este paquete.

Release files for cognix-sdk 0.1.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 cognix-sdk 0.1.3
File Size Uploaded
cognix_sdk-0.1.3.tar.gz 37.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for cognix-sdk 0.1.3
File
cognix_sdk-0.1.3-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
cognix_sdk-0.1.3-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details
cognix_sdk-0.1.3-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details
cognix_sdk-0.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
cognix_sdk-0.1.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
cognix_sdk-0.1.3-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
cognix_sdk-0.1.3-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details
cognix_sdk-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 MB

Release files / cognix_sdk-0.1.3.tar.gz

Download URL cognix_sdk-0.1.3.tar.gz
Size 37.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6f3a5d9d829e00250142e941bc0f6218b9050372c5efdd74a7a7f925f84bbba5
BLAKE2b-256 checksum
How to use checksums
b100a928fada52a75302de20bcd1f7969ea29791c552285d936f0caa109abfc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release files / cognix_sdk-0.1.3-py3-none-win_amd64.whl

Download URL cognix_sdk-0.1.3-py3-none-win_amd64.whl
Size 1.7 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
4e9d16ada105700fc8ef9f07605194fa7f22b010da000dbf6470729133024146
BLAKE2b-256 checksum
How to use checksums
7fcc28aa541753a63a211dace62bff82e8f5eff2fd56a1cde506b19de506baee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release files / cognix_sdk-0.1.3-py3-none-musllinux_1_2_x86_64.whl

Download URL cognix_sdk-0.1.3-py3-none-musllinux_1_2_x86_64.whl
Size 1.6 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
8e3d872c17c6f2be402f3f2d9a7d2cc6b743ccd5b5240f16c0252ffb00c7fe3d
BLAKE2b-256 checksum
How to use checksums
70527db44737964be80b807df41c15f5ef22ab4434e5deee3af35178b07b38d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release files / cognix_sdk-0.1.3-py3-none-musllinux_1_2_aarch64.whl

Download URL cognix_sdk-0.1.3-py3-none-musllinux_1_2_aarch64.whl
Size 1.5 MB
Tags Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
c89f9ee5dc3b8b0a576d7e0a647c8acf88100c956fc0243410f0bdd00be0af39
BLAKE2b-256 checksum
How to use checksums
4f9f20439ace32cab66addb84e5e6b50f862250a968ce73109baeaf4badaf0fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release files / cognix_sdk-0.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL cognix_sdk-0.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.6 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
bdb72bfa018b81a4efc954f2b550916f39e84e604709c07af9da89815dfeeff2
BLAKE2b-256 checksum
How to use checksums
e33c55499adad2c69d58b0429c26a46212a680af1bfba0061c380d58f6a95c73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release files / cognix_sdk-0.1.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL cognix_sdk-0.1.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.5 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
45b4093204c67226a684443e5a780fa30206b79b1a68d4ef507b620212731985
BLAKE2b-256 checksum
How to use checksums
fc7a07b1ffc753d1cb21eafdc2ffd14836f0b17b95239473ac57a305ac52ac3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release files / cognix_sdk-0.1.3-py3-none-macosx_11_0_arm64.whl

Download URL cognix_sdk-0.1.3-py3-none-macosx_11_0_arm64.whl
Size 1.5 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1d48064479056aad9e97de59d6c65f2058b2357c375d7955f241c4500a80d9e7
BLAKE2b-256 checksum
How to use checksums
6a0fbcbd0aa3bbeeb4b20dfa7ff841fa3fb26e0179dfe37e8b1b4cad73708df9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release files / cognix_sdk-0.1.3-py3-none-macosx_10_12_x86_64.whl

Download URL cognix_sdk-0.1.3-py3-none-macosx_10_12_x86_64.whl
Size 1.7 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
7c3d9535b2f7713269a90a054d7dbf3de96cc9f83fa6184fdc682bf0aa713528
BLAKE2b-256 checksum
How to use checksums
2bca6cb0f9546ded0b93a11422f0f79fdf022ece812c9b6358944b60f3766338
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release files / cognix_sdk-0.1.3-py3-none-any.whl

Download URL cognix_sdk-0.1.3-py3-none-any.whl
Size 27.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2fec8e51a8f27648cfdc727bc2ec5e37ce9dcc47627fbfe3fa9870d3ef1cb32f
BLAKE2b-256 checksum
How to use checksums
8fe7f7ccb07568eb2ae77724b8773271f6881afcc5c3c4657dc47485db0b8593
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.0

9 release files

0.1.4

9 release files

This release

0.1.3 This release

9 release files

0.1.2

9 release files

0.1.1

9 release files

0.1.0

9 release files

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