-
Notifications
You must be signed in to change notification settings - Fork 13
Automatic support for ipython3 code blocks #79
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
Conversation
Thanks for the submission! The changes look alright and the use case is reasonable. You've even made the Maybe if we go this route of starting to add additional parsers, we could make a submodule out of the parsers. And certainly IPython is one of the more popular Python syntax supersets. I'll think about it! |
4722296
to
64388bc
Compare
Understandable. I still think it's worth it.
Why not? The list of the most common parsers will be very short, you don't have to implement any exotic formats.
In my own extensions I try to make their usage as simple as possible. For many people, using Sphinx is on its own already very complicated, and every extension that has cryptic custom settings makes the situation even more complicated. If it's too complicated, many users will simply give up, which would be a pity. I see no reason why adding If you don't implement it here, I will implement it in
I'm not sure if that's worth it for a few lines of code. And do you even expect requests for any other Python dialects? Cython? SageMath? I think the list is very short. |
That's fair, I think I've turned around. Honestly I don't quite know about more esoteric Python dialects, but they are just that: esoteric. As you said, I wouldn't honestly expect much more than IPython. I'm thinking here's what we should do:
This would result in the following: users would install |
Sounds good! I'm just not sure how to best make the |
BTW, what's the |
Thanks for the update! I'll probably edit this branch to finish the work as I laid out above. The |
I can finish it, no problem. I just wanted to wait for your comments.
Interesting, I didn't know that! But then I've found a bug: The CSS class I can fix this while I'm at it ... |
400cff4
to
26aa4fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, reviews are fine to me 😄 Here are some initial ones.
Big picture items:
- Docs
- Tests with IPython
26aa4fd
to
c80f163
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting there!
We probably ought to add at least a mention of this, if not a full example to our docs under "IPython blocks". Perhaps between doctest and third-party blocks since it's more third-party than doctest
but less than matplotlib
😄
Co-authored-by: Felix Hildén <[email protected]>
Co-authored-by: Felix Hildén <[email protected]>
Co-authored-by: Felix Hildén <[email protected]>
I'm not sure if we should mention this. The problem is that I don't know a realistic example where I would want to use the For me, this is mostly relevant in combination with other extensions (like e.g. Of course we could add a Jupyter notebook to the docs, but this seems a bit much. |
I think either is fine, although a short IPython syntax code block is totally fine. Users are probably able to extrapolate the use case to their notebooks. But we definitely will add some example about this 😄 Just the same toy code will do, preferably with some of those magic lines. |
e48b200
to
dfa6220
Compare
I've added a small section about IPython to the docs: dfa6220. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I think this is ready to go! Thanks for being patient with me and quick with the updates 👍
No problem, I like a thorough review! Thanks for merging! |
My main goal is to use this extension together with https://nbsphinx.readthedocs.io/ and to make it as easy as possible for others to do so as well.
#75 already helped to avoid having to specify custom CSS classes and this PR avoids having to specify
codeautolink_custom_blocks
.For reference, here are some changes on the
nbsphinx
side:spatialaudio/nbsphinx#613
spatialaudio/nbsphinx#614
With those changes in place, the only thing that users have to do is to add
'sphinx_codeautolink'
toextensions
. And that's exactly the amount they should have to do (i.e. I don't want to enable it automatically when loadingnbsphinx
).tox
checks passed