bndr / bndr/pipreqs

Wrongly capitalizes module name: "Requests"

Open
#500 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.5k
Forks
424
PR merge metrics
No merged PRs in 30d

Description

here's my command:
```
>>> pipreqs . --force --encoding=utf-8 --mode no-pin --debug
DEBUG: Found packages: {'time', 'subprocess', 'urllib', 'sys', 'typing', 'requests', 'logging', 'os', 'base64', 'traceback', 'webbrowser', 'linecache', 'json', 'csv', 'tqdm', 'socketserver', 'datetime', 'concurrent', 'collections', 'math', 'http', 'glob', 'cProfile', 'pstats'}
DEBUG: Found imports: Requests, tqdm
DEBUG: Getting packages information from Local/PyPI
WARNING: Import named "Requests" not found locally. Trying to resolve it at the PyPI server.
DEBUG: Starting new HTTPS connection (1): pypi.python.org:443
DEBUG: https://pypi.python.org:443 "GET /pypi/Requests/json HTTP/11" 301 122
DEBUG: Starting new HTTPS connection (1): pypi.org:443
DEBUG: https://pypi.org:443 "GET /pypi/requests/json HTTP/11" 200 37837
WARNING: Import named "Requests" was resolved to "requests:2.32.5" package (https://pypi.org/project/requests/).
Please, verify manually the final list of requirements.txt to avoid possible dependency confusions.
DEBUG: Writing 2 requirements: Requests, tqdm to .\requirements.txt
INFO: Successfully saved requirements file in .\requirements.txt
```

it for some reason tries to resolve "Requests" with a capital, not "requests"
I checked my code, i used "Requests" nowhere, only the standart `import requests.`
Even after nuking "requirements.txt" and trying again (with pretty much any set of arguments) is does the same.

### environment
- windows 11 (thats why the --encoding is needed)
- requests module is ofc installed locally, but it searches Requests
- pipreqs version 0.4.13
- trying on this repo: [https://github.com/Michal-Martinek/PriceScraper](https://github.com/Michal-Martinek/PriceScraper)

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported pipreqs command against the linked PriceScraper repository and trace how discovered import names are matched to local or PyPI packages. The payload names no files or tests; done means the standard lowercase `requests` import is resolved and written correctly without regressions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.