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

fix(doc): Fix build of doc and return error on warning #63

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

mlec1
Copy link
Contributor

@mlec1 mlec1 commented Sep 15, 2024

This fix the build of the documentation.

As you can see, the documentation is empty on prod: https://exoscale.github.io/python-exoscale/v2.html

This is because the build of the documentation failed in the last CI, but Sphinx considered it as a warning. Therefore the job in the pipeline was not failing.

root@d662111d295e:/exo# make html
Running Sphinx v7.4.7
loading translations [en]... done
building [mo]: targets for 0 po files that are out of date
writing output... 
building [html]: targets for 3 source files that are out of date
updating environment: [new config] 3 added, 0 changed, 0 removed
reading sources... [100%] v2
WARNING: autodoc: failed to import module 'v2' from module 'exoscale.api'; the following exception was raised:
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/sphinx/ext/autodoc/importer.py", line 143, in import_module
    return importlib.import_module(modname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/exo/exoscale/api/v2.py", line 371, in <module>
    Client = _create_client_class()
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/exo/exoscale/api/v2.py", line 364, in _create_client_class
    class_attributes[py_operation_name] = _create_operation_call(
                                          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/exo/exoscale/api/v2.py", line 317, in _create_operation_call
    ret=_return_docstring(operation),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/exo/exoscale/api/v2.py", line 211, in _return_docstring
    typ = _type_translations[item["type"]]
          ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'number'

looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
copying assets... 
copying static files... done
copying extra files... done
copying assets: done
writing output... [100%] v2
generating indices... done
writing additional pages... search done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 1 warning.

For the job to fail in the pipeline in the future, I add the --fail-on-warning option.

I also fix the build by adding the missing type in the _type_translations dict.

@brutasse brutasse merged commit 3af22e9 into exoscale:master Oct 11, 2024
@brutasse
Copy link
Member

Thanks @mlec1!

@mlec1 mlec1 deleted the fix-build-doc branch October 11, 2024 16:08
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 this pull request may close these issues.

2 participants