remkade / matchspec

A conda matchspec library implemented in Rust
BSD 3-Clause "New" or "Revised" License
5 stars 7 forks source link

Raise Errors on parseable but nonsensical `MatchSpec`s #13

Open remkade opened 1 year ago

remkade commented 1 year ago

Its possible to create a MatchSpec that is valid but nonsensical. Lets error out and give a helpful message in those cases.

Examples

Here's a few examples that would be parseable, but don't really make any sense.

# Package name matches everything:
*

# Channel shouldn't be globbable, its dangerous. Might be useful on searching though?
conda-*/python

# Certain keys don't make sense to allow partial globs
[sha256="abcd*" md5="abc*"]

# Questionable, maybe encourage people to omit key/values that already default to matching everything?
[license="*"]
remkade commented 1 year ago

I think this is really up for debate. Certain things could be useful in searches, like really open ended globs. And in other cases would be dangerous (conda install * for example).

I could see conda search *[license="GPL*"] being a helpful query for some cases. And if we have a UI (like Anaconda Server maybe?) that likes to list packages always based on a search, defaulting to * would actually be a good thing.