Skip to content

Refactor notebook glob expansion to use filesystem-driven matching#21

Open
Achal1607 wants to merge 1 commit intomainfrom
codex/add-glob-support-for-classpath-in-notebooks
Open

Refactor notebook glob expansion to use filesystem-driven matching#21
Achal1607 wants to merge 1 commit intomainfrom
codex/add-glob-support-for-classpath-in-notebooks

Conversation

@Achal1607
Copy link
Copy Markdown
Owner

Motivation

  • Fix brittle hardcoded glob-character detection and incorrect glob expansion so notebook classpath/modulepath relative patterns resolve consistently and expand to concrete file paths before launch.
  • Prefer using the real filesystem and PathMatcher rather than manual regex parsing and ad-hoc prefix handling for more robust glob support.

Description

  • Replaced character-based glob detection with parsing each entry into a Path and checking filesystem existence in NotebookUtils.expandGlobPaths so existing paths are preserved and non-existing entries are considered for expansion.
  • Added expandGlobEntry(String pattern, Path entryPath) which locates the nearest existing ancestor via findExistingRoot and uses FileSystems.getDefault().getPathMatcher("glob:" + pattern) to match candidates under that root.
  • Updated NotebookConfigs to call NotebookUtils.expandGlobPaths when building classPath and modulePath so configuration entries are expanded consistently.
  • Preserved original entry when parsing fails or when a glob yields no matches and handled invalid paths/missing roots gracefully.

Testing

  • Added unit tests NotebookUtilsTest.testExpandGlobPaths to exercise filesystem glob expansion and NotebookConfigsTest.testGlobExpansionForNotebookPaths to validate integration with configuration initialization.
  • No automated test suite was executed as part of this change (tests were added but not run).

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant