Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automodule fails to render docstring for plotting scripts #140

Closed
jnnr opened this issue Feb 16, 2022 · 4 comments · Fixed by rl-institut/oemoflex#56
Closed

Automodule fails to render docstring for plotting scripts #140

jnnr opened this issue Feb 16, 2022 · 4 comments · Fixed by rl-institut/oemoflex#56
Assignees
Milestone

Comments

@jnnr
Copy link
Collaborator

jnnr commented Feb 16, 2022

First mentioned in #119 (comment). E.g. https://oemof-b3.readthedocs.io/en/latest/plotting/plot_dispatch.html

@jnnr
Copy link
Collaborator Author

jnnr commented Feb 16, 2022

This is the relevant part of the error message from https://readthedocs.org/projects/oemof-b3/builds/16107009/

/home/docs/checkouts/readthedocs.org/user_builds/oemof-b3/checkouts/features-update-docs/docs/model_structure.rst:5: WARNING: Duplicate explicit target name: "oemoflex".
WARNING: autodoc: failed to import module 'plot_dispatch'; the following exception was raised:
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/oemof-b3/envs/features-update-docs/lib/python3.7/site-packages/sphinx/ext/autodoc/importer.py", line 70, in import_module
    return importlib.import_module(modname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/oemof-b3/envs/features-update-docs/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/docs/checkouts/readthedocs.org/user_builds/oemof-b3/checkouts/features-update-docs/scripts/plot_dispatch.py", line 30, in <module>
    import oemoflex.tools.plots as plots
  File "/home/docs/checkouts/readthedocs.org/user_builds/oemof-b3/envs/features-update-docs/lib/python3.7/site-packages/oemoflex/tools/plots.py", line 13, in <module>
    default_labels_dict = helpers.load_yaml(os.path.join(dir_name, "labels.yaml"))
  File "/home/docs/checkouts/readthedocs.org/user_builds/oemof-b3/envs/features-update-docs/lib/python3.7/site-packages/oemoflex/tools/helpers.py", line 9, in load_yaml
    with open(file_path, "r") as yaml_file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/docs/checkouts/readthedocs.org/user_builds/oemof-b3/envs/features-update-docs/lib/python3.7/site-packages/oemoflex/tools/labels.yaml'

WARNING: autodoc: failed to import module 'plot_joined_scalars'; the following exception was raised:
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/oemof-b3/envs/features-update-docs/lib/python3.7/site-packages/sphinx/ext/autodoc/importer.py", line 70, in import_module
    return importlib.import_module(modname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/oemof-b3/envs/features-update-docs/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/docs/checkouts/readthedocs.org/user_builds/oemof-b3/checkouts/features-update-docs/scripts/plot_joined_scalars.py", line 25, in <module>
    import oemoflex.tools.plots as plots
  File "/home/docs/checkouts/readthedocs.org/user_builds/oemof-b3/envs/features-update-docs/lib/python3.7/site-packages/oemoflex/tools/plots.py", line 13, in <module>
    default_labels_dict = helpers.load_yaml(os.path.join(dir_name, "labels.yaml"))
  File "/home/docs/checkouts/readthedocs.org/user_builds/oemof-b3/envs/features-update-docs/lib/python3.7/site-packages/oemoflex/tools/helpers.py", line 9, in load_yaml
    with open(file_path, "r") as yaml_file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/docs/checkouts/readthedocs.org/user_builds/oemof-b3/envs/features-update-docs/lib/python3.7/site-packages/oemoflex/tools/labels.yaml'

WARNING: autodoc: failed to import module 'plot_conv_pp'; the following exception was raised:
No module named 'plot_conv_pp'

@henhuy
Copy link
Collaborator

henhuy commented Mar 1, 2022

When installing oemoflex via pip, files like *.csv or *.yaml are not copied into package folder.
This leads to above FileNotFoundError!
In order to copy those files you have to add a MANIFEST.in where you have a list of all files which shall be included (see https://stackoverflow.com/a/59695898/5804947)
I will add such file with related files...

@henhuy
Copy link
Collaborator

henhuy commented Mar 1, 2022

Could be fixed with mentioned PR - please review, merge and test if error is gone!

@jnnr
Copy link
Collaborator Author

jnnr commented Mar 1, 2022

@henhuy: The problem is solved - the docstrings are build. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants