Reasoning behind mapping requests to Requests (capitalization change)
- Dominant language
- Python
- Stars
- 7.5k
- Forks
- 424
- PR merge metrics
- No merged PRs in 30d
Description
I was wondering if there is any documentation anywhere that describes why some packages have their names remapped to something else. In particular I was curious about the requests package and the flask package. So if you have `import requests` in the code, pipreqs says "Found packages: {'requests'}", then "Found imports: Requests" but then "WARNING: Import named "Requests" not found locally. Trying to resolve it at the PyPI server." after which it ends up getting resolved to something like "requests:2.23.3", but then what gets written in the requirements file is "Requests==2.23.3"
I guess I don't really understand why this happens? I mean I understand how I guess, because its listed here in the mapping file https://github.com/bndr/pipreqs/blob/master/pipreqs/mapping#L994, but yeah not sure why.
Even in like a `pip show requests`, the name of the package is lowercase, so I'm not sure where this reference to a capitalized Requests package is coming from.
It's not a huge issue I suppose, it does warn you it didn't find it and is putting some other version into the requirements. Is this just something one should watch out for? For what its worth I've noticed it so far with requests and flask. And maybe flask is an even weirder example because on PyPI it says to install it with `pip install Flask` but the usage is `from flask import Flask`....
Sorry if this has been asked before and I just didn't find it, thanks for the work on this cool project
Contributor guide
Research direction
Start with pipreqs/mapping around line 994 and inspect how the requests and flask entries relate import names to PyPI package names. Document why capitalization differs, how the warning and resolution behave, and what users should expect in the generated requirements file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100