You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The mkdcos-gallery webpage says that you can have your source gallery examples folder located either inside or outside the base mkdocs docs directory. But when I try to put the examples outside the docs directory, I get an error.
After checking that the build succeeds, you can delete the generated docs content:
rm -rf site
rm -rf docs/generated
Now, checkout the second example tag, where the examples have been moved outside the docs folder (so they are at the same heirarchy level). This time, the documentation build fails.
ValueError: '/Users/genevieb/Documents/GitHub/mkdocs-example-2/docs/examples' is not in the subpath of '/Users/genevieb/Documents/GitHub/mkdocs-example-2/docs/docs' OR one path is relative and the other is absolute.
Full error message:
mkdocs build
INFO - generating gallery...
generating gallery for /Users/genevieb/Documents/GitHub/mkdocs-example-2/docs/do
INFO - computation time summary:
INFO - - examples/plot_example.py: 0.00 sec 0.0 MB
INFO - Cleaning site directory
INFO - Building documentation to directory:
/Users/genevieb/Documents/GitHub/mkdocs-example-2/docs/site
Traceback (most recent call last):
File "/Users/genevieb/mambaforge/envs/mkdocs-gallery-dev/bin/mkdocs", line 10, in <module>
sys.exit(cli())
File "/Users/genevieb/mambaforge/envs/mkdocs-gallery-dev/lib/python3.10/site-packages/click/core.py", line 1130, in __call__returnself.main(*args, **kwargs)
File "/Users/genevieb/mambaforge/envs/mkdocs-gallery-dev/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv =self.invoke(ctx)
File "/Users/genevieb/mambaforge/envs/mkdocs-gallery-dev/lib/python3.10/site-packages/click/core.py", line 1657, in invokereturn _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/genevieb/mambaforge/envs/mkdocs-gallery-dev/lib/python3.10/site-packages/click/core.py", line 1404, in invokereturn ctx.invoke(self.callback, **ctx.params)
File "/Users/genevieb/mambaforge/envs/mkdocs-gallery-dev/lib/python3.10/site-packages/click/core.py", line 760, in invokereturn __callback(*args, **kwargs)
File "/Users/genevieb/mambaforge/envs/mkdocs-gallery-dev/lib/python3.10/site-packages/mkdocs/__main__.py", line 187, in build_command
build.build(config.load_config(**kwargs), dirty=not clean)
File "/Users/genevieb/mambaforge/envs/mkdocs-gallery-dev/lib/python3.10/site-packages/mkdocs/commands/build.py", line 282, in build
files = config['plugins'].run_event('files', files, config=config)
File "/Users/genevieb/mambaforge/envs/mkdocs-gallery-dev/lib/python3.10/site-packages/mkdocs/plugins.py", line 102, in run_event
result = method(item, **kwargs)
File "/Users/genevieb/temp/gallery/mkdocs-gallery/src/mkdocs_gallery/plugin.py", line 250, in on_files
examples_dirs =self._get_dirs_relative_to(self.config['examples_dirs'], rel_to_dir=config['docs_dir'])
File "/Users/genevieb/temp/gallery/mkdocs-gallery/src/mkdocs_gallery/plugin.py", line 305, in _get_dirs_relative_toreturn [Path(e).relative_to(rel_to_dir).as_posix() for e in dir_or_list_of_dirs]
File "/Users/genevieb/temp/gallery/mkdocs-gallery/src/mkdocs_gallery/plugin.py", line 305, in <listcomp>return [Path(e).relative_to(rel_to_dir).as_posix() for e in dir_or_list_of_dirs]
File "/Users/genevieb/mambaforge/envs/mkdocs-gallery-dev/lib/python3.10/pathlib.py", line 818, in relative_toraiseValueError("{!r} is not in the subpath of {!r}"ValueError: '/Users/genevieb/Documents/GitHub/mkdocs-example-2/docs/examples' is not in the subpath of '/Users/genevieb/Documents/GitHub/mkdocs-example-2/docs/docs' OR one path is relative and the other is absolute.
What to do?
Either the mkdocs-gallery documentation should be updated, or a change made to the code so this behaviour is supported.
It's probably easiest to update the docs page than to change the code - I had a look at it but am having a hard time with interactive debugging. The easiest starting point for me is mkdocs build but I can't easily drop into the python debugger when it hits an error. I can maybe try to call the mkdocs build function from python directly, but then I need to also set up the mkdocs config object to pass in and it's not as convenient. Is there an easier way I should try?
The text was updated successfully, but these errors were encountered:
Thanks @GenevieveBuckley ! I wish all issue reports would be as nice, well-structured and undestandable as this :)
Inteactive debugging is indeed mandatory to develop. In PyCharm you can do create a run/debug configuration with module name mkdocs.__main__ and parameter build like this:
EDIT: note that you may wish to select mkdocs-gallery\.nox\tests-3-9\Scripts\python.exe as the Python interpreter used to debug this project as shown below
The mkdcos-gallery webpage says that you can have your source gallery examples folder located either inside or outside the base mkdocs docs directory. But when I try to put the examples outside the docs directory, I get an error.
Situation
The mkdocs-gallery docs main page says:
To reproduce
After checking that the build succeeds, you can delete the generated docs content:
What happened
A value error is raised at this line:
mkdocs-gallery/src/mkdocs_gallery/plugin.py
Line 250 in 68791f5
Full error message:
What to do?
Either the mkdocs-gallery documentation should be updated, or a change made to the code so this behaviour is supported.
It's probably easiest to update the docs page than to change the code - I had a look at it but am having a hard time with interactive debugging. The easiest starting point for me is
mkdocs build
but I can't easily drop into the python debugger when it hits an error. I can maybe try to call the mkdocs build function from python directly, but then I need to also set up the mkdocs config object to pass in and it's not as convenient. Is there an easier way I should try?The text was updated successfully, but these errors were encountered: