Skip to content

feat(fmt): add black[jupyter] as a formatting tool #7256

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

SauravMaheshkar
Copy link

@SauravMaheshkar SauravMaheshkar commented Apr 9, 2025

Fixes #3976. Also includes the changes introduced by running black with the jupyter extension

The repository has grown considerably since I last saw it, so I'm not sure I made changes everywhere. LMK if I'm missing something.

Request for Review: @mhucka

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@pavoljuhas pavoljuhas added the priority/after-1.5 Leave for after the Cirq 1.5 release label Apr 9, 2025
@pavoljuhas
Copy link
Collaborator

@SauravMaheshkar - thank you for the contribution! We are currently finalizing last changes for the upcoming stable release, so just a heads up we'll need to hold this up until after the release.

@mhucka mhucka added kind/health For CI/testing/release process/refactoring/technical debt items area/formatting labels Apr 9, 2025
Copy link

codecov bot commented Apr 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.64%. Comparing base (8c8a21a) to head (088a3b8).
Report is 18 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7256   +/-   ##
=======================================
  Coverage   98.64%   98.64%           
=======================================
  Files        1106     1106           
  Lines       95990    95990           
=======================================
+ Hits        94691    94692    +1     
+ Misses       1299     1298    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -130,7 +130,7 @@ echo "Running the black formatter... (version: $BLACKVERSION)"

args=("${arg_color[@]}")
if (( only_print == 1 )); then
args+=("--check" "--diff")
args+=("--check" "--diff" "--ipynb")
Copy link
Collaborator

Choose a reason for hiding this comment

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

The --ipynb option makes black execution fail as it considers all files to be jupyter notebooks. Please remove.

The format_files array needs to include the .ipynb files to get them checked and formatted. Please make sure these do not leak to isort_files, because isort does not seem to work with notebooks. For now, let isort look only at the python files.

Copy link
Collaborator

@pavoljuhas pavoljuhas left a comment

Choose a reason for hiding this comment

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

Please split this to two PRs for (i) script and requirements update and (ii) notebook formatting. It will make it easier to review the human-written code, and the second formatting-only PR can be then added to .git-blame-ignore-revs.

Also, please address inline comments.

@github-actions github-actions bot added the size: XL lines changed >1000 label Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/formatting kind/health For CI/testing/release process/refactoring/technical debt items priority/after-1.5 Leave for after the Cirq 1.5 release size: XL lines changed >1000
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Jupyter-black to check/format
3 participants