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 #404

Closed Fernando-crz closed 11 months ago

Fernando-crz commented 1 year ago
alan-barzilay commented 1 year ago

tests failed due to nbconvert version, have you run the tests locally? Also, have you addressed the issue raised by @jamesmyatt about optional dependency?

jamesmyatt commented 1 year ago

I think @alan-barzilay means this issue: https://github.com/bndr/pipreqs/pull/210#discussion_r734564597

FWIW, black handles its Jupyter support via optional extras too: https://github.com/psf/black#installation

codecov-commenter commented 12 months ago

Codecov Report

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

Comparison is base (368e9ae) 90.07% compared to head (0657a6d) 90.17%.

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

Additional details and impacted files ```diff @@ Coverage Diff @@ ## next #404 +/- ## ========================================== + Coverage 90.07% 90.17% +0.09% ========================================== Files 2 2 Lines 262 285 +23 ========================================== + Hits 236 257 +21 - Misses 26 28 +2 ``` | [Files](https://app.codecov.io/gh/bndr/pipreqs/pull/404?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [pipreqs/pipreqs.py](https://app.codecov.io/gh/bndr/pipreqs/pull/404?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-cGlwcmVxcy9waXByZXFzLnB5) | `90.07% <94.28%> (+0.10%)` | :arrow_up: |

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

Fernando-crz commented 12 months ago

Just fixed bugs related to the tests. The tests were failing because they were not considering that ipython was now part of the locally installed packages. Just fixed this issue now and tests are running just fine, but for some odd reason the codecov coverage report failed. @alan-barzilay

Fernando-crz commented 12 months ago

Just added support for jupyter notebook as an optional depency, as adressed by https://github.com/bndr/pipreqs/pull/210#discussion_r734564597. @alan-barzilay

Fernando-crz commented 11 months ago

Just fixed the process of installing jupyter notebooks as an optional dependency. Basically, the program detects if the user has the library nbconvert installed, and if it is installed, the program will start detecting jupyter notebooks automatically when generating the requirements.txt file.

I was thinking of maybe turning the detection of jupyter notebooks when creating the requirements.txt file optional, using an optional argument with the name "--ignore-notebooks". What do you think? @alan-barzilay

alan-barzilay commented 11 months ago

I was thinking of maybe turning the detection of jupyter notebooks when creating the requirements.txt file optional, using an optional argument with the name "--ignore-notebooks". What do you think? @alan-barzilay

yeah, good idea!

Fernando-crz commented 11 months ago

I was thinking of maybe turning the detection of jupyter notebooks when creating the requirements.txt file optional, using an optional argument with the name "--ignore-notebooks". What do you think? @alan-barzilay

Done.

alan-barzilay commented 11 months ago

Just so we have a written record of what we've just discussed: let's drop the idea of optional dependencies. Since we want the default option to include support for jupiter notebook, having optional dependencies don't bring us any value.

Besides that we also discussed the idea to further abstract some of the code processing steps to make them more auto contained and hide some of the logic with abstractions. We'll also hide the jupiter logic behind the global variable ignore notebooks, if it is set to true nbconverter will never be imported.

@Fernando-crz did i forget to mention anything?

alan-barzilay commented 11 months ago

@Fernando-crz can we close this PR if it is being continued in #414 ?

Fernando-crz commented 11 months ago

Just so we have a written record of what we've just discussed: let's drop the idea of optional dependencies. Since we want the default option to include support for jupiter notebook, having optional dependencies don't bring us any value.

Besides that we also discussed the idea to further abstract some of the code processing steps to make them more auto contained and hide some of the logic with abstractions. We'll also hide the jupiter logic behind the global variable ignore notebooks, if it is set to true nbconverter will never be imported.

@Fernando-crz did i forget to mention anything?

LGTM

Fernando-crz commented 11 months ago

@Fernando-crz can we close this PR if it is being continued in #414 ?

Sounds good to me.