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

sage -rst2ipynb command #21514

Closed
sagetrac-tmonteil mannequin opened this issue Sep 16, 2016 · 62 comments
Closed

sage -rst2ipynb command #21514

sagetrac-tmonteil mannequin opened this issue Sep 16, 2016 · 62 comments

Comments

@sagetrac-tmonteil
Copy link
Mannequin

sagetrac-tmonteil mannequin commented Sep 16, 2016

The sage -rst2ipynb allows to easily transform rst source into ipynb worksheet.

Depends on #21513

CC: @seblabbe @kcrisman

Component: notebook

Keywords: days79

Author: Thierry Monteil

Branch/Commit: cc0d50b

Reviewer: Sébastien Labbé, Nicolas M. Thiéry

Issue created by migration from https://trac.sagemath.org/ticket/21514

@sagetrac-tmonteil sagetrac-tmonteil mannequin added this to the sage-7.4 milestone Sep 16, 2016
@sagetrac-tmonteil
Copy link
Mannequin Author

sagetrac-tmonteil mannequin commented Sep 16, 2016

Changed dependencies from 21513 to #21513

@nthiery
Copy link
Contributor

nthiery commented Nov 23, 2016

comment:4

Ah, I had not noticed that there was no code yet here.

Thierry, do you have preliminary code?

@sagetrac-tmonteil
Copy link
Mannequin Author

sagetrac-tmonteil mannequin commented Nov 23, 2016

comment:5

Sure, but since there were many dependencies, i prefered to push changes once the previous dependency is positively reviewed, instead of having tons of branches to merge and rebase.

@nthiery
Copy link
Contributor

nthiery commented Nov 23, 2016

comment:6

Sure thing :-)

@sagetrac-tmonteil
Copy link
Mannequin Author

sagetrac-tmonteil mannequin commented Nov 24, 2016

Branch: u/tmonteil/sage__rst2ipynb_command

@sagetrac-tmonteil
Copy link
Mannequin Author

sagetrac-tmonteil mannequin commented Nov 24, 2016

New commits:

45e561a#21513: package rst-to-ipynb
966a95d#21513 : rst_to_ipynb -> rst-to-ipynb
d44379dMerge branch 'develop' into t/21513/package_rst-to-ipynb
421388a21513: Refactor the rst2ipynb package to use the new pip-installable package, step 1: renaming the pkg directory
d5d568021513: Refactor the rst2ipynb package to use the new pip-installable package, remainder
4e3c1fd#21514 : sage-rst2ipynb script
4be49e4#21514 : sage -rst2ipynb command

@sagetrac-tmonteil
Copy link
Mannequin Author

sagetrac-tmonteil mannequin commented Nov 24, 2016

Commit: 4be49e4

@seblabbe
Copy link
Contributor

comment:9

Would it be possible to have some basic help message including examples:

$ sage -rst2ipynb -h
usage: rst2ipynb [-o OUTPUT] [-k KERNEL] [-v] [-d] [input]
rst2ipynb: error: unrecognized arguments: -h

like

$ sage -rst2sws -h
Usage: 

    sage -rst2sws [options] <source> <destination>

Generates Sage worksheet (.sws) from standalone reStructuredText source.

Example:

    sage -rst2sws file.rst file.sws

Remarks:

    About LaTeX:

        You can put LaTeX expression between backticks "`", dollar signs
        "$" or double dollar signs "$$". Math role is not supported yet
        (get involved!).

        Examples: `\\alpha`, $\\beta$ or $$\\gamma$$.

    About backslashes:

        In reStructuredText, backslashes must be escaped, otherwise they
        are ignored. This is not quite practical for Sage's purposes
        since backslashes are never escaped in the docstrings. If you
        write `\alpha`, $\beta$ or $$\gamma$$, add the line

            ..  escape-backslashes

        to the file and this script will consider all backslashes
        escaped. Alternatively, you may use the available options.

Options:
  -h, --help            show this help message and exit
  --escape-backslashes  Escape all backslashes in the input file before
                        execution. Default: disabled.
  --no-escape-backslashes
                        Disable escaping all backslashes in the input file
                        before execution. This overrides the presence of the
                        line '.. escape-backslashes' in the file, which can
                        also be used to escape all backslashes in the file.

using argparse or something?

@nthiery
Copy link
Contributor

nthiery commented Nov 24, 2016

comment:10

I am doing some minor adjustments that I'll discuss now with the above with Sébastien

@nthiery
Copy link
Contributor

nthiery commented Nov 24, 2016

comment:11

Thierry: do you have a strong preference for

    sage -rst2ipynb bla.rst bla.ipynb

rather than

    sage -rst2ipynb bla.rst -o bla.ipynb

?

If yes, I might as well update rst2ipynb to simplify the sage wrapper

@nthiery
Copy link
Contributor

nthiery commented Nov 24, 2016

comment:12

Hmm, although that would take another round of updating the package ...

@nthiery
Copy link
Contributor

nthiery commented Nov 24, 2016

comment:13

I was thinking about that because I believe Sébastien's suggestion would be best implemented in the rst2ipynb script.

@nthiery
Copy link
Contributor

nthiery commented Nov 24, 2016

@nthiery
Copy link
Contributor

nthiery commented Nov 24, 2016

Changed commit from 4be49e4 to 08cba4b

@nthiery
Copy link
Contributor

nthiery commented Nov 24, 2016

comment:15

I have checked Thierry's changes and made minor improvements. I am fine with the current state.


New commits:

08cba4b21514: minor improvements to the error messages

