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

Add support for jupyter notebook #414

Closed mateuslatrova closed 10 months ago

mateuslatrova commented 11 months ago

This branch is a continuation of PR https://github.com/bndr/pipreqs/pull/404. Copied it to the pipreqsxp fork so that the other members can also contribute.

codecov-commenter commented 10 months ago

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (f041de9) 90.07% compared to head (8ae4618) 90.16%.

Files Patch % Lines
pipreqs/pipreqs.py 92.68% 3 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## next #414 +/- ## ========================================== + Coverage 90.07% 90.16% +0.09% ========================================== Files 2 2 Lines 262 295 +33 ========================================== + Hits 236 266 +30 - Misses 26 29 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

mateuslatrova commented 10 months ago

@alan-barzilay

We rebased this branch into the next branch to add the poetry changes.

After that, we added a flag --scan-notebooks to give the ability for the user to include jupyter notebooks in the files scanned by pipreqs.

Also, we also did a change in the tests to suppress all the logged warnings and errors during test execution.

At last, we updated the README file explaining how the user can install pipreqs without the dependencies needed for jupyter notebook support.

Fernando-crz commented 10 months ago

@alan-barzilay @mateuslatrova Just rebased all the changes, fixing possible cross-contamination errors. Please, feel free to check my changes to make sure everything is ok. Also fixed other changes asked by Alan.

Now, we only need to check if ipython is really a necessary import or not. Shouldn't be that hard to check that.

Fernando-crz commented 10 months ago

Actually, considering the coverage error was fixed by adding the installation of ipython as a dependency, we can assume that ipython is indeed necessary.

alan-barzilay commented 10 months ago

Actually, considering the coverage error was fixed by adding the installation of ipython as a dependency, we can assume that ipython is indeed necessary.

just for the sake of completion, our working hypothesis is that ipython is necessary to parse magic commands in notebooks, our tests were failing due to a parsing error involving magics.