Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RxPY 3.0: Documentation #270

Closed
13 of 14 tasks
MainRo opened this issue Jan 5, 2019 · 18 comments
Closed
13 of 14 tasks

RxPY 3.0: Documentation #270

MainRo opened this issue Jan 5, 2019 · 18 comments
Assignees
Milestone

Comments

@MainRo
Copy link
Collaborator

MainRo commented Jan 5, 2019

With v3, an official documentation should be provided. This issue can be used to follow the progress on this topic. The following things must be done

  • create outline
  • migrate part of readme in doc
  • reference doc from readme
  • add a migration section
  • document APIs : autodoc for all operators and classes
  • choose a theme : Guzzle.
  • publish the doc somewhere: https://rxpy.readthedocs.io
  • add marble diagrams for operators
  • add additional readings section
  • license section
  • contributing section
  • Fix docstring errors in init.py
  • spellcheck
  • final pass on each section
MainRo added a commit to MainRo/RxPY that referenced this issue Jan 5, 2019
This is a first commit of ReactiveX#270, to start structuring a documentation.
For now it contains empty sections, and references to the existing
APIs (observable, observer, subject, and operators).
dbrattli pushed a commit that referenced this issue Jan 5, 2019
This is a first commit of #270, to start structuring a documentation.
For now it contains empty sections, and references to the existing
APIs (observable, observer, subject, and operators).
@dbrattli
Copy link
Collaborator

dbrattli commented Jan 6, 2019

There are some theme samples are http://www.writethedocs.org/guide/tools/sphinx-themes/ . Read-the-docs is nice. Also the Guzzle theme looks quite nice and clean.

As for hosting we should be able to get permission to deploy at e.g. http://reactivex.io/rxpy

@MainRo
Copy link
Collaborator Author

MainRo commented Jan 20, 2019

I have several commits ready. Should I push them on feature/rxpy-3.0 or wait until the merge on master is done ?

@MainRo
Copy link
Collaborator Author

MainRo commented Jan 20, 2019

Concerning the marble diagrams, initially I wanted to reuse the ones from reactivex.io. However they are not all consistent (there are several graphic styles, depending on the operators). Moreover linking to picture does not allow to see the marble diagram when reading the source code.

So I wonder if the following could be possible: Create a sphinx addon that would use a tool to convert text based marble diagram to pictures. This would have several advantages compared to static pictures that are hard to update:

  • The diagrams are readable in the code documentation.
  • They can be easily updated.
  • diagrams are automatically available when adding new operators
  • diagrams style is consistent.

The main issue here is to get this marble renderer. Surprisingly I did not find such a tool. If anybody is aware of an existing tool, I am interested! Otherwise maybe it could be relatively easy to implement one based on matplotlib. I will try some mocks if we want to document marble diagrams this way.

@dbrattli
Copy link
Collaborator

We might want to merge with master first. It's now being added new features on the feature branch, so it's time to merge. We can still have a period of rapid development before locking down and starting doing PRs for the master branch.

It would be interesting to see if it would be possible to use Mermaid flowcharts to generate marble diagrams. They are text based and can be used with Markdown and Sphinx. I haven't tried making marble diagrams, and they won't (currently) render directly on GitHub, but they render e.g on HackMD. But I cannot find a way to render to ascii, so it would not be possible to use inside the code doc. Perhaps plain ascii diagrams are simpler and better.

dbrattli pushed a commit that referenced this issue Jan 21, 2019
This is a first commit of #270, to start structuring a documentation.
For now it contains empty sections, and references to the existing
APIs (observable, observer, subject, and operators).
@MainRo
Copy link
Collaborator Author

MainRo commented Jan 22, 2019

Status update: I enabled the Guzzle theme, the outline should be complete. Now I will work on the content of the missing parts.
Once this is done I will look at the marble diagrams.

@jcafhe
Copy link
Collaborator

jcafhe commented Feb 4, 2019

I have some questions regarding the convention we should use(or not) for docstrings, especially in examples. It is not that serious but there are actually multiple ways for naming input/output observables:
Concerning rx

>>> res =  ...
>>> obs = ...
>>> merged = ...
>>> rx.merge(obs1, obs2)
>>> rx.merge(xs, ys)

Concerning rx.operators

>>> res = ...
>>> op = ...

When I have the opportunity to update a docstring, I use res = because it seems to be the most common and rx.merge(obs1, obs2). For rx.operators I use op = ... for denoting that the return value is not an observable but a function.
What do you think ?

@MainRo
Copy link
Collaborator Author

MainRo commented Feb 11, 2019

I played with a marble diagram generator from text and have a first implementation running. It is available here:
https://github.com/MainRo/dooble

it is also published on pypi. there is a map example in "examples/map.txt"

Do not focus on the visual aspects yet. I am confident that we can easily generate diagrams this way. I think I also found a way to describe higher order observable in an easy way. The tool is based on matplotlib, which allows to generate better marble diagrams than what could be done with mermaid diagrams (in my opinion)

generate a png with:

dooble --input examples/map.txt --output /tmp/map.png

what are the opinions on that ?

@jcafhe
Copy link
Collaborator

jcafhe commented Feb 12, 2019

This is great! Now I'm curious to see how a higher order observable would look like.