@nthiery
Copy link
Contributor

nthiery commented Nov 24, 2016

comment:16

I'll now try to grab Sébastien :-)

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 24, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

efd5c0b21514: more explicit error messages

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 24, 2016

Changed commit from 08cba4b to efd5c0b

@nthiery
Copy link
Contributor

nthiery commented Nov 24, 2016

comment:18

We just discussed with Sébastien (cf. previous commit).

Plan for the next version of rst2ipynb itself (in a later ticket)

  • add documentation upon rst2ipynb -h
  • use the syntax rst2ipynb input output for consistency with other docutils tools
  • support for Python prompts >>>>
  • update the Sage package, simplifying sage-rst2ipy accordingly (just pass the arguments as is)

@seblabbe
Copy link
Contributor

comment:19

IPython notebook worksheet -> Jupyter notebook

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 24, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

017ecb721514: improved sage -h documentation upon Sébastien's request

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 24, 2016

Changed commit from efd5c0b to 017ecb7

@sagetrac-tmonteil
Copy link
Mannequin Author

sagetrac-tmonteil mannequin commented Nov 24, 2016

@seblabbe
Copy link
Contributor

Changed author from Thierry Monteil to Thierry Monteil, Nicolas M. Thiéry

@seblabbe
Copy link
Contributor

Changed commit from 017ecb7 to c0fe2a0

@seblabbe
Copy link
Contributor

Changed branch from u/nthiery/sage__rst2ipynb_command to 017ecb7

@seblabbe
Copy link
Contributor

Changed keywords from none to days79

@seblabbe
Copy link
Contributor

Commit: caa90a6

@seblabbe
Copy link
Contributor

comment:32

I created a branch u/slabbe/21514 with commit 017ecb7681c015 merged into 7.5.beta4.

Sébastien


Last 10 new commits:

966a95d#21513 : rst_to_ipynb -> rst-to-ipynb
d44379dMerge branch 'develop' into t/21513/package_rst-to-ipynb
421388a21513: Refactor the rst2ipynb package to use the new pip-installable package, step 1: renaming the pkg directory
d5d568021513: Refactor the rst2ipynb package to use the new pip-installable package, remainder
4e3c1fd#21514 : sage-rst2ipynb script
4be49e4#21514 : sage -rst2ipynb command
08cba4b21514: minor improvements to the error messages
efd5c0b21514: more explicit error messages
017ecb721514: improved sage -h documentation upon Sébastien's request
caa90a6Merge commit '017ecb7681c0159927cf8c5e6bf15391c651056e' into 7.5.beta4

@seblabbe
Copy link
Contributor

Changed branch from 017ecb7 to u/slabbe/21514

@seblabbe
Copy link
Contributor

seblabbe commented Dec 1, 2016

comment:33

Replying to @sagetrac-tmonteil:

  • @seblabbe : i used IPython notebook because of the .ipynb extension, i am not sure what is the recommended name.

http://nbviewer.jupyter.org/ says "Jupyter Notebooks". I would be okay with "IPython Notebooks" but not "IPython worksheets".

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 1, 2016

Changed commit from caa90a6 to 227cbba

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 1, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

227cbba21514: adding tests for rst2ipynb in tests/cmdline.py

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 1, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

735ecd621514: typo

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 1, 2016

Changed commit from 227cbba to 735ecd6

@seblabbe
Copy link
Contributor

seblabbe commented Dec 1, 2016

comment:36

I added some doctests in tests/cmdline.py. To me this ticket is a positive review. I let you review the doctests I added.

Sébastien

@seblabbe
Copy link
Contributor

seblabbe commented Dec 2, 2016

comment:37

I forgot to add # optional - rst2ipynb to the new doctests...

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 8, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

479c2c721514: adding comment # optional - rst2ipynb

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 8, 2016

Changed commit from 735ecd6 to 479c2c7

@seblabbe
Copy link
Contributor

seblabbe commented Dec 8, 2016

comment:39

Modifications to tests/cmdline.py needs review.

@seblabbe
Copy link
Contributor

comment:40

ping :)

@sagetrac-tmonteil
Copy link
Mannequin Author

sagetrac-tmonteil mannequin commented Jan 9, 2017

Changed branch from u/slabbe/21514 to u/tmonteil/21514

@seblabbe
Copy link
Contributor

Changed commit from 479c2c7 to cc0d50b

@seblabbe
Copy link
Contributor

comment:42

ok for the merge:)


New commits:

c0fe2a0#21514 : add an help message.
cc0d50b21514 : merge.

@nthiery
Copy link
Contributor

nthiery commented Feb 20, 2017

comment:43

Any reason left not to set a positive review?

@sagetrac-tmonteil
Copy link
Mannequin Author

sagetrac-tmonteil mannequin commented Feb 21, 2017

Changed reviewer from Sébastien Labbé to Sébastien Labbé, Nicolas M. Thiéry

@sagetrac-tmonteil
Copy link
Mannequin Author

sagetrac-tmonteil mannequin commented Feb 21, 2017

comment:44

I had some general comments, but i guess it is better to have this merged soon.

@sagetrac-tmonteil
Copy link
Mannequin Author

sagetrac-tmonteil mannequin commented Feb 21, 2017

Changed author from Thierry Monteil, Nicolas M. Thiéry to Thierry Monteil

@sagetrac-tmonteil

This comment has been minimized.

@vbraun
Copy link
Member

vbraun commented Feb 23, 2017

Changed branch from u/tmonteil/21514 to cc0d50b

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

3 participants