question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

glob patterns for data_files

See original GitHub issue

Would be great to be able to use glob patterns for data_files, so that one can write something like this:

[options.data_files]
share/myapp/doc = doc/*.md

This would be consistent with the way package_data works.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
eli-schwartzcommented, Jun 27, 2021

The only invalid path on Unix is a null byte (and “/” cannot exist in filenames but validly denotes a directory separator).

It’s theoretically possible but highly unlikely people wanted a literal asterisk in their file names, but by the same token that “:” is illegal on Windows, and in fact also illegal even on Unix if you happen to be using fat32 or NTFS without the POSIX namespace (the restriction is part of the filesystem spec)…

… the asterisk is also illegal in filenames on Windows (and at the filesystem layer on fat32 and NTFS).

So, such code depending on literal asterisks would unexpectedly fail on Windows, and also on that one person’s USB drive used for copying around a personal python environment from Unix system to Unix system.

One could argue backwards compatibility with something inherently broken is not such an important priority, and even if someone did need that behavior, the asterisk would simply expand to multiple files including the one with the literal asterisk. So the package would collect too many files, but at least the desired file would in fact be there.

If we want to make it super unlikely for anyone to ever stumble across this by using some prefix marker like option 1, I don’t think ::glob:: provides additional utility over glob: which would have symmetry with existing directives like file:, attr:, find:, and find_namespace:.

1reaction
eli-schwartzcommented, Jul 1, 2021

Well, @pganssle’s concern was, I think, that people might be using the new directive and actually mean it to be a literal filename instead of a directive… the question is whether that’s a practical concern. So yeah, relatively safe.

Thanks for doing the legwork of actually implementing this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Beginner's Guide: Glob Patterns | Malik Browne
Globs, also known as glob patterns are patterns that can expand a wildcard pattern into a list of pathnames that match the given...
Read more >
Tips for writing glob patterns in DeepSource configuration
Glob or "Shell Globing" is the process of writing glob patterns that match files in a filesystem. Glob patterns specify sets of filenames ......
Read more >
Globbing Patterns - CommandBox
When a command has an argument with a type of Globber for a file path, that means you can use file globbing patterns...
Read more >
Common glob pattern - TetraScience
The Glob patterns implemented in the File Log Agent is to provide methods to traverse the file system and returning files or the...
Read more >
Appendix D. Glob Patterns - jEdit
jEdit uses glob patterns similar to those in the various Unix shells to implement file name filters in the file system browser. Glob...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found