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

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.4
File Size Uploaded
cognix_sdk-0.1.4.tar.gz 37.0 kB Details

Built distributions (wheels)

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

Total release size: 11.1 MB

Release files / cognix_sdk-0.1.4.tar.gz

Download URL cognix_sdk-0.1.4.tar.gz
Size 37.0 kB
Tags Source
SHA-256 checksum
How to use checksums
74911244746ea9223bc1805cc2a9ec9c4bbda96534bce3bbc2fbb01f14cf629d
BLAKE2b-256 checksum
How to use checksums
3ec2dd21db5bcd61803d28fda7ea0bdc08f66b8a7ac7320220a3247477392903
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 3, 2026.

Transparency log

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

Download URL cognix_sdk-0.1.4-py3-none-win_amd64.whl
Size 1.7 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
d30683a0c64ebd4804d6400f19b5f47631a6b3ae95b54a55937cd1ee61bf2b03
BLAKE2b-256 checksum
How to use checksums
8a40ff7d1107afdd4616facb60a7bd183efdc11814578c80238cefddedd2a660
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 3, 2026.

Transparency log

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

Download URL cognix_sdk-0.1.4-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
09467c82b42d08a241b169528e6ec6a62d129f67628ba216ce7ae0cc920b3d7f
BLAKE2b-256 checksum
How to use checksums
9d625d5edc428073c4abf14e33e2cc1ad18d64a0b1ecd8bdc3fec70a73a20460
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 3, 2026.

Transparency log

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

Download URL cognix_sdk-0.1.4-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
5b598ed7377c0aa1ef26cdcfb95c541ed95957033ed12cba06dab9c9dbbda25e
BLAKE2b-256 checksum
How to use checksums
54a21e2ba0fab85f28afc4d3232341601b730c6bdd3ad3b6318199538903288d
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 3, 2026.

Transparency log

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

Download URL cognix_sdk-0.1.4-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
21cc9e126a0c0dcf6273187d530f80f8358401068c741c69f6d351fdbbf16596
BLAKE2b-256 checksum
How to use checksums
d5660b9c1d4b0e8aa80b399383ae9a815a26318533f4a512b2ec80744d71b1fb
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 3, 2026.

Transparency log

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

Download URL cognix_sdk-0.1.4-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
013163965858b0d96855c75d4c1abe0ed62d847901150732aa273d6795db8e42
BLAKE2b-256 checksum
How to use checksums
28964bf91907c40e5eabe9a6655926040610032499f9db14f61ba3e42f0e9352
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 3, 2026.

Transparency log

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

Download URL cognix_sdk-0.1.4-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
b0b55f0b21815475dabbafbf67fc3d3273781932a4ba7095d504ef5896755cef
BLAKE2b-256 checksum
How to use checksums
d1aebed84588aec20e2cea339a55078fefae82f7fc8288e8bc4c2ecf51407782
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 3, 2026.

Transparency log

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

Download URL cognix_sdk-0.1.4-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
820b23626e17cea9e96812a7cca3f8c2ad20fa53919c0df39a5fdcbab44c8b68
BLAKE2b-256 checksum
How to use checksums
758e0dd483ca2418b1f857f4f0d353e9e55d0a1064c795a8d1871d483b42ebde
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 3, 2026.

Transparency log

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

Download URL cognix_sdk-0.1.4-py3-none-any.whl
Size 26.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
758ed6d6a27be2a590b2325072f05351dffb258b94c010acb2fb02ca1fe8a35b
BLAKE2b-256 checksum
How to use checksums
aa7492dc3d79f9e216a1e7b997a0754ce4e82e7d96885e2d0de016e6ccabb8a4
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 3, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.0

9 release files

This release

0.1.4 This release

9 release files

0.1.3

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