bndr / pipreqs

pipreqs - Generate pip requirements.txt file based on imports of any project. Looking for maintainers to move this project forward.
Apache License 2.0
6.38k stars 388 forks source link

Feature: Include used python version #318

Open DanielHabenicht opened 2 years ago

DanielHabenicht commented 2 years ago

Thanks for creating and maintaing this project. It would be awesome if the requirements.txt would also include a comment of the current python version used to generate it. This way future users can reference it, when something goes wrong (and then install the right version).

Currently generated file example:

matplotlib==3.5.2
mpl_axes_aligner==1.3
networkx==2.8.5
numpy==1.23.1
pandas==1.4.3
python_dateutil==2.8.2
scikit_learn==1.1.1
seaborn==0.11.2
tqdm==4.64.0
wntr==0.4.2

Proposed:

# This dependencies were used with Python v3.7.7
matplotlib==3.5.2
mpl_axes_aligner==1.3
networkx==2.8.5
numpy==1.23.1
pandas==1.4.3
python_dateutil==2.8.2
scikit_learn==1.1.1
seaborn==0.11.2
tqdm==4.64.0
wntr==0.4.2

It may also be a good best practice to state that the file was auto generated and help debugging issues from users, by including an autogenerated message like this (also makes this module more known):

# This file was autogenerated by [pipreqs](https://github.com/bndr/pipreqs) v0.4.11 on Python Version v3.7.7
matplotlib==3.5.2
mpl_axes_aligner==1.3
networkx==2.8.5
numpy==1.23.1
pandas==1.4.3
python_dateutil==2.8.2
scikit_learn==1.1.1
seaborn==0.11.2
tqdm==4.64.0
wntr==0.4.2
mmngreco commented 1 year ago

Agree, I like the last one! actually I'm doing something like this externally after executing pipreqs throught my Makefile.