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: add glob pattern matching to --paths #3373

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

Conversation

Harmuth94
Copy link
Contributor

@Harmuth94 Harmuth94 commented Nov 14, 2024

closing #3372

Using glob.glob to allow for pattern matching in the --paths argument.

@Harmuth94 Harmuth94 marked this pull request as draft November 14, 2024 10:36
@Harmuth94
Copy link
Contributor Author

To use wildcards enclose path in '' or ""

@Harmuth94 Harmuth94 marked this pull request as ready for review November 14, 2024 17:02
Path(t.cast(t.Union[str, Path], path)).absolute() for path in ensure_list(paths)
Path(t.cast(t.Union[str, Path], p)).absolute()
for path in ensure_list(paths)
for p in (glob.glob(str(path)) or [str(path)])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

glob.glob() returns None for absolute paths

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you share an example for this?

Copy link
Contributor Author

@Harmuth94 Harmuth94 Nov 15, 2024

Choose a reason for hiding this comment

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

Did some digging and it was not the absolute paths.

The issue is that glob.glob returns an empty list if the pattern doesn't match anything (This was the case for a few pytest cases). The load_configs function would return an unexpected empty dictionary and cause downstream issues.

Adding or [str(path)] for the non-existing path will enable the correct downstream invalidation of the path/config.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, seems reasonable.

@Harmuth94 Harmuth94 changed the title add wildcard add glob pattern matching to --paths Nov 15, 2024
@georgesittas georgesittas changed the title add glob pattern matching to --paths Feat: add glob pattern matching to --paths Nov 15, 2024
@georgesittas georgesittas requested a review from a team November 15, 2024 14: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.

2 participants