backstage / backstage/mkdocs-monorepo-plugin
Error since pull request #74
- Dominant language
- Python
- Stars
- 400
- Forks
- 80
- PR merge metrics
- No merged PRs in 30d
Description
Hi
I just updated the monorepo plugin and the before working project now fails to serve/build. I could drill down the issue to the pull request #74 which added the `edit_uri.py` file.
When I comment the call `set_edit_url(config, page, self)` in the file `plugin.py` on line 71 the project builds fine.
The edit_uri is not set in my environment and even when setting it something it does not build. The problem seems to have a dependency to the mkdocs-static-i18n plugin that we also use. I don't know if the root cause of the problem is in th2 i18n plugin or in the mono repo plugin. The issue occured after updating the monorepo plugin.
It would be great if you could add some check to the code to skip the edit-url thing when there is no edit-url set to fix this for cases like mine. Below I attached the Treaceback to narrow the issue.
What do you think?
Thanks for your work and thoughts about this issue
Regards
Florian
```
ERROR - Error reading page 'manual_dev/index.md': join() missing 1 required positional argument: 'a'
Traceback (most recent call last):
File "/opt/homebrew/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/homebrew/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/opt/homebrew/lib/python3.9/site-packages/mkdocs/__main__.py", line 236, in
cli()
File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/opt/homebrew/lib/python3.9/site-packages/mkdocs/__main__.py", line 181, in serve_command
serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs)
File "/opt/homebrew/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 63, in serve
config = builder()
File "/opt/homebrew/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 58, in builder
build(config, live_server=live_server, dirty=dirty)
File "/opt/homebrew/lib/python3.9/site-packages/mkdocs/commands/build.py", line 317, in build
config['plugins'].run_event('post_build', config=config)
File "/opt/homebrew/lib/python3.9/site-packages/mkdocs/plugins.py", line 104, in run_event
result = method(**kwargs)
File "/opt/homebrew/lib/python3.9/site-packages/mkdocs_static_i18n/plugin.py", line 622, in on_post_build
_populate_page(file.page, config, files, dirty)
File "/opt/homebrew/lib/python3.9/site-packages/mkdocs/commands/build.py", line 163, in _populate_page
page = config['plugins'].run_event(
File "/opt/homebrew/lib/python3.9/site-packages/mkdocs/plugins.py", line 102, in run_event
result = method(item, **kwargs)
File "/opt/homebrew/lib/python3.9/site-packages/mkdocs_monorepo_plugin/plugin.py", line 71, in on_pre_page
set_edit_url(config, page, self)
File "/opt/homebrew/lib/python3.9/site-packages/mkdocs_monorepo_plugin/edit_uri.py", line 104, in set_edit_url
page.edit_url = edit_url.build()
File "/opt/homebrew/lib/python3.9/site-packages/mkdocs_monorepo_plugin/edit_uri.py", line 97, in build
if self.__has_repo():
File "/opt/homebrew/lib/python3.9/site-packages/mkdocs_monorepo_plugin/edit_uri.py", line 85, in __has_repo
page_config_file_yaml = self.__get_page_config_file_yaml()
File "/opt/homebrew/lib/python3.9/site-packages/mkdocs_monorepo_plugin/edit_uri.py", line 80, in __get_page_config_file_yaml
abs_page_config_file_path = self.__get_page_config_file_path()
File "/opt/homebrew/lib/python3.9/site-packages/mkdocs_monorepo_plugin/edit_uri.py", line 51, in __get_page_config_file_path
alias = self.__get_page_dir_alias()
File "/opt/homebrew/lib/python3.9/site-packages/mkdocs_monorepo_plugin/edit_uri.py", line 35, in __get_page_dir_alias
alias = path.join(*parts)
TypeError: join() missing 1 required positional argument: 'a'
```
Contributor guide
Research direction
Start at mkdocs_monorepo_plugin/plugin.py line 71 and follow set_edit_url into edit_uri.py, especially the path-building failure at line 35. Reproduce the reported build with mkdocs-static-i18n and no edit_uri setting, then verify that a build succeeds without an edit URL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100