BlueBrain / MorphIO

A python and C++ library for reading and writing neuronal morphologies
https://morphio.readthedocs.io
Apache License 2.0
27 stars 24 forks source link

Improve doc #439

Closed adrien-berchet closed 1 year ago

adrien-berchet commented 1 year ago

Fixes #358

The Python API part of the doc was not complete and had several formatting issues. This PR should fix these:

eleftherioszisis commented 1 year ago

You have changes that are not reflecting this PR's description. Why did you remove the binding modules separated by context to join them in a single large and hard-to-read file?

adrien-berchet commented 1 year ago

Ah yeah, this is because some methods of mutable classes need to be declared after immutable classes and some methods of immutable classes need to be declared after mutable classes. So all the classes must be defined before the methods. So if we want to keep things separated we need:

This was quite cumbersome so I gathered everything at the same place (and in the right order since the order matters). But we could try to split it again.

adrien-berchet commented 1 year ago

Ah and just to explain a bit more: these methods need other classes to be defined before so that Sphinx is able to properly link the argument types or returned types of these methods.

eleftherioszisis commented 1 year ago

I see. but we cannot sacrifice code readability in favor of sphinx, especially for the bindings that are already cumbersome to read and maintain.

adrien-berchet commented 1 year ago

Well, I don't think it's less readable but I am going to try to split it again into several functions.

eleftherioszisis commented 1 year ago

Before doing that, maybe @mgeplf could chip in.

adrien-berchet commented 1 year ago

I split again the functions so it's more readable. It was not so easy because the pybind11::class_ can not be constructed empty, so I had to store these objects into a struct. But in the end should be as readable as before.

eleftherioszisis commented 1 year ago

The documentation build from readthedocs is successful: https://readthedocs.org/projects/morphio/builds/19444990/