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

Docs builds for GridInteractionLayer and XebResultDict are broken #5166

Closed
MichaelBroughton opened this issue Mar 30, 2022 · 1 comment · Fixed by #5250
Closed

Docs builds for GridInteractionLayer and XebResultDict are broken #5166

MichaelBroughton opened this issue Mar 30, 2022 · 1 comment · Fixed by #5250
Labels
kind/bug-report Something doesn't seem to work. triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on

Comments

@MichaelBroughton
Copy link
Collaborator

Description of the issue
Currently we cannot run the build_api_docs.py and build the API docs for GridInteractionLayer or XebResultDict.

How to reproduce the issue

diff --git a/dev_tools/docs/build_api_docs.py b/dev_tools/docs/build_api_docs.py
index e3f0c79a..076a4acc 100644
--- a/dev_tools/docs/build_api_docs.py
+++ b/dev_tools/docs/build_api_docs.py
@@ -95,6 +95,11 @@ def generate_cirq():
         site_path=FLAGS.site_path,
         callbacks=[public_api.local_definitions_filter, filter_unwanted_inherited_methods],
         extra_docs=_doc.RECORDED_CONST_DOCS,
+        private_map={
+            # Opt to not build docs for these paths for now since they error.
+            "cirq.experiments": ["CrossEntropyResultDict", "GridInteractionLayer"],
+            "cirq.experiments.random_quantum_circuit_generation": ["GridInteractionLayer"],
+        },
     )

Removing the private_map entry in build_api_docs.py above and then running the build script gives:

Traceback (most recent call last):
  File "/home/mbbrough/Desktop/cirq_env/lib/python3.9/site-packages/tensorflow_docs/api_generator/generate_lib.py", line 546, in write_docs
    page_info = docs_for_object.docs_for_object(
  File "/home/mbbrough/Desktop/cirq_env/lib/python3.9/site-packages/tensorflow_docs/api_generator/pretty_docs/docs_for_object.py", line 89, in docs_for_object
    page_info.docs_for_object(parser_config)
  File "/home/mbbrough/Desktop/cirq_env/lib/python3.9/site-packages/tensorflow_docs/api_generator/pretty_docs/base_page.py", line 164, in docs_for_object
    self.collect_docs(parser_config)
  File "/home/mbbrough/Desktop/cirq_env/lib/python3.9/site-packages/tensorflow_docs/api_generator/pretty_docs/class_page.py", line 384, in collect_docs
    self._add_member(member_info, defining_class, parser_config)
  File "/home/mbbrough/Desktop/cirq_env/lib/python3.9/site-packages/tensorflow_docs/api_generator/pretty_docs/class_page.py", line 337, in _add_member
    self._add_method(member_info, defining_class, parser_config)
  File "/home/mbbrough/Desktop/cirq_env/lib/python3.9/site-packages/tensorflow_docs/api_generator/pretty_docs/class_page.py", line 277, in _add_method
    signature = signature_lib.generate_signature(
  File "/home/mbbrough/Desktop/cirq_env/lib/python3.9/site-packages/tensorflow_docs/api_generator/signature.py", line 589, in generate_signature
    return_annotation_source) = extract_fn(func)
  File "/home/mbbrough/Desktop/cirq_env/lib/python3.9/site-packages/tensorflow_docs/api_generator/signature.py", line 624, in _extract_class_defaults_and_annotations
    ast_visitor.extract(cls)
  File "/home/mbbrough/Desktop/cirq_env/lib/python3.9/site-packages/tensorflow_docs/api_generator/signature.py", line 140, in extract
    super().extract(cls)
  File "/home/mbbrough/Desktop/cirq_env/lib/python3.9/site-packages/tensorflow_docs/api_generator/signature.py", line 58, in extract
    obj_source = textwrap.dedent(inspect.getsource(obj))
  File "/usr/lib/python3.9/inspect.py", line 1024, in getsource
    lines, lnum = getsourcelines(object)
  File "/usr/lib/python3.9/inspect.py", line 1006, in getsourcelines
    lines, lnum = findsource(object)
  File "/usr/lib/python3.9/inspect.py", line 851, in findsource
    raise OSError('could not find class definition')
OSError: could not find class definition

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/mbbrough/Desktop/Cirq/dev_tools/docs/build_api_docs.py", line 220, in <module>
    app.run(main)
  File "/home/mbbrough/Desktop/cirq_env/lib/python3.9/site-packages/absl/app.py", line 312, in run
    _run_main(main, args)
  File "/home/mbbrough/Desktop/cirq_env/lib/python3.9/site-packages/absl/app.py", line 258, in _run_main
    sys.exit(main(argv))
  File "/home/mbbrough/Desktop/Cirq/dev_tools/docs/build_api_docs.py", line 79, in main
    generate_cirq()
  File "/home/mbbrough/Desktop/Cirq/dev_tools/docs/build_api_docs.py", line 106, in generate_cirq
    doc_generator.build(output_dir=FLAGS.output_dir)
  File "/home/mbbrough/Desktop/cirq_env/lib/python3.9/site-packages/tensorflow_docs/api_generator/generate_lib.py", line 847, in build
    write_docs(
  File "/home/mbbrough/Desktop/cirq_env/lib/python3.9/site-packages/tensorflow_docs/api_generator/generate_lib.py", line 559, in write_docs
    raise ValueError(
ValueError: Failed to generate docs for symbol: `cirq.experiments.GridInteractionLayer`

Cirq version

0.15.0dev
@MichaelBroughton MichaelBroughton added kind/bug-report Something doesn't seem to work. triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on time/before-1.0 labels Mar 30, 2022
@maffoo
Copy link
Contributor

maffoo commented Apr 12, 2022

The docs for these symbols seem to generate fine with a newer versions of tensorflow-docs (I tried 3a6a7a3322de8620f0031ae3a0a4b62e40d1d7f2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug-report Something doesn't seem to work. triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants