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

feat(fmt): Support .ipynb extension #21310

Merged
merged 8 commits into from
Nov 27, 2023
Merged

Conversation

scarf005
Copy link
Contributor

@scarf005 scarf005 commented Nov 23, 2023

Summary

outdated

changed to using dprint's jupyter plugin

Questions

Extracting structs

I'm not sure if cli/tools/fmt.rs is the correct place for 4 struct for jupyter notebook definition. Which module should i move the structs to?

Checking whether it's TypeScript notebook

not sure which field is the best. currently using
self.metadata.language_info.name == "typescript"

Frequent rebuilds

I'm suspecting include_str! macro is busting incremental build caches.

mutation vs cloning

iterating twice (first: format cells, second: check if changes are identical) sounds inefficient, but i'm slightly against using mutation here.

serde(flatten) is unstable

$ cargo run --features __runtime_js_sources -- fmt cli/tests/testdata/fmt/badly_formatted_fixed.ipynb
$ cargo test --features __runtime_js_sources integration::fmt

EDIT: fixed by changing from HashMap to BTreeMap.

related: https://old.reddit.com/r/rust/comments/krgvcu/is_the_iteration_order_of_hashset_deterministic/

@scarf005 scarf005 changed the title feat(cli/fmt): support .ipynb extension feat(cli/fmt): Support .ipynb extension Nov 23, 2023
@scarf005 scarf005 changed the title feat(cli/fmt): Support .ipynb extension feat(fmt): Support .ipynb extension Nov 23, 2023
@scarf005 scarf005 marked this pull request as ready for review November 23, 2023 12:56
@scarf005 scarf005 force-pushed the feat-fmt-ipynb branch 3 times, most recently from e5c7248 to 9048d16 Compare November 23, 2023 13:34
Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

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

Nice start and thanks for doing this!

scarf005 added a commit to scarf005/deno that referenced this pull request Nov 24, 2023

Verified

This commit was signed with the committer’s verified signature.
KinectTheUnknown David-Joseph Xayavong
from: denoland#21310 (comment)

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
scarf005 added a commit to scarf005/deno that referenced this pull request Nov 24, 2023

Verified

This commit was signed with the committer’s verified signature.
KinectTheUnknown David-Joseph Xayavong
from: denoland#21310 (comment)

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
@scarf005 scarf005 requested a review from dsherret November 24, 2023 02:35
scarf005 added a commit to scarf005/deno that referenced this pull request Nov 24, 2023

Verified

This commit was signed with the committer’s verified signature.
KinectTheUnknown David-Joseph Xayavong
from: denoland#21310 (comment)

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
scarf005 added a commit to scarf005/deno that referenced this pull request Nov 24, 2023

Verified

This commit was signed with the committer’s verified signature.
KinectTheUnknown David-Joseph Xayavong
from: denoland#21310 (comment)

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
dsherret added a commit that referenced this pull request Nov 24, 2023

Verified

This commit was signed with the committer’s verified signature.
KinectTheUnknown David-Joseph Xayavong
This is to reduce duplicate dependencies for
#21310
Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

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

Looks good to me overall. Just some small changes. Would you be able to merge in the latest main in order to recreate the lockfile? It will have less duplicate dependencies now because of #21330

Verified

This commit was signed with the committer’s verified signature.
KinectTheUnknown David-Joseph Xayavong

Verified

This commit was signed with the committer’s verified signature.
KinectTheUnknown David-Joseph Xayavong

Verified

This commit was signed with the committer’s verified signature.
KinectTheUnknown David-Joseph Xayavong

Verified

This commit was signed with the committer’s verified signature.
KinectTheUnknown David-Joseph Xayavong
scarf005 added a commit to scarf005/deno that referenced this pull request Nov 25, 2023

Verified

This commit was signed with the committer’s verified signature.
KinectTheUnknown David-Joseph Xayavong
from: denoland#21310 (comment)

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
scarf005 and others added 2 commits November 25, 2023 16:06

Verified

This commit was signed with the committer’s verified signature.
KinectTheUnknown David-Joseph Xayavong
from: denoland#21310 (comment)

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>

Verified

This commit was signed with the committer’s verified signature.
KinectTheUnknown David-Joseph Xayavong
@scarf005 scarf005 requested a review from dsherret November 25, 2023 07:41
Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks a lot @scarf005!

@dsherret dsherret merged commit 2b7e145 into denoland:main Nov 27, 2023
@scarf005 scarf005 deleted the feat-fmt-ipynb branch November 27, 2023 23:32
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.

format jupyter notebook files
2 participants