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 notebook code formatting #330

Merged
merged 2 commits into from
Oct 17, 2024
Merged

Conversation

davidorme
Copy link
Collaborator

@davidorme davidorme commented Oct 16, 2024

Description

This updates markdown notebook metadata to make sure {code-cell} block language info is retained, mostly for syntax colouring within VSCode. See #329 for details but basically our jupytext --pipe black pre-commit step was doing a great job of keeping the python code in notebooks formatted but kept stripping out the cell language information used to set the pygments lexing in VSCode.

  • Add retaining the language_info notebook metadata to the project settings.
  • Add that language_info metadata to the files (at the moment this is manual or open and save in jupyter after step 1)
  • Check {code-cell} ipython3 is used across code cells.

This is partly fixed on #328 but all the small file changes there are just cluttering that branch with lots of out of scope noise, so the plan is to fix it properly and then declutter #328.

Fixes #329

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist

  • Make sure you've run the pre-commit checks: $ pre-commit run -a
  • All tests pass: $ poetry run pytest

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@davidorme davidorme linked an issue Oct 16, 2024 that may be closed by this pull request
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.70%. Comparing base (1f315ba) to head (6accc05).
Report is 206 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #330      +/-   ##
===========================================
+ Coverage    95.29%   95.70%   +0.41%     
===========================================
  Files           28       34       +6     
  Lines         1720     2469     +749     
===========================================
+ Hits          1639     2363     +724     
- Misses          81      106      +25     

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

@davidorme davidorme requested a review from j-emberton October 16, 2024 13:08
Copy link
Collaborator

@j-emberton j-emberton left a comment

Choose a reason for hiding this comment

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

lgtm

@davidorme davidorme merged commit f2380be into develop Oct 17, 2024
12 checks passed
@davidorme davidorme deleted the 329-fix-notebook-code-formatting branch October 17, 2024 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Fix notebook code formatting
3 participants