bndr / bndr/pipreqs

pipreqs requiring asposestorage==1.0.2 without reason

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

Description

Hello,
we found a bug in pipreqs: if we import a module called `models`, then it will create a `requirements.txt` file containing `asposestorage==1.0.2`.

To reproduce:
1. Create a file called `my_module.py` containing this code:
```
import models

if __name__ == "__main__":
pass
```
2. run `pipreqs .` in the folder containing this module (you don't need to have a `models.py` file in the folder!).

Result: a `requirements.txt` file is created with this content:
```
asposestorage==1.0.2
```

Versions:
`pipreqs --version` --> 0.4.13
`Python 3.11.7`

Possible explanation:
this file contains a mapping: models --> asposestorage (https://github.com/bndr/pipreqs/blob/cd3f437689a9f27c8045de5126dcbe004d2ceebe/pipreqs/mapping#L793) not sure how it is used but I think that `models` is a quite common module names in these AI days so not sure there should be a default sketchy library imported for models.

Contributor guide

Open the contributing guide

Research direction

Start with the mapping entry at pipreqs/mapping#L793 and reproduce the report using a module that imports `models` with Python 3.11.7 and pipreqs 0.4.13. Determine how that mapping produces the requirement, then verify that the reproduction no longer creates `asposestorage==1.0.2` in requirements.txt.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.