Skip to content

Import of custom binded types #1089

@petrasvestartas

Description

@petrasvestartas

Following is a strange behavior of nanobind that I would like to ask exaplanation why.

I bind such custom types:

#include "types_std.hpp"

NB_MODULE(_types_std, m) {

    nb::bind_vector<std::vector<double>>(m, "VectorDouble");
    nb::bind_vector<std::vector<int>>(m, "VectorInt");
    nb::bind_vector<std::vector<bool>>(m, "VectorBool");
    nb::bind_vector<std::vector<std::vector<int>>>(m, "VectorVectorInt");
    nb::bind_vector<std::vector<compas::RowMatrixXd>>(m, "VectorRowMatrixXd");
    nb::bind_vector<std::vector<std::tuple<int, float, float, float>>>(m, "VectorTupleIntFloatFloatFloat");
    nb::bind_vector<std::vector<std::vector<std::tuple<int, float, float, float>>>>(m, "VectorVectorTupleIntFloatFloatFloat");
}

In python I load other nanobind submodules and install in another conda environment:

If I run an example from another project in my conda evironment this is most often not found:
from compas_libigl_types_std import VectorVectorInt # noqa: F401

The only solution is the following:
from compas_libigl import _types_std # noqa: F401 (edited)

Typically we get such error:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions