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

Please use Sphinx for documentation #640

Closed
chsasank opened this issue Aug 8, 2020 · 12 comments
Closed

Please use Sphinx for documentation #640

chsasank opened this issue Aug 8, 2020 · 12 comments

Comments

@chsasank
Copy link
Contributor

chsasank commented Aug 8, 2020

Your tutorial here is pretty awesome: http://blog.erezsh.com/how-to-write-a-dsl-in-python-with-lark/

Finding this was not easy. It'd be great if this could be added as tutorial in readthedocs. pandoc can convert this blog's html to rst and can be added to sphinx in less than 10 mins (assuming you don't have the source). If you have the source it's far easier.

@chsasank
Copy link
Contributor Author

chsasank commented Aug 8, 2020

Also link for json tutorial is broken.

@erezsh
Copy link
Member

erezsh commented Aug 8, 2020

The link is right here, where else should I put it? https://lark-parser.readthedocs.io/en/latest/

Not sure it's worth the trouble of turning it into a rst, but feel free to do so.

Thanks, I'll fix the json tutorial link!

erezsh added a commit that referenced this issue Aug 8, 2020
@chsasank
Copy link
Contributor Author

chsasank commented Aug 8, 2020

I just realized that Lark doesn't use sphinx and restructured text for the documentation. Sphinx is vastly superior for any python package's documentation. API documentation is a breeze with sphinx.

You need not export all the existing markdown documents to rst, although this is not hard with pandoc. I can help you set up sphinx and other things if you're interested.

@chsasank
Copy link
Contributor Author

chsasank commented Aug 8, 2020

The link is right here, where else should I put it? https://lark-parser.readthedocs.io/en/latest/

Ideally tutorials should be in left table of contents (TOC)

Not sure it's worth the trouble of turning it into a rst, but feel free to do so.

Do you have markdown version or some source of the post? Working with the source is easier than html.

@chsasank chsasank changed the title Please add tutorial you've written on DSL Please use Sphinx for documentation Aug 8, 2020
@erezsh
Copy link
Member

erezsh commented Aug 8, 2020

I've read the link and I'm not convinced that moving to Sphinx is the right move.

Lark uses markdown, because it's what github uses. It's familiar for everyone, and anyone view and edit the documentation online using github (It will create a PR automatically).

And while I can see the appeal of creating the docs from docstrings, I'm not sure that it will end up improving the quality of the documentation.

I'm not saying no, but I don't see this move as obvious.

@erezsh
Copy link
Member

erezsh commented Aug 8, 2020

I see now that sphinx can use markdown, so as long as it works with readthedocs, I think I'll be fine with it.

@chsasank
Copy link
Contributor Author

chsasank commented Aug 8, 2020

I've read the link and I'm not convinced that moving to Sphinx is the right move.

Sphinx is the de facto standard for documentation for a python library's documentation. Every major python library - Django, PyTorch, Twisted, you name it - uses sphinx. Sphinx is fairly easy to manage too. As I said before, I'll help you set it up by raising a PR.

Lark uses markdown, because it's what github uses.

Actually github supports restructedtext too. Example. But no matter. You can still keep on using markdown. Sphinx now supports markdown too.

I'm not sure that it will end up improving the quality of the documentation.

This improves the quality because documentation and code will be in one place. See scipy, a huge scientific computing library. It keeps documentation in docstrings of python functions and classes. This allows people to write better documentation.

@erezsh
Copy link
Member

erezsh commented Aug 8, 2020

But this kind of 100 line docstring is exactly the reason I'm apprehensive about it.

In my experience, if you're already reading the code, most of the information in the docstrings is already trivial and uninteresting. Comments and docstrings should be there to give you an overview and frame of reference, and not duplicate the information that the code already contains clearly.

It can be very frustrating, to try to understand a codebase where every time you jump to a function, you have to scroll down to start reading what it actually does.

And Python's help() doesn't understand RST, and neither do most IDEs (in the context of docstrings), so all of this markup just ends-up as a confusing eye-sore.

@chsasank
Copy link
Contributor Author

chsasank commented Aug 8, 2020

Well, this is the de facto standard in the python world. But this is your project, so whatever works for you :) Anyway, you don't have to use this auto API document generation feature of sphinx. Sphinx can still be useful regardless. Should I work on setting up sphinx skeleton for Lark?

@erezsh
Copy link
Member

erezsh commented Aug 8, 2020

So, in what ways is it still more useful than mkdocs?

Sure, perhaps a demonstration will help me get it.

@chsasank
Copy link
Contributor Author

chsasank commented Aug 8, 2020

I'll spend some time soon to create a PR with sphinx.

@erezsh
Copy link
Member

erezsh commented Aug 18, 2020

We are officially Sphinxed!

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

2 participants