aclark4life / vanity

Get package download statistics from PyPI
GNU General Public License v2.0
66 stars 14 forks source link

Request for decision on quoted package names #42

Open mattjegan opened 7 years ago

mattjegan commented 7 years ago

Motivated by @killVung in #33

Currently, vanity results with the following given quoted input:

~$ vanity " Flask "
No downloads for  Flask .

     *** Note: PyPI stats are broken again; we're now waiting for warehouse. https://github.com/aclark4life/vanity/issues/22 ***

This should either, interpret the input as vanity flask or raise an error. I think either course of action would be fine, however PEP8 - Package and Module Names eludes to the existence of whitespace in a package name, so perhaps this should be treated as improper input and result in an error.

hugovk commented 7 years ago

I think the most useful thing for the user would be to trim the leading and trailing whitespace.

mattjegan commented 7 years ago

@hugovk Sounds good, @killVung brought this up so perhaps they could handle it? If not, I'm happy to.

killvung commented 7 years ago

The worst part is that you would never the string client passed in. What if they passed something like vanity "But sometimes I need somebody to makes me feel alright"

mattjegan commented 7 years ago

I would assume that should get caught when the call is made to get the downloads statistics seeing as it is _most probably_ not a package name. But would we want vanity "flask django" to return the same output as vanity flask django ?

hugovk commented 7 years ago

I tried to submit a package with spaces in the name on the https://testpypi.python.org/pypi?%3Aaction=submit_form test site and it said:

Error processing form

Invalid package name. Names must contain only ASCII letters, digits, underscores, hyphens, and periods

So I'd say it's safe to split whitespace into separate packages.

e.g.