bndr / bndr/pipreqs

pipreqs confuses secrets package with standard library

Open
#163 2 comments 0 reactions 0 assignees View on GitHub
bug mapping
Dominant language
Python
Stars
7.5k
Forks
424
PR merge metrics
No merged PRs in 30d

Description

I've just tried running pipreqs for my project. It seemed to work fine until the project's CI crashed telling me:
```
ERROR: ERROR: No matching distribution found for secrets==1.0.2
```
Pipreqs thought it's the [secrets](https://pypi.org/project/secrets/) package, while in reality it was [secrets standard library](https://docs.python.org/3.7/library/secrets.html#module-secrets).
Removing the 'secrets==1.0.2' manually from requirements.txt fixed the issue.

The package [cannot be installed on Python 3.7](https://stackoverflow.com/questions/54966977/cannot-install-python-secrets-package) and I'm running Python 3.7, so technically it's clear which module I want to import in my code.

Is there a way for pipreqs to solve this issue automatically or will I need to fix it manually upon every requirements.txt regeneration?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported case with a Python 3.7 project that imports the standard-library secrets module, then run pipreqs and inspect the generated requirements.txt. Done means the standard-library module is not emitted as secrets==1.0.2 while third-party imports continue to appear.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.