bndr / bndr/pipreqs

Move Dependencies for Jupyter Notebook support to **Optional Dependencies**

Open
#459 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
7.5k
Forks
424
PR merge metrics
No merged PRs in 30d

Description

@alan-barzilay @mateuslatrova @Fernando-crz

Dependencies for jupyter notebook support are by definition optional dependencies and should not be listed in **required** dependencies, but in **optional** dependencies as officially recommended by PyPA and described [here](https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#optional-dependencies).

Please consider removing `nbconvert` and `ipython` from the required dependencies and moving them to optional dependencies.

It makes absolutely no sense to:
- install an entire python interactive suite for simple static code analysis
- Add 45 packages, bringing from only 7 to 52 total dependencies, i.e. **multiply the number of dependencies by 7**, and also **multiply the total package size by 16** (from 2.15Mib to 32Mib) for a single feature that is not even the default behavior but accessible via an ***option*** that needs to be explicitly specified, and used by a minority of users.
- Tell users to install your package with `--no-deps` and then install manually the actual required dependencies by hand, in order to get what should be the default install process.
- Make these users receive `pip` error messages because it then believes that the package has not been installed correctly as the environment is missing falsely "required" dependencies for `pipreqs`

Please simply use a optional dependencies block as is intended, recommended, the best practice used by all major python projects, and frankly the only logical solution to this dependency management, and all these issues will be resolved with 5 lines of code.

PS: For reference ->

with jupyter support
```
TOTAL 50.32 MiB
=============================================
pip 24.0 13.17 MiB
pygments 2.18.0 7.78 MiB
ipython 8.12.3 5.20 MiB
jedi 0.19.1 5.08 MiB
setuptools 70.3.0 4.87 MiB
tornado 6.4.1 3.60 MiB
bleach 6.1.0 1.27 MiB
jinja2 3.1.4 1.10 MiB

29 libs smaller than 1.0 MB 8.24 MiB
```

without jupyter support
```
TOTAL 20.20 MiB
==================================
pip 24.0 13.17 MiB
setuptools 70.3.0 4.87 MiB

7 libs smaller than 1.0 MB 2.15 MiB
```

(need to remove `pip` and `setuptools` from the total)

Contributor guide

Open the contributing guide

Research direction

Start by locating the package metadata where required dependencies are declared, then inspect how optional dependencies are defined. Move only nbconvert and ipython to the optional group for Jupyter support, and verify that the default installation no longer pulls them in while the optional installation still enables notebook support.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.