pypa / bandersnatch

A PyPI mirror client according to PEP 381 http://www.python.org/dev/peps/pep-0381/
Academic Free License v3.0
455 stars 141 forks source link

Allow the use of regex or *.txt in allowlist requirements #1032

Closed mbacicc closed 2 years ago

mbacicc commented 3 years ago

It would be nice to have the possibility to do this:

[allowlist]
requirements_path = /requirements
requirements =
    *.txt

Or provide a regex to find for specific files by changing this function:

https://github.com/pypa/bandersnatch/blob/8d277d3dc1bfc23fbd8b851cae73830e29fc1d26/src/bandersnatch_filter_plugins/allowlist_name.py#L107

cooperlees commented 3 years ago

This is called globbing. I am ok with this been added as long as it's tested and supported on all platforms. I am always keen on avoiding regex's where ever we can. So lets start with globbing.

pathlib is prob the best library to use here: https://docs.python.org/3/library/pathlib.html#pathlib.Path.glob