Skip to content

Conversation

shreve
Copy link
Contributor

@shreve shreve commented May 9, 2025

This change tries to modernize the way we handle paths in nbgrader by using pathlib.Path and centralizing logic for searching and extracting information from paths into CourseDirectory.

By using Path(root).glob(pat) instead of glob.glob(root / pat), we can avoid some issues of needing to escape CourseDirectory.root because the glob will be scoped underneath a fixed path.

Introduces a new CourseDirectory.find_assignments method to help locate assignment directories across steps and students.

Fixes #1965

Copy link
Contributor

github-actions bot commented May 9, 2025

Binder 👈 Launch a Binder on branch shreve/nbgrader/safer-paths

This change tries to modernize the way we handle paths in nbgrader
by using pathlib.Path and centralizing logic for searching and
extracting information from paths into CourseDirectory.

By using `Path(root).glob(pat)` instead of `glob.glob(root / pat)`, we
can avoid some issues of needing to escape CourseDirectory.root because
the glob will be scoped underneath a fixed path.

Introduces a new `CourseDirectory.find_assignments` method to help
locate assignment directories across steps and students.

Fixes jupyter#1965
@shreve shreve force-pushed the safer-paths branch 4 times, most recently from 366ae5b to e538517 Compare May 9, 2025 22:28
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.

Formgrader does not find assignments when path contains aquare brackets
1 participant