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.2

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.2
File Size Uploaded
cognix_sdk-0.1.2.tar.gz 35.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for cognix-sdk 0.1.2
File
cognix_sdk-0.1.2-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
cognix_sdk-0.1.2-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details
cognix_sdk-0.1.2-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details
cognix_sdk-0.1.2-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.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
cognix_sdk-0.1.2-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
cognix_sdk-0.1.2-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details
cognix_sdk-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 MB

Release files / cognix_sdk-0.1.2.tar.gz

Download URL cognix_sdk-0.1.2.tar.gz
Size 35.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a4db33b0545509361acfd9f3d9ab5cee05e015eadb968c5b505ca87bc9f8be69
BLAKE2b-256 checksum
How to use checksums
aa63d7a17b754ac536a5776b3a1d9a656686613f4e5fb5ea68963bf1524e257b
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.2-py3-none-win_amd64.whl

Download URL cognix_sdk-0.1.2-py3-none-win_amd64.whl
Size 1.7 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
84f70ba8854f8d8f60473502f86edbeb8833fb35c5c07e10aa93870ad9e30783
BLAKE2b-256 checksum
How to use checksums
67ee0622bedadb5b87815efb92d7df067c882e165ae918dd892ea31e37aa9ae2
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.2-py3-none-musllinux_1_2_x86_64.whl

Download URL cognix_sdk-0.1.2-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
7f37092aebf0d857ff18c22825bf309e6a5102d3dc68b01c9727b31e550c1771
BLAKE2b-256 checksum
How to use checksums
5b8c25f020f4dbff0756a5fab526cfd91440132e220b27ad6acfa40f22bb5e14
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.2-py3-none-musllinux_1_2_aarch64.whl

Download URL cognix_sdk-0.1.2-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
c90ac1366e52c415b678b55129cddc130f358e09740a418521be93c60c2e7433
BLAKE2b-256 checksum
How to use checksums
9bcf0dd8fd4397de4cabcf246c0859538dc1efda5c6b3723c505ff4a9a032911
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.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL cognix_sdk-0.1.2-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
21640ae33a74d5a6b0b876026fef0a91d20a5f918bad14719c4242fd14e79c7c
BLAKE2b-256 checksum
How to use checksums
f2d1c6d5ed45f804f0cb20100315cacd184bafdf3e07fde8f9e1f96b00c44845
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.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL cognix_sdk-0.1.2-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
b6e48e798264bf77da3b5f515bb65f3376d3c18df53de6341d887fccfcb9cb02
BLAKE2b-256 checksum
How to use checksums
236a5592ea21c5a79d1028cf34369a39fd2b85eb9138d14af2e6706363e62d1c
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.2-py3-none-macosx_11_0_arm64.whl

Download URL cognix_sdk-0.1.2-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
984b8b5964404c64a2c1ebbf30d0a1e15b9ae02aa1bbdced7b98f0b8e062814f
BLAKE2b-256 checksum
How to use checksums
b8a8fc019dab78367afb2ce0cdf66921f7e2b62c53d04525f7c8a24562fa0a59
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.2-py3-none-macosx_10_12_x86_64.whl

Download URL cognix_sdk-0.1.2-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
1c25db0038418d3fd3785a04836e98fa468d267daabe5bb403077ca3b2e6393c
BLAKE2b-256 checksum
How to use checksums
8aabddf2324776a206108a29cf4cde388e9541dfc8c3156e7b8730b56b38c72f
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.2-py3-none-any.whl

Download URL cognix_sdk-0.1.2-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
040c61196694104e78ca1586b135b73212ba33bfcc00ef9b0c2626a374abec22
BLAKE2b-256 checksum
How to use checksums
3ffd5c6dc447f471eb713c97936f6e48b8eccbf18a69a3d2bb50260e8c018f19
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

0.1.3

9 release files

This release

0.1.2 This release

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