A few comments:

  • in your example, you should append an 's' to example in path examples/map.txt:
    dooble --input examples/map.txt --output /tmp/map.png
  • have you considered to make an entry point instead of a shell script. In fact, in windows I didn't manage to make it work by calling dooble or python dooble in cli. However, it's a bit more tedious to set up.

@MainRo
Copy link
Collaborator Author

MainRo commented Feb 13, 2019

I changed the script with an entry point. Tell me if installation works better on windows.
I also added a support for higher order observables. I use the '+' character as an anchor point between the parent and the child: A parent emits a '+' item to indicate that it emits an observable. A child starts with a '+' to indicate that it is a continuation of the parent. The parent and the child must have the anchor at the same position to be associated.
I added an example with the window operator which is:

--a-b-c---d-e-f-->
[     window     ]
--+-------+------>
          +d-e-f-|
  +a-b-c-|

We do not draw the vertical links on the text because this is tedious and would break the ebnf based grammar, but they are generated on the diagram. Keeping in mind that this is for documentation with simple diagrams, the text representation seems still readable to me.

@jcafhe
Copy link
Collaborator

jcafhe commented Feb 14, 2019

I changed the script with an entry point. Tell me if installation works better on windows.

Yes, it's working perfectly, thank you 👍 .
I played with window example and this is fine. Great work!

@MainRo MainRo mentioned this issue Feb 18, 2019
@MainRo
Copy link
Collaborator Author

MainRo commented Feb 20, 2019

Now that the content of the readme is - almost - completely in the documentation, I will strip it. I have two questions on that:

  • I would like to change the format from md to rst so that it can be displayed on pypi.
  • Should I reference the doc with relative paths to github, absolute paths to github or a placeholder where the doc will be published ? For now I would use absolute paths to github, and later reference the published doc.

@MainRo MainRo self-assigned this Mar 18, 2019
@MainRo
Copy link
Collaborator Author

MainRo commented Mar 18, 2019

I still have some paragraphs to complete, but the overall documentation is in good shape. @dbrattli do you know if there is a way to automatically publish it somewhere on reactivex.io ? With travis we can encrypt credentials so that the CI automatically update the doc and nobody needs access to the credentials. I made something like this on a private gitlab-ci that could be relevant here:

  • All commits on master trigger a new doc build being published on site-url/master.
  • All tags creation trigger a new doc build being published on site-url/[tag].
  • site-url/lastest is linked to the most recent tag url (site-url/latest -> site-url/[tag]).

I can work on the travis part if needed, provided that there is a way to publish via tooling.

@erikkemperman
Copy link
Collaborator

Does anyone know why sphinx doesn't crosslink properly? For example:
https://rxpy.readthedocs.io/en/latest/reference_observable_factory.html

These methods have return type Observable, and I would expect to be able to click on that to go the Observable class.

@erikkemperman
Copy link
Collaborator

erikkemperman commented Apr 3, 2019

About those failing crosslinks -- I just quickly tried what happened if I use the bundled sphinx-apidoc script to generate rst files, and it turns out that the crosslinks then just work...

Please note, I'm not proposing to do this necessarily, because it will just create a "dry" package/subpackage index at the upper levels, not the nicely decorated "topical" structure there is now under Reference.

Still, perhaps it might help in tracking down why the crosslinks don't work currently? To me it seems like kind of a big deal to get those working!

erikkemperman@4c6c8bd

@MainRo
Copy link
Collaborator Author

MainRo commented Apr 3, 2019

strange. sphinx-apidoc seems to manually create rst files. So we should have the same results than with sphinx-build.

There are old references to this issue here:
sphinx-doc/sphinx#1059
https://github.com/agronholm/sphinx-autodoc-typehints/issues/15

So it's supposed to work here. I tried adding the parameters set by sphinx-apidoc in the rst, and setting the napoleon "use_param" option without success.

@dbrattli dbrattli added this to the v3.0 milestone Apr 20, 2019
@dbrattli dbrattli pinned this issue May 22, 2019
@erikkemperman
Copy link
Collaborator

erikkemperman commented Jun 3, 2019

Hm, never noticed this before: if there are docstrings for both class and __init__ then sphinx only uses the first. So for example, AsyncSubject has both,

"""Represents the result of an asynchronous operation. The last value
before the close notification, or the error received through
on_error, is sent to all subscribed observers."""

"""Creates a subject that can only receive one value and that value is
cached for all future observations."""

But the generated docs only have the first section:
https://rxpy.readthedocs.io/en/latest/reference_subject.html#rx.subjects.AsyncSubject

So the init function is not actually documented! This behaviour can change this with a single sphinx setting, but I just wanted to check if this might be deliberate (i.e. that we were only supposed to put docstrings in either class or __init__(), not both).

@MainRo
Copy link
Collaborator Author

MainRo commented Jun 3, 2019

Wow nice catch! I think that documenting in both class and constructor makes sense: The class documentation contains information on the class itself, while init is specifically for the constructor.

@MainRo
Copy link
Collaborator Author

MainRo commented Jul 22, 2019

closing this issue now that v3 is released. We will iterate on the doc with dedicated issues and PR.

@MainRo MainRo closed this as completed Jul 22, 2019
@MainRo MainRo unpinned this issue Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants