Skip to main content

Khiops Native Interface (KNI) - Python Package

Python bindings for the Khiops Native Interface (KNI), enabling direct deployment of Khiops models from Python without temporary files.

Installation

pip install khiops-kni

Quick Start

from kni import KNI

# Initialize KNI wrapper
kni = KNI()

# Open a stream for recoding
stream_handle = kni.open_stream(
    dictionary_file_name="model.kdic",
    dictionary_name="MyDictionary",
    header_line="feature1\tfeature2\tfeature3",
    field_separator="\t"
)

# Recode records
input_record = "value1\tvalue2\tvalue3"
ret_code, output_record = kni.recode_stream_record(stream_handle, input_record)

if ret_code == KNI.KNI_OK:
    print(f"Output: {output_record}")
else:
    print(f"Error: {kni.get_error_message(ret_code)}")

# Close the stream
kni.close_stream(stream_handle)

Features

  • Cross-platform: Works on Windows, Linux, and macOS
  • Easy to use: Pythonic API wrapping the C library
  • High performance: Direct C library calls via ctypes
  • Multi-table support: Handle complex multi-table schemas
  • Comprehensive error handling: Clear error messages for debugging

API Overview

KNI Class

Main class for interacting with the Khiops Native Interface.

Methods

  • get_version() - Get KNI version as integer
  • get_full_version() - Get full version string
  • set_log_file_name(log_file_name) - Set error log file
  • open_stream(dictionary_file_name, dictionary_name, header_line, field_separator) - Open a stream
  • close_stream(stream_handle) - Close a stream
  • recode_stream_record(stream_handle, input_record) - Recode a record
  • set_secondary_header_line(stream_handle, data_path, header_line) - Set secondary table header (multi-table)
  • set_external_table(stream_handle, data_root, data_path, data_table_file_name) - Set external table (multi-table)
  • finish_opening_stream(stream_handle) - Finish opening multi-table stream
  • set_secondary_input_record(stream_handle, data_path, input_record) - Set secondary record (multi-table)
  • get_stream_max_memory() - Get max memory for stream
  • set_stream_max_memory(max_mb) - Set max memory for stream
  • get_error_message(error_code) - Get human-readable error message

Multi-Table Example

from kni import KNI

kni = KNI()

# Open stream with main table header
stream_handle = kni.open_stream(
    "model.kdic", "MainDict", "id\tname\tvalue", "\t"
)

# Set secondary table header
kni.set_secondary_header_line(
    stream_handle, "Details", "detail_id\tmain_id\tinfo"
)

# Set external table
kni.set_external_table(
    stream_handle, "RefData", "", "reference.txt"
)

# Finish opening for multi-table
kni.finish_opening_stream(stream_handle)

# Set secondary records before recoding main record
kni.set_secondary_input_record(stream_handle, "Details", "1\t100\tinfo1")
kni.set_secondary_input_record(stream_handle, "Details", "2\t100\tinfo2")

# Recode main record
ret_code, output = kni.recode_stream_record(stream_handle, "100\tJohn\t42")

kni.close_stream(stream_handle)

Requirements

  • Python 3.11 or later
  • The KhiopsNativeInterface C library is bundled with this package

License

BSD-3-Clause-Clear

Support

For questions or issues, please visit the issue tracker or contact khiops.team@orange.com.

Metadata

Release files for khiops-kni 11.0.2

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

Built distributions (wheels)

Table of built distributions (wheels) for khiops-kni 11.0.2
File Actions
khiops_kni-11.0.2-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for khiops_kni-11.0.2-py3-none-win_amd64.whl
khiops_kni-11.0.2-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details for khiops_kni-11.0.2-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
khiops_kni-11.0.2-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.24+ ARM64, Linux glibc 2.28+ ARM64 Details for khiops_kni-11.0.2-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
khiops_kni-11.0.2-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for khiops_kni-11.0.2-py3-none-macosx_11_0_arm64.whl
khiops_kni-11.0.2-py3-none-macosx_10_9_x86_64.whl Python 3 none macOS 10.9+ x86-64 Details for khiops_kni-11.0.2-py3-none-macosx_10_9_x86_64.whl

Total release size: 30.4 MB

Release files / khiops_kni-11.0.2-py3-none-win_amd64.whl

Download URL khiops_kni-11.0.2-py3-none-win_amd64.whl
Size 1.9 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
47eb0dad05517d4dde14b8c685738371b0aeb0056c7ce2363f980157ca49bb3b
BLAKE2b-256 checksum
How to use checksums
7a02ce218a073b5a44c66a634216dbaf95527e0e0d013eb8f3e17ed32ab60d15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 10, 2026.

Transparency log

Release files / khiops_kni-11.0.2-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL khiops_kni-11.0.2-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 8.6 MB
Tags Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
8eaf78844d5e1a16f5a85ee66a09886387c66b2898f21eb45d201857b1513325
BLAKE2b-256 checksum
How to use checksums
532f558d4cd292e0540486bb0a4934fa92b80f1561596fae40a8a390e95b01ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 10, 2026.

Transparency log

Release files / khiops_kni-11.0.2-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL khiops_kni-11.0.2-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 8.3 MB
Tags Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
a5be58e6bf38cd055837f14210090c826d51e18f7676aa171bbb49fbf58dacbd
BLAKE2b-256 checksum
How to use checksums
c97639a6d34343668e38d4f4dcdf45e6846abc98ae52d97b024357406575a5f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 10, 2026.

Transparency log

Release files / khiops_kni-11.0.2-py3-none-macosx_11_0_arm64.whl

Download URL khiops_kni-11.0.2-py3-none-macosx_11_0_arm64.whl
Size 5.5 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f764f27e8a2dd67b631c046d54026a52bf3a4f3e8d83da78d4aff634b86a5e9a
BLAKE2b-256 checksum
How to use checksums
38c264e908b229bf494696b28c7c36b54153ca256b2f129f5b00d285eae93430
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 10, 2026.

Transparency log

Release files / khiops_kni-11.0.2-py3-none-macosx_10_9_x86_64.whl

Download URL khiops_kni-11.0.2-py3-none-macosx_10_9_x86_64.whl
Size 6.1 MB
Tags Python 3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
b89b7f4fbca054b1251d8b634438849806ae40db1ab8f80a6b04783ae6b4ded4
BLAKE2b-256 checksum
How to use checksums
db8d2c26028343eaf6eadb2cc91187c4a9b1c6afc9acdecf52c3ee19b5c01e53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 10, 2026.

Transparency log

Security for khiops-kni 11.0.2

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.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for khiops_kni-11.0.2-py3-none-win_amd64.whl

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 Nov 10, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

11.0.2 This release

5 release files Full provenance

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