package module not recognized in gh-action #319
-
Hello, src/
├── nmrplot
│ ├── core.py
│ ├── __init__.py
│ ├── __main__.py
│ └── _version.py using mkdocs 1.2.2, mkdocstrings 0.15.2 and the following configuration: site_name: miguelarbesu/nmrplot
repo_name: miguelarbesu/nmrplot
repo_url: https://github.com/miguelarbesu/nmrplot
theme:
name: material
palette:
primary: blue grey
icon:
repo: fontawesome/brands/github
features:
- navigation.tabs
- navigation.tabs.sticky
plugins:
- search
- mkdocstrings:
watch:
- src/nmrplot when I do it locally it all looks fine and all info from However, when running the following gh-action: name: Build documentation
on:
pull_request:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.x
- run: |
pip install --upgrade pip
pip install mkdocs-material
pip install mkdocstrings
pip install -e .
mkdocs gh-deploy --force somehow the module is not recognized and fails to be deployed. ERROR - mkdocstrings.extension: module 'src.nmrplot' has no attribute 'core'
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/pytkdocs/cli.py", line 205, in main
output = json.dumps(process_json(line))
Aborted with a BuildError!
File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/pytkdocs/cli.py", line 114, in process_json
return process_config(json.loads(json_input))
File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/pytkdocs/cli.py", line 91, in process_config
obj = loader.get_object_documentation(path, members)
File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/pytkdocs/loader.py", line 353, in get_object_documentation
leaf = get_object_tree(dotted_path, self.new_path_syntax)
File "/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/pytkdocs/loader.py", line 269, in get_object_tree
obj = getattr(current_node.obj, obj_name)
AttributeError: module 'src.nmrplot' has no attribute 'core'
ERROR - Error reading page 'nmrplot-doc.md':
ERROR - Could not collect 'nmrplot.core'
Error: Process completed with exit code 1. I tried changing the corresponding nmrplot-doc.md in different ways:
but none worked in the gh-action (although they did locally). I wonder if there is a specific configuration for gh-actions that I am missing. Thank you in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hello @miguelarbesu, very sorry for the late reply 🙇♂️ The right way to reference your core module in the autodoc instruction is
Please check that all dependencies are properly installed (or mock them), and after that if it still does not work, try to add the |
Beta Was this translation helpful? Give feedback.
-
As you opened this as a question, I'll move this issue to discussions 🙂 |
Beta Was this translation helpful? Give feedback.
-
Thank you for the reply, @pawamoy! I hadn't realized that all my package dependencies should be satisfied or mocked for building the docs. I have moved all dependencies to a requirements-dev.txt file and have the action install them, so simply
replaces all previous installs. |
Beta Was this translation helpful? Give feedback.
Thank you for the reply, @pawamoy! I hadn't realized that all my package dependencies should be satisfied or mocked for building the docs.
I have moved all dependencies to a requirements-dev.txt file and have the action install them, so simply
replaces all previous installs.