Skip to content

Instantly share code, notes, and snippets.

@phaustin
Created September 2, 2020 15:39
Show Gist options
  • Save phaustin/8faf5f791cde5bb2d5a78042acf906f7 to your computer and use it in GitHub Desktop.
Save phaustin/8faf5f791cde5bb2d5a78042acf906f7 to your computer and use it in GitHub Desktop.
py38 jupyter-book tox and docs build
> conda activate dtox38
(dtox38):repos/jupyter-book
> tox -e py38-sphinx3
GLOB sdist-make: C:\Users\Phil\repos\jupyter-book\setup.py
py38-sphinx3 inst-nodeps: C:\Users\Phil\repos\jupyter-book\.tox\.tmp\package\2\jupyter-book-0.8.0.zip
py38-sphinx3 installed: alabaster==0.7.12,altair==4.1.0,apipkg==1.5,appdirs==1.4.4,argon2-cffi==20.1.0,async-generator==1.10,atomicwrites==1.4.0,attrs==20.1.0,Babel==2.8.0,backcall==0.2.0,beautifulsoup4==4.9.1,bleach==3.1.5,bokeh==2.2.1,branca==0.4.1,certifi==2020.6.20,cffi==1.14.2,chardet==3.0.4,click==7.1.2,colorama==0.4.3,coverage==5.2.1,cycler==0.10.0,decorator==4.4.2,defusedxml==0.6.0,docutils==0.16,entrypoints==0.3,execnet==1.7.1,folium==0.11.0,gitdb==4.0.5,GitPython==3.1.7,idna==2.10,imagesize==1.2.0,importlib-metadata==1.7.0,ipykernel==5.3.4,ipython==7.18.1,ipython-genutils==0.2.0,ipywidgets==7.5.1,jedi==0.17.2,Jinja2==2.11.2,jsonschema==3.2.0,jupyter-book @ file:///C:/Users/Phil/repos/jupyter-book/.tox/.tmp/package/2/jupyter-book-0.8.0.zip,jupyter-cache==0.4.1,jupyter-client==6.1.7,jupyter-core==4.6.3,jupyter-sphinx==0.3.1,jupytext==1.6.0rc0,kiwisolver==1.2.0,latexcodec==2.0.1,libsass==0.20.1,markdown-it-py==0.5.2,MarkupSafe==1.1.1,matplotlib==3.3.1,mistune==0.8.4,more-itertools==8.5.0,mpmath==1.1.0,myst-nb==0.10.0,myst-parser==0.12.8,nbclient==0.5.0,nbconvert==5.6.1,nbdime==2.0.0,nbformat==5.0.7,nest-asyncio==1.4.0,notebook==6.1.3,numpy==1.19.1,oset==0.1.3,packaging==20.4,pandas==1.1.1,pandocfilters==1.4.2,parso==0.7.1,pbr==5.5.0,pickleshare==0.7.5,Pillow==7.2.0,plotly==4.9.0,pluggy==0.13.1,prometheus-client==0.8.0,prompt-toolkit==3.0.7,py==1.9.0,pybtex==0.22.2,pybtex-docutils==0.2.2,pycparser==2.20,pydata-sphinx-theme==0.3.2,pyee==7.0.2,Pygments==2.6.1,pyparsing==2.4.7,pyppeteer==0.2.2,pyrsistent==0.16.0,pytest==3.10.1,pytest-cov==2.10.1,pytest-datadir==1.3.1,pytest-forked==1.3.0,pytest-regressions==2.0.1,pytest-timeout==1.4.2,pytest-xdist==2.1.0,python-dateutil==2.8.1,pytz==2020.1,pywin32==228,pywinpty==0.5.7,PyYAML==5.3.1,pyzmq==19.0.2,requests==2.24.0,retrying==1.3.3,Send2Trash==1.5.0,six==1.15.0,smmap==3.0.4,snowballstemmer==2.0.0,soupsieve==2.0.1,Sphinx==3.2.1,sphinx-book-theme==0.0.36,sphinx-click==2.5.0,sphinx-comments==0.0.3,sphinx-copybutton==0.3.0,sphinx-panels==0.4.1,sphinx-tabs==1.2.1,sphinx-thebe==0.0.7,sphinx-togglebutton==0.2.2,sphinxcontrib-applehelp==1.0.2,sphinxcontrib-bibtex==1.0.0,sphinxcontrib-devhelp==1.0.2,sphinxcontrib-htmlhelp==1.0.3,sphinxcontrib-jsmath==1.0.1,sphinxcontrib-qthelp==1.0.3,sphinxcontrib-serializinghtml==1.1.4,sphinxext-rediraffe==0.2.1,SQLAlchemy==1.3.19,sympy==1.6.2,terminado==0.8.3,testpath==0.4.4,toml==0.10.1,toolz==0.10.0,tornado==6.0.4,tqdm==4.48.2,traitlets==5.0.0,typing-extensions==3.7.4.3,urllib3==1.25.10,wcwidth==0.2.5,webencodings==0.5.1,websockets==8.1,widgetsnbextension==3.5.1,zipp==3.1.0
py38-sphinx3 run-test-pre: PYTHONHASHSEED='948'
py38-sphinx3 run-test: commands[0] | pytest
============================= test session starts =============================
platform win32 -- Python 3.8.5, pytest-3.10.1, py-1.9.0, pluggy-0.13.1
JB TEMPDIR: <TEMP>
rootdir: C:\Users\Phil\repos\jupyter-book, inifile: tox.ini
plugins: cov-2.10.1, datadir-1.3.1, forked-1.3.0, regressions-2.0.1, timeout-1.4.2, xdist-2.1.0
timeout: 100.0s
timeout method: thread
timeout func_only: False
collected 42 items
tests\test_build.py ..F.........FF.F [ 38%]
tests\test_clean.py .... [ 47%]
tests\test_config.py ............ [ 76%]
tests\test_pdf.py FF [ 80%]
tests\test_toc.py .... [ 90%]
tests\test_tocdirective.py ..s [ 97%]
tests\test_utils.py . [100%]
================================== FAILURES ===================================
__________________________ test_build_from_template ___________________________
temp_with_override = WindowsPath('C:/Users/Phil/AppData/Local/Temp/pytest-of-unknown/pytest-4/test_build_from_template0')
cli = <click.testing.CliRunner object at 0x000001B447F8EFA0>
def test_build_from_template(temp_with_override, cli):
"""Test building the book template and a few test configs."""
# Create the book from the template
book = temp_with_override / "new_book"
_ = cli.invoke(commands.create, book.as_posix())
build_result = cli.invoke(commands.build, book.as_posix())
> assert build_result.exit_code == 0, build_result.output
E AssertionError: Running Jupyter-Book v0.8.0
E Source Folder: C:\Users\Phil\AppData\Local\Temp\pytest-of-unknown\pytest-4\test_build_from_template0\new_book
E Config Path: C:\Users\Phil\AppData\Local\Temp\pytest-of-unknown\pytest-4\test_build_from_template0\new_book\_config.yml
E Output Path: C:\Users\Phil\AppData\Local\Temp\pytest-of-unknown\pytest-4\test_build_from_template0\new_book\_build\html
E Running Sphinx v3.2.1
E making output directory... done
E myst v0.12.8: MdParserConfig(renderer='sphinx', commonmark_only=False, dmath_enable=True, dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, amsmath_enable=False, deflist_enable=False, update_mathjax=True, admonition_enable=False, figure_enable=False, disable_syntax=[], html_img_enable=False, url_schemes=['mailto', 'http', 'https'])
E building [mo]: targets for 0 po files that are out of date
E building [html]: targets for 4 source files that are out of date
E updating environment: [new config] 4 added, 0 changed, 0 removed
checking for C:\Users\Phil\AppData\Local\Temp\pytest-of-unknown\pytest-4\test_build_from_template0\new_book\references.bib in bibtex cache... not found
E parsing bibtex file C:\Users\Phil\AppData\Local\Temp\pytest-of-unknown\pytest-4\test_build_from_template0\new_book\references.bib... parsed 5 entries
Executing: notebooks in: C:\Users\Phil\AppData\Local\Temp\pytest-of-unknown\pytest-4\test_build_from_template0\new_book
E
E Exception occurred:
E File "c:\users\phil\repos\jupyter-book\.tox\py38-sphinx3\lib\site-packages\jupyter_core\paths.py", line 361, in win32_restrict_file_to_user
E import win32api
E ImportError: DLL load failed while importing win32api: The specified module could not be found.
E The full traceback has been saved in C:\Users\Phil\AppData\Local\Temp\sphinx-err-qlc0fyfc.log, if you want to report the issue to the developers.
E Please also report this if it was a user error, so that a better error message can be provided next time.
E A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
E
E assert 1 == 0
E + where 1 = <Result RuntimeError('\n\x1b[91m===============================================================================\x1b[0m...e for the cause.\n\n\x1b[91m===============================================================================\x1b[0m\n')>.exit_code
tests\test_build.py:32: AssertionError
_______________________________ test_build_docs _______________________________
docs = WindowsPath('C:/Users/Phil/AppData/Local/Temp/pytest-of-unknown/pytest-4/test_build_docs0/docs')
cli = <click.testing.CliRunner object at 0x000001B448BB4F70>
def test_build_docs(docs, cli):
"""Test building the documentation book."""
html = docs.joinpath("_build", "html")
result = cli.invoke(commands.build, [docs.as_posix()])
> assert result.exit_code == 0
E assert 1 == 0
E + where 1 = <Result SystemExit(1)>.exit_code
tests\test_build.py:149: AssertionError
_______________________________ test_build_page _______________________________
pages = WindowsPath('C:/Users/Phil/AppData/Local/Temp/pytest-of-unknown/pytest-4/test_build_page0/pages')
cli = <click.testing.CliRunner object at 0x000001B448BB4580>
def test_build_page(pages, cli):
"""Test building a page."""
page = pages.joinpath("single_page.ipynb")
html = pages.joinpath("_build", "_page", "single_page", "html")
index = html.joinpath("index.html")
result = cli.invoke(commands.build, [page.as_posix()])
> assert result.exit_code == 0
E AssertionError: assert 1 == 0
E + where 1 = <Result RuntimeError('\n\x1b[91m===============================================================================\x1b[0m...e for the cause.\n\n\x1b[91m===============================================================================\x1b[0m\n')>.exit_code
tests\test_build.py:161: AssertionError
___________________________ test_execution_timeout ____________________________
pages = WindowsPath('C:/Users/Phil/AppData/Local/Temp/pytest-of-unknown/pytest-4/test_execution_timeout0/pages')
build_resources = (WindowsPath('C:/Users/Phil/AppData/Local/Temp/pytest-of-unknown/pytest-4/test_execution_timeout0/books'), WindowsPath('C:/Users/Phil/AppData/Local/Temp/pytest-of-unknown/pytest-4/test_execution_timeout0/books/toc'))
cli = <click.testing.CliRunner object at 0x000001B44B86E970>
@pytest.mark.skipif(sphinx.version_info[0] == 2, reason="randomly fails on CI")
def test_execution_timeout(pages, build_resources, cli):
"""Testing timeout execution for a page."""
books, _ = build_resources
path_page = pages.joinpath("complex_outputs_unrun.ipynb")
path_c = books.joinpath("config", "_config_timeout.yml")
path_html = pages.joinpath("_build", "_page", "complex_outputs_unrun", "html")
result = cli.invoke(
commands.build, [path_page.as_posix(), "--config", path_c.as_posix()]
)
> assert "Execution Failed" in result.stdout
E AssertionError: assert 'Execution Failed' in 'Running Jupyter-Book v0.8.0\nSource Folder: C:\\Users\\Phil\\AppData\\Local\\Temp\\pytest-of-unknown\\pytest-4\\test_...uts_unrun.html\n\n\n\x1b[92m===============================================================================\x1b[0m\n\n'
E + where 'Running Jupyter-Book v0.8.0\nSource Folder: C:\\Users\\Phil\\AppData\\Local\\Temp\\pytest-of-unknown\\pytest-4\\test_...uts_unrun.html\n\n\n\x1b[92m===============================================================================\x1b[0m\n\n' = <Result okay>.stdout
tests\test_build.py:191: AssertionError
________________________________ test_pdfhtml _________________________________
cli = <click.testing.CliRunner object at 0x000001B44B8AE550>
temp_with_override = WindowsPath('C:/Users/Phil/AppData/Local/Temp/pytest-of-unknown/pytest-4/test_pdfhtml0')
@pytest.mark.requires_chrome
def test_pdfhtml(cli: CliRunner, temp_with_override: Path):
path_output = temp_with_override.absolute()
# test for build
path_template = path_tests.parent.joinpath("jupyter_book", "book_template")
cmd = f"{path_template} --path-output {path_output} --builder pdfhtml"
result = cli.invoke(build, cmd.split())
> assert result.exit_code == 0
E AssertionError: assert 1 == 0
E + where 1 = <Result RuntimeError('\n\x1b[91m===============================================================================\x1b[0m...e for the cause.\n\n\x1b[91m===============================================================================\x1b[0m\n')>.exit_code
tests\test_pdf.py:21: AssertionError
________________________________ test_pdflatex ________________________________
cli = <click.testing.CliRunner object at 0x000001B44BAB2F40>
temp_with_override = WindowsPath('C:/Users/Phil/AppData/Local/Temp/pytest-of-unknown/pytest-4/test_pdflatex0')
@pytest.mark.requires_tex
def test_pdflatex(cli: CliRunner, temp_with_override: Path):
path_output = temp_with_override.absolute()
# test for build
path_template = path_tests.parent.joinpath("jupyter_book", "book_template")
cmd = f"{path_template} --path-output {path_output} --builder pdflatex"
result = cli.invoke(build, cmd.split())
> assert result.exit_code == 0
E AssertionError: assert 1 == 0
E + where 1 = <Result RuntimeError('\n\x1b[91m===============================================================================\x1b[0m...e for the cause.\n\n\x1b[91m===============================================================================\x1b[0m\n')>.exit_code
tests\test_pdf.py:49: AssertionError
============================== warnings summary ===============================
tests/test_build.py::test_build_from_template
C:\Users\Phil\repos\jupyter-book\jupyter_book\config.py:49: DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
validator_cls = jsonschema.validators.validator_for(schema)
c:\users\phil\repos\jupyter-book\.tox\py38-sphinx3\lib\site-packages\oset\pyoset.py:16: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
from collections import MutableSet
-- Docs: https://docs.pytest.org/en/latest/warnings.html
========= 6 failed, 35 passed, 1 skipped, 2 warnings in 27.89 seconds =========
ERROR: InvocationError for command 'C:\Users\Phil\repos\jupyter-book\.tox\py38-sphinx3\Scripts\pytest.EXE' (exited with code 1)
_______________________________________________________ summary _______________________________________________________
ERROR: py38-sphinx3: commands failed
(dtox3
(dtox38):repos/jupyter-book
> jb build docs
Running Jupyter-Book v0.8.0
Source Folder: C:\Users\Phil\repos\jupyter-book\docs
Config Path: C:\Users\Phil\repos\jupyter-book\docs\_config.yml
Output Path: C:\Users\Phil\repos\jupyter-book\docs\_build\html
Running Sphinx v3.2.1
making output directory... done
myst v0.12.8: MdParserConfig(renderer='sphinx', commonmark_only=False, dmath_enable=True, dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, amsmath_enable=True, deflist_enable=True, update_mathjax=True, admonition_enable=True, figure_enable=True, disable_syntax=[], html_img_enable=True, url_schemes=['mailto', 'http', 'https'])
loading intersphinx inventory from https://executablebooks.org/en/latest/objects.inv...
loading intersphinx inventory from https://myst-parser.readthedocs.io/en/latest/objects.inv...
loading intersphinx inventory from https://myst-nb.readthedocs.io/en/latest/objects.inv...
loading intersphinx inventory from https://www.sphinx-doc.org/en/master/objects.inv...
loading intersphinx inventory from https://nbformat.readthedocs.io/en/latest/objects.inv...
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 36 source files that are out of date
updating environment: [new config] 36 added, 0 changed, 0 removed
checking for C:\Users\Phil\repos\jupyter-book\docs\references.bib in bibtex cache... not found
parsing bibtex file C:\Users\Phil\repos\jupyter-book\docs\references.bib... parsed 4 entries
reading sources... [100%] start/publish
Updating `nb-exec-table`s in: {'content/execute'}
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] start/publish
C:\Users\Phil\repos\jupyter-book\CHANGELOG.md:18: WARNING: 'myst' reference target not found: ..\start\build.md
C:\Users\Phil\repos\jupyter-book\CHANGELOG.md:30: WARNING: 'myst' reference target not found: ..\content\math.md
C:\Users\Phil\repos\jupyter-book\CHANGELOG.md:43: WARNING: 'myst' reference target not found: ..\advanced\advanced.md
C:\Users\Phil\repos\jupyter-book\CHANGELOG.md:60: WARNING: 'myst' reference target not found: ..\content\content-blocks.md
C:\Users\Phil\repos\jupyter-book\CHANGELOG.md:61: WARNING: 'myst' reference target not found: ..\content\figures.md
C:\Users\Phil\repos\jupyter-book\CHANGELOG.md:63: WARNING: 'myst' reference target not found: ..\content\content-blocks.md
C:\Users\Phil\repos\jupyter-book\CHANGELOG.md:64: WARNING: 'myst' reference target not found: ..\content\math.md
C:\Users\Phil\repos\jupyter-book\CHANGELOG.md:68: WARNING: 'myst' reference target not found: ..\file-types\jupytext.Rmd
C:\Users\Phil\repos\jupyter-book\CHANGELOG.md:82: WARNING: 'myst' reference target not found: ..\content\execute.md
C:\Users\Phil\repos\jupyter-book\CHANGELOG.md:85: WARNING: 'myst' reference target not found: ..\content\code-outputs.md
C:\Users\Phil\repos\jupyter-book\CHANGELOG.md:95: WARNING: 'myst' reference target not found: ..\content\content-blocks.md
generating indices... genindexdone
writing additional pages... searchdone
copying images... [100%] C:/Users/Phil/repos/jupyter-book/docs/_build/jupyter_execute/reference\cheatsheet_7_0.png1.png
copying downloadable files... [100%] references.bib
copying static files... ... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 11 warnings.
The HTML pages are in docs\_build\html.
Copying tabs assets
Writing redirects...
(good) content-types\index.html --> file-types\index.html
(good) content-types\markdown.html --> file-types\markdown.html
(good) content-types\notebooks.html --> file-types\notebooks.html
(good) content-types\myst-notebooks.html --> file-types\myst-notebooks.html
(good) content-types\jupytext.html --> file-types\jupytext.html
(good) content-types\restructuredtext.html --> file-types\restructuredtext.html
===============================================================================
Finished generating HTML for book.
Your book's HTML pages are here:
docs\_build\html\
You can look at your book by opening this file in a browser:
docs\_build\html\index.html
Or paste this line directly into your browser bar:
file://C:\Users\Phil\repos\jupyter-book\docs\_build\html\index.html
===============================================================================
(dtox38):repos/jupyter-book
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment