Giter VIP home page Giter VIP logo

Comments (14)

lexnederbragt avatar lexnederbragt commented on June 1, 2024

By the way, I'd appreciate it if the current sending of the output of the execution to the terminal could be made optional. This is currently this line: https://github.com/CINPLA/doconce/blob/cse/lib/doconce/execution.py#L78

from doconce.

lexnederbragt avatar lexnederbragt commented on June 1, 2024

See also https://github.com/CINPLA/doconce/blob/cse/test/execute.do.txt

EDIT: the correct command to convert that doconce file is

doconce format ipynb execute.do.txt --execute

from doconce.

aless80 avatar aless80 commented on June 1, 2024

A demo can be found by installing doconce as per https://github.com/CINPLA/cse_book#readme

The link is broken, could you fix it?

I am asking because I am not able to compile execute.do.txt from CINPLA/doconce - cse branch or text1.do.txt from doconce_demo. Having the in installation instructions would help me troubleshooting. The installation for doconce on CINPLA seems old and fails.

The error I get is the following:

doconce format ipynb text1.do.txt
  File "/home/amarin/doconce/lib/doconce/ipynb.py", line 615, in ipynb_code
    cells.append(new_markdown_cell(source=block))
  File "/home/amarin/doconce/venv/lib/python3.6/site-packages/nbformat/v4/nbbase.py", line 132, in new_markdown_cell
    id=random_cell_id(),
  File "/home/amarin/doconce/venv/lib/python3.6/site-packages/nbformat/corpus/words.py", line 20, in generate_corpus_id
    return '-'.join((random.sample(acceptable_adjectives(), 1)[0], random.sample(acceptable_nouns(), 1)[0]))
  File "/home/amarin/doconce/venv/lib/python3.6/site-packages/nbformat/corpus/words.py", line 15, in acceptable_adjectives
    with open(os.path.join(os.path.dirname(__file__), 'adjectives.txt'), 'r') as adjectives_file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/amarin/doconce/venv/lib/python3.6/site-packages/nbformat/corpus/adjectives.txt'

Possibly related to this error, is this comment that was present in the installation instructions for DocOnce:

# If problems with IPython.nbformat.v4: clone ipython and run setup.py
# to get the latest version

from doconce.

lexnederbragt avatar lexnederbragt commented on June 1, 2024

Sorry, I forgot that the repo is private, and I do not have enough permission to add you. Here is the relevant section:

Installation:

Install Anaconda.
Run the following commands in a terminal:

conda create --name doconce python=3
source activate doconce
conda install future notebook preprocess publish scipy ffmpeg -c defaults -c conda-forge
pip install mako pygments

git clone [email protected]:CINPLA/doconce  # or git clone https://github.com/CINPLA/doconce
cd doconce
git checkout cse
python setup.py develop

from doconce.

lexnederbragt avatar lexnederbragt commented on June 1, 2024

You'll may not be able to clone https://github.com/CINPLA/doconce. Let me know, and I'll ask for you to be added to that organisation and repo.

from doconce.

aless80 avatar aless80 commented on June 1, 2024

Hello @lexnederbragt , could you do some tests on this commit?

from doconce.

lexnederbragt avatar lexnederbragt commented on June 1, 2024

Sure. I did a fresh install like this:

git clone https://github.com/doconce/doconce.git doconce_doconce
conda create -n doconce_doconce_54ef5e4 doconce notebook matplotlib pandas
conda activate doconce_doconce_54ef5e4
cd /Users/alexajo/github/doconce_doconce/
python setup.py install

Then, doconce --version gave:

DocOnce version 1.5.3 (from /anaconda3/envs/doconce_doconce_54ef5e4/lib/python3.9/site-packages/DocOnce-1.5.3-py3.9.egg/doconce)

Then

cd /path/to/doconce_demo/text1
doconce format ipynb text1.do.txt --execute

This gave

<snip...>

  File "/anaconda3/envs/doconce_doconce_54ef5e4/lib/python3.9/site-packages/DocOnce-1.5.3-py3.9.egg/doconce/ipynb.py", line 254, in ipynb_code
    from . import jupyter_execution
ImportError: cannot import name 'jupyter_execution' from 'doconce' (/anaconda3/envs/doconce_doconce_54ef5e4/lib/python3.9/site-packages/DocOnce-1.5.3-py3.9.egg/doconce/__init__.py)

from doconce.

aless80 avatar aless80 commented on June 1, 2024

Sorry, I accidentally omitted that file because I usually do a git clean -fd after running the tests

from doconce.

lexnederbragt avatar lexnederbragt commented on June 1, 2024

That problem is now gone. I can start testing now, thanks!

from doconce.

lexnederbragt avatar lexnederbragt commented on June 1, 2024

It seems to be working for notebooks, and not break other things.
Looks like I now can compile all my course documents
using this version of doconce. Exciting! Thanks!

A few things, though:

  1. --execute with doconce format pdflatex for me fails on
    latex.py.

Example: in doconce_demo repo, exercises.pdf and others,
(please do a new git pull if you want to use this repo)

doconce format pdflatex exercise1.do.txt --latex_code_style=vrb --execute

fails ends with:

File "/path/to/doconce/latex.py", line 1177, in latex_code
    filename_stem = "{}/{}".format(cache_folder, str(uuid.uuid4()))
NameError: name 'uuid' is not defined

(no error without --execute)

  1. I get a bunch of Not our reply, Wrong message id and Not output from our execution.
    But I don't know whether that is a problem...

  2. One small difference I saw was this:
    (in doconce_demo, e.g. exercises.ipynb and others)
    when the DocOnce file had:

See figure ref{PythonDict} for an illustration that explains the python dictionary concept.

FIGURE: [../img/PythonDict, width=400 frac=0.8] Data structure concept of a dictionary in python. label{PythonDict}

With the CINPLA doconce version, in ipynb output, this becomes:

"See [figure 1](#PythonDict) for an illustration that explains the python dictionary concept.\n",

With doconce/doconce it becomes

"See [figure](#PythonDict) for an illustration that explains the python dictionary concept.\n",

Finally, please note, when you update the documentation,
that the PR also introduces two other new options,
--ipynb_non_editable_text and --ipynb_non_editable_code

from doconce.

aless80 avatar aless80 commented on June 1, 2024
  1. Fixed
  2. I am not sure about these messages. I do not see them when I execute doconce. Not our reply and Wrong message id are from CINPLA's code in jupyter_executiion.py, which they mark as Adapted from nbconvert.ExecutePreprocessor by IPython. Not output from our execution should only happens when using --verbose-execute and it looks like a warning.
  3. That happens when formatting to ipynb, right? If so it should be ok now.
  4. If you are referring to the manual, a new compilation of that should fix it. I tried to do it and got some latex issues, which I should look into

from doconce.

lexnederbragt avatar lexnederbragt commented on June 1, 2024

Thanks! My problem was also caused by using Python 3.7. Doing a fresh install (conda) with Python 3.6 and the latest doconce gives no problems on the doconce_demo repo that I can find. I'll look into 2) a bit more later.

from doconce.

lexnederbragt avatar lexnederbragt commented on June 1, 2024

By the way, could you add https://github.com/CINPLA/doconce/blob/dev/test/execute.do.txt to the test folder and test it? It works for me, but it may be good to have it in the test suite?

from doconce.

lexnederbragt avatar lexnederbragt commented on June 1, 2024

I'm OK with closing this issue. If any further problems show up, I'll submit new issues for them. Thanks, Alessandro!

from doconce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.