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

Remove id from top-level notebook structure. #5874

Merged
merged 2 commits into from
Oct 17, 2022
Merged

Conversation

markmcd
Copy link
Contributor

@markmcd markmcd commented Sep 14, 2022

nbformat currently barfs on this notebook as it has an id field set directly on the cell. They're expected under a metadata field, and this notebook already has them set on the metadata, so assuming they're otherwise unused I have removed them.

Here's the error, in case it helps:

E 2022-09-08 20:30:15.962852-070026 57758 __init__.py:80 Notebook JSON is invalid: Additional properties are not allowed ('id' was unexpected)

Failed validating 'additionalProperties' in code_cell:

On instance['cells'][0]:
{'cell_type': 'code',
 'execution_count': 1,
 'id': 'ee22a795',
 'metadata': {'cellView': 'form',
              'execution': {'iopub.execute_input': '2022-07-07T09:27:05.420016Z',
                            'iopub.status.busy': '2022-07-07T09:27:05.419434Z',
                            'iopub.status.idle': '2022-07-07T09:27:05.423857Z',
                            'shell.execute_reply': '2022-07-07T09:27:05.423255Z'},
              'id': '906e07f6e562'},
 'outputs': ['...0 outputs...'],
 'source': '# @title Copyright 2022 The Cirq Developers\n'
           '# Licensed under the...'}

`nbformat` currently barfs on this notebook as it has an `id` field set directly on the cell. They're expected under a `metadata` field, and this notebook already has them set on the metadata, so assuming they're otherwise unused I have removed them.

Here's the error, in case it helps:

```
E 2022-09-08 20:30:15.962852-070026 57758 __init__.py:80 Notebook JSON is invalid: Additional properties are not allowed ('id' was unexpected)

Failed validating 'additionalProperties' in code_cell:

On instance['cells'][0]:
{'cell_type': 'code',
 'execution_count': 1,
 'id': 'ee22a795',
 'metadata': {'cellView': 'form',
              'execution': {'iopub.execute_input': '2022-07-07T09:27:05.420016Z',
                            'iopub.status.busy': '2022-07-07T09:27:05.419434Z',
                            'iopub.status.idle': '2022-07-07T09:27:05.423857Z',
                            'shell.execute_reply': '2022-07-07T09:27:05.423255Z'},
              'id': '906e07f6e562'},
 'outputs': ['...0 outputs...'],
 'source': '# @title Copyright 2022 The Cirq Developers\n'
           '# Licensed under the...'}
```
@markmcd markmcd requested review from a team, vtomole and cduck as code owners September 14, 2022 05:17
@CirqBot CirqBot added the size: S 10< lines changed <50 label Sep 14, 2022
@markmcd markmcd requested a review from viathor September 14, 2022 05:17
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@markmcd
Copy link
Contributor Author

markmcd commented Sep 14, 2022

Failed Pytest looks like differences in floating point rounding, I'm guessing unrelated to this change?

@vtomole
Copy link
Collaborator

vtomole commented Oct 14, 2022

@markmcd What did you run to get this error? This passes on the master branch for me.

(cirq_venv) vtomole@vtomole:~/Cirq$ ./check/nbformat 
Notebooks are formatted.

Copy link
Collaborator

@vtomole vtomole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vtomole vtomole merged commit 7974c9a into quantumlib:master Oct 17, 2022
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
`nbformat` currently barfs on this notebook as it has an `id` field set directly on the cell. They're expected under a `metadata` field, and this notebook already has them set on the metadata, so assuming they're otherwise unused I have removed them.

Here's the error, in case it helps:

```
E 2022-09-08 20:30:15.962852-070026 57758 __init__.py:80 Notebook JSON is invalid: Additional properties are not allowed ('id' was unexpected)

Failed validating 'additionalProperties' in code_cell:

On instance['cells'][0]:
{'cell_type': 'code',
 'execution_count': 1,
 'id': 'ee22a795',
 'metadata': {'cellView': 'form',
              'execution': {'iopub.execute_input': '2022-07-07T09:27:05.420016Z',
                            'iopub.status.busy': '2022-07-07T09:27:05.419434Z',
                            'iopub.status.idle': '2022-07-07T09:27:05.423857Z',
                            'shell.execute_reply': '2022-07-07T09:27:05.423255Z'},
              'id': '906e07f6e562'},
 'outputs': ['...0 outputs...'],
 'source': '# @title Copyright 2022 The Cirq Developers\n'
           '# Licensed under the...'}
```

Co-authored-by: Victory Omole <vtomole2@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: S 10< lines changed <50
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants