pybind / pybind/python_example

Documentation generated with Sphinx

Đang mở
#46 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
530
Fork
150
Merge trung bình
8 ngày 2 giờ
Pull request đã merge (30 ngày)
1

Mô tả

Let's say that I have a C++ class myclass with a method double loglik(const Eigen::MatrixXd& u). To expose this method in python, I have something like .def("loglik", &myclass::loglik, "computes the log-likelihood.", py::arg("u")), which works fine. In other words, when doing help(mymodule.myclass), I see something like loglik(self: mymodule.myclass, u: numpy.ndarray[float64[m, n]]). However, when generating the documentation with Sphinx, the generated signature is loglik(self, u, n]]).

Similarly, I have a method in C++ with some argument const Eigen::MatrixXd& u = Eigen::MatrixXd() (i.e., the only difference is the "default"), which I expose in python using py::arg("u") = Eigen::MatrixXd(), and again this works fine, but the generated signature for the documentation is myfunction(self, u, n]] = array[, dtype])...

And it does not stop here. The same class has a constructor taking an argument const Eigen::MatrixXd& u, which I expose in python using .def(py::init<const Eigen::MatrixXd&>(), "my constructor", py::arg("u")). In this case, the signature generated by Sphinx is __init__(self: mymodule.myclass, u: numpy.ndarray[float64[m, n]]), so this one works as expected...

What am I missing here?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Không có tệp nguồn hoặc bài kiểm thử nào được nêu. Hãy bắt đầu bằng cách so sánh các method binding của pybind11 với các chữ ký do Sphinx tạo ra, sử dụng constructor đang hoạt động và các method bị lỗi làm các điểm bắt đầu đối chiếu. Công việc được hoàn tất khi Sphinx giữ nguyên chữ ký đầy đủ của numpy.ndarray và giá trị mặc định cho các method này.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
cpp, numpy, python
Lĩnh vực
documentation
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.