Skip to content

src/python/bindings.cc

Functions

Name
NB_MODULE(_tenzr , m )

Functions Documentation

function NB_MODULE

NB_MODULE(
    _tenzr ,
    m 
)

Source code

// Copyright 2026 The Tenzr Project Authors
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "bindings.h"

#include "tenzr/common/error.h"

NB_MODULE(_tenzr, m) {
  // One C++ error surface for Python: TenzrException -> tenzr.TenzrError (a ValueError).
  nb::exception<tenzr::TenzrException>(m, "TenzrError", PyExc_ValueError);

  m.doc() = "Tenzr: a differentiable n-dimensional array (tensor) library for heterogeneous computing";
  m.attr("__version__") = tenzr::Version();

  tenzr::python::BindArray(m);
  tenzr::python::BindTransforms(m);
  tenzr::python::BindPlax(m);
  tenzr::python::BindRandom(m);
  tenzr::python::BindSharding(m);
  tenzr::python::BindScipy(m);
  tenzr::python::BindProfiler(m);
}