pybind / pybind/python_example
Documentation generated with Sphinx
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Python
- Estrelas
- 530
- Forks
- 150
- Merge médio
- 8d 2h
- PRs com merge (30d)
- 1
Descrição
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?
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Nenhum arquivo-fonte ou teste é especificado. Comece comparando os bindings de métodos do pybind11 com as assinaturas produzidas pelo Sphinx, usando o construtor funcional e os métodos com falha como pontos de entrada contrastantes. Está concluído quando o Sphinx preservar a assinatura completa de numpy.ndarray e o valor padrão desses métodos.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- cpp, numpy, python
- Domínio
- documentation
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Precisa de esclarecimento
- Facilidade para iniciantes
- 25/100