Closed JayaramaKrishnaGudipati closed 1 year ago
Hi @adrienbrignon,
I see this as some plugin issue, could you please verify once and confirm with your thoughts on this issue.
Thanks
Hello @JayaramaKrishnaGudipati,
Thank you for submitting an issue.
Could you please assist me in debugging this problem by sharing your mkdocs.yml
configuration file and any other details you consider relevant?
Thanks
Thank you @adrienbrignon for responding on the issue.
I have an mkdocs.yml file with extensions and other plugins included in it. There is a separate mkdocs-pdf.yml file which we are including for pdf generation and this file inherits mkdocs.yml file. The only change I have done in this file is, I have replaced "with-pdf" plugin with "mkdocs exporter" plugin and used the given style sheets, buttons after that I see the given error message.
This is the mkdocs-pdf.yml file used for processing the pdf generation,
INHERIT: mkdocs.yml
plugins: mkdocs/exporter: mkdocs/exporter/pdf: concurrency: 8 covers: front: resources/templates/covers/front.html.j2 stylesheets:
mkdocs/exporter/extras: buttons:
Please let me know if you need more details,
Thanks
Thank you @JayaramaKrishnaGudipati for the details.
Unfortunately, I am not able to reproduce your issue. Could you please provide me with some more details?
mkdocs.yml
configurationmkdocs
installedAlso, by the way the button is defined in your configuration file; it makes me wonder if you're using the latest version of this plugin.
Could you try updating it to version 2.0.1
if you haven't already?
Thanks
Hi @adrienbrignon,
Thanks for contributing the new version, I have updated the version to 2.0.1 and tried, I see the same issue, Please find the below full details of mkdocs.yml and on the error message.
mkdocs version: 1.4.2
INHERIT: mkdocs-nav.yml
# --- site configuration ---
site_name: 'use-mkdocs'
site_url: !!python/object/apply:os.getenv ["SITE_URL"]
repo_name: !!python/object/apply:os.getenv ["CI_PROJECT_PATH"]
repo_url: !!python/object/apply:os.getenv ["CI_PROJECT_URL"]
edit_uri: edit/main/
# --- site configuration ---
docs_dir: .
use_directory_urls: false
theme:
name: #company theme
include_search_page: false
search_index_only: true
language: en
palette:
- scheme: default
primary: teal
accent: teal
features:
- page.toc
- navigation.tabs
- navigation.tabs.sticky
- navigation.tertiary
- navigation.top
- navigation.expand
extra:
generator: false
page_license_text: ' '
version:
provider: mike
markdown_extensions:
abbr: {}
admonition: {}
attr_list: {}
codehilite:
guess_lang: true
linenums: true
def_list: {}
footnotes: {}
markdown_include.include:
base_path: docs
markdown_katex: {}
md_in_html: {}
meta: {}
pymdownx.arithmatex:
generic: true
pymdownx.betterem:
smart_enable: all
pymdownx.caret: {}
pymdownx.critic:
mode: accept
pymdownx.details: {}
pymdownx.emoji:
emoji_generator: !!python/name:pymdownx.emoji.to_svg
pymdownx.highlight:
linenums: true
linenums_style: pymdownx-inline
pymdownx.inlinehilite: {}
pymdownx.keys: {}
pymdownx.magiclink: {}
pymdownx.mark: {}
pymdownx.smartsymbols: {}
pymdownx.snippets: {}
pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_code_format
pymdownx.tabbed: {}
pymdownx.tasklist: {}
pymdownx.tilde: {}
toc:
permalink: '#'
plugins:
search:
indexing: 'full'
macros: {}
multirepo:
cleanup: false
temp_dir: .deps
Traceback (most recent call last):
File "/usr/local/bin/mkdocs", line 8, in <module>
sys.exit(cli())
^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/mkdocs/__main__.py", line 2[50](https://code.siemens.com/reusable-ci/include/use-mkdocs/-/jobs/120865145#L50), in build_command
build.build(cfg, dirty=not clean)
File "/usr/local/lib/python3.11/site-packages/mkdocs/commands/build.py", line 332, in build
config.plugins.run_event('post_build', config=config)
File "/usr/local/lib/python3.11/site-packages/mkdocs/plugins.py", line 522, in run_event
result = method(**kwargs)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/mkdocs_exporter/plugins/pdf/plugin.py", line 141, in on_post_build
loop = asyncio.get_event_loop()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/events.py", line [67](https://code.siemens.com/reusable-ci/include/use-mkdocs/-/jobs/120865145#L67)7, in get_event_loop
raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'MainThread'.
###########################################################################################
INHERIT: mkdocs.yml
theme:
name: 'material'
plugins:
mkdocs/exporter:
mkdocs/exporter/pdf:
concurrency: 8
covers:
front: resources/templates/covers/front.html.j2
stylesheets:
- resources/stylesheets/pdf.scss
mkdocs/exporter/extras:
buttons:
- title: Download as PDF
enabled: !!python/name:mkdocs_exporter.plugins.pdf.button.enabled
icon: !!python/name:mkdocs_exporter.plugins.pdf.button.icon
href: !!python/name:mkdocs_exporter.plugins.pdf.button.href
download: !!python/name:mkdocs_exporter.plugins.pdf.button.download
#########################################################################################
We are actually using a different theme designed by our company for mkdocs and initially when I used this new version (2.0.1) plugin it has given an error message that this theme was not supported, then I changed to "material" theme (which we are following for pdf generation) and I see the same asyncio error message.
Please suggest to fix this issue and proceed further.
Thanks
Hello again @JayaramaKrishnaGudipati,
Thank you for the precious details you've provided.
I'll investigate further and get back to you with a solution.
At the moment, I'm thinking that it may be a compatibility issue with the multirepo
plugin as it uses some asyncio
features too.
In the meantime, could you please try to update to the v3.0.1
version?
This new serie of releases features an attempt to fix the issue you are currently experiencing (There is no current event loop in thread...
) and support for custom themes, as long as they are based on a officially supported one (which are, at the time of writing: material
and readthedocs
).
For instance, if your custom theme is called company
and is itself based on the material
one, you could configure MkDocs like this:
theme:
name: company
plugins:
- mkdocs/exporter:
theme: material
- mkdocs/exporter/pdf:
concurrency: 8
Please note the theme
key of the mkdocs/exporter
plugin's configuration.
Finally, thank you for taking the time to contribute to this discussion; you're helping me making this plugin better and for that, I am truly grateful.
Hey @JayaramaKrishnaGudipati,
First of all, sorry for the notifications!
I've just released the 3.0.2
version that should resolve the compatibility issues between the multirepo
plugin and this one.
Could you please upgrade and let me know if the issue is resolved?
Thanks
Hello @adrienbrignon
No Problem, its my pleasure to work with you on this issue. I'm happy to contribute to your plugin. Thanks for your detailed instructions.
I have upgraded the version to 3.0.2 and I see the get_event_loop issue is resolved but I see some error on "playwright" as shown below, I have even upgraded the playwright version from 1.33.0 to 1.34.0
Traceback (most recent call last):
File "/usr/local/bin/mkdocs", line 8, in
Please let me know how to resolve this above error and proceed further.
The mkdocs file is working and proceeding further till the playwright issue as describe above if the theme was declared like this,
INHERIT: mkdocs.yml
theme: name: 'material'
plugins: mkdocs/exporter: mkdocs/exporter/pdf: concurrency: 8 covers: front: resources/templates/covers/front.html.j2 stylesheets:
If it was given like the below one, I see the job is stopping with config error,
INHERIT: mkdocs.yml
plugins: mkdocs/exporter: theme:'material' mkdocs/exporter/pdf: concurrency: 8 covers: front: resources/templates/covers/front.html.j2 stylesheets:
ERROR - Config value 'plugins': Invalid config options for the 'mkdocs/exporter' plugin. Aborted with 1 Configuration Errors!
Thanks
Hey @JayaramaKrishnaGudipati,
Thank you, I'm glad to hear that the get_event_loop
issues are resolved!
For your current issue, it seems that Playwright is not fully installed.
Could you please try running the following command:
playwright install --with-deps
What this command does basically, is:
Thanks
Hi @adrienbrignon,
I actually installed and upgraded the playwright python package with version 1.34.0. The program I'm working on will be executed in a CI pipeline as a job from a GitLab runner with all the given package dependencies. I'm not sure where else this installation you have suggested need to be performed. Sorry for the continuous queries. :)
Please let me know where this installation need to be done.
Thanks.
No problem.
Typically, you'll need to run this command after installing dependencies (via pip
for instance).
Then, you should be able to generate PDF documents.
This project features a Dockerfile and a GitHub Workflow that do perform this procedure (some commands are defined in this Makefile), feel free to draw inspiration from them.
To sum things up:
pip
, poetry
...)playwright install --with-deps
)Hey @adrienbrignon ,
I tried updating the playwright installation in the docker image, I faced the below issue, looks like the image is distributing debain version of linux and here I see it supports only on Ubuntu. Please share your thoughts if there is any other work around to proceed with this playwright.
Warning: The file chosen for install of fonttools 4.39.1 (fonttools-4.39.1-py3-none-any.whl) is yanked. Reason for being yanked: regression when building VF with STAT from DesignSpace v5:https://github.com/fonttools/fonttools/issues/3045 ++ arch
Thanks
Hey @JayaramaKrishnaGudipati,
As a potential workaround, you could use a container based on Ubuntu to build your documentation. For official Debian support by Playwright, I would head to their issue tracker.
I will now close this issue as it is resolved.
Again, thank you for your collaboration in fixing this issue, it is very much appreciated.
Hi,
I have recently switched from mkdocs-with-pdf plugin to your plugin, first I would like to thank you for the contribution. The below error message is not allowing to proceed further,
File "/usr/local/lib/python3.11/site-packages/mkdocs_exporter/plugins/pdf/plugin.py", line 141, in on_post_build loop = asyncio.get_event_loop() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/events.py", line 677, in get_event_loop raise RuntimeError('There is no current event loop in thread %r.' RuntimeError: There is no current event loop in thread 'MainThread'.
Could you please check on this one and kindly support to resolve the issue.