networkx / nx-guides

Examples and Jupyter Notebooks about NetworkX
https://networkx.org/nx-guides/
Creative Commons Zero v1.0 Universal
192 stars 104 forks source link

Notebook on Lowest Common Ancestor #69

Closed dtekinoglu closed 1 year ago

dtekinoglu commented 2 years ago

Hello @MridulS , I am continuously getting the following error:

make: *** [Makefile:20: html] Error 1

Do you have any idea about what could be the reason?

inomag commented 2 years ago

@dtekinoglu You need to include the content in nx-guides/content/algorithms/index.md

dtekinoglu commented 2 years ago

Thank you! @inomag

inomag commented 2 years ago

Hi @dtekinoglu, I am not sure what is wrong here but I think you can make the following changes -

MridulS commented 2 years ago

@dtekinoglu Hmm there are some weird markdown cells here. Can you try running this on your notebook?

$ jupytext notebook.ipynb --to myst

and then push it here?

Thanks!

dtekinoglu commented 2 years ago

Thank you @MridulS it passes the checks now 😄 I initally included a quiz cell which requires user input, but I thought that it is not supported. Thus, I removed that part. Am I correct? Do you suggest me to add it back?

MridulS commented 2 years ago

I initally included a quiz cell which requires user input, but I thought that it is not supported. Thus, I removed that part. Am I correct?

Yeah we are not that fancy just yet! For now let's just keep narrative notebooks for our users :)

MridulS commented 2 years ago

You can check the doc build here https://output.circle-artifacts.com/output/job/427d7bcf-0a12-412e-af58-618e4985f1e2/artifacts/0/site/_build/html/content/algorithms/lca/LCA.html

Please do checkout the suggestions by @inomag, they should help with cleaning up the output :)

dtekinoglu commented 2 years ago

@MridulS how can I apply lint pre-commit changes for the notebooks?

MridulS commented 2 years ago

@dtekinoglu I pushed the changes required to make the linters happy. It needs to run the pre-commit linters on the jupyter notebook (.ipynb) before converting it to myst.

# The following commands finds ALL the .md files in the repository
$ find content/ -name "*.md" -exec jupytext --to notebook {} \;
# Run pre-commit on all files
$ pre-commit run --all-files --show-diff-on-failure --color always
# Convert all the new "cleaned" ipynb files to myst
$ find content/ -name "*.ipynb" -exec jupytext --to md:myst {} \;
# Remove the .ipynb files
$ find content/ -name "*.ipynb" -exec rm {} \;

After this you should see the changes the linters made inside the markdown myst files. I know this isn't an ideal workflow but currently nbqa doesn't natively support myst format.

MridulS commented 1 year ago

@dtekinoglu well finally did the review :) I'll go ahead and merge this. Thanks for your contributions :)