Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary dependencies? #16

Open
frenzymadness opened this issue Jul 14, 2020 · 8 comments
Open

Unnecessary dependencies? #16

frenzymadness opened this issue Jul 14, 2020 · 8 comments

Comments

@frenzymadness
Copy link
Contributor

While I am working on an unrelated problem with dependencies between ipython RPM packages in Fedora, I've found out that nb2plots' list of dependencies might be unnecessary long.

Let me explain. nb2plots has in the requirements.txt file that it requires ipython[notebook]. But to me, it seems that it can work well without notebook and even without ipython.

I have two virtual environments with Python 3.8. The first one without ipython[notebook] and second one with it. The numbers of packages are 48 vs. 67 packages. nb2plots command works well in both and returns the same result for the same ipynb file.

Here is a diff of lists of packages installed in the two mentioned virtual environments from which it seems that ipython[notebook] brings a lot of packages nb2plots can live without:

3a4
> backcall==0.2.0
13a15,16
> ipykernel==5.3.2
> ipython==7.16.1
14a18,19
> ipywidgets==7.5.1
> jedi==0.17.1
16a22
> jupyter-client==6.1.6
24a31
> notebook==6.0.3
27a35,40
> parso==0.7.0
> pexpect==4.8.0
> pickleshare==0.7.5
> prometheus-client==0.8.0
> prompt-toolkit==3.0.5
> ptyprocess==0.6.0
32a46
> pyzmq==19.0.1
33a48
> Send2Trash==1.5.0
43a59
> terminado==0.8.3
45a62
> tornado==6.0.4
47a65
> wcwidth==0.2.5
48a67
> widgetsnbextension==3.5.1

Is there any feature I am missing which cannot work without ipython[notebook]? And if so, would it be possible to make optional/extras?

If there is nothing like that, it might be possible to remove ipython from requirements.txt and add nbconvert, nbformat and traitlets there (all of which nb2plots imports in ipython_shim.py file).

matplotlib>=2.0
nbconvert
nbformat
numpy>=1.7.1
six>=1.10
sphinx>=1.4
sphinxtesters>=0.2
texext
traitlets
@frenzymadness
Copy link
Contributor Author

By the way, a difference in size between those two virtual environments in 180 MB vs 260 MB.

@matthew-brett
Copy link
Owner

I guess you are not using the codelinks directive, or if you are, you aren't generating notebooks from it?

@frenzymadness
Copy link
Contributor Author

I don't. Honestly, I don't understand that feature so I cannot test it. Do you think that code links are used broadly so it does not make sense to convert them to an optional feature?

@matthew-brett
Copy link
Owner

It's always a judgement call - you have to weigh how confusing or unpleasant it would be to get an error for a missing dependency in ordinary use, against the difficulty or inconvenience of installing the dependencies in ordinary use. I think of Nb2plots as being something of a heavy-duty tool, that would mainly be used by developers doing documentation builds, so I was prepared to go a little bit further towards depending on things by default.

@frenzymadness
Copy link
Contributor Author

I completely understand your reasoning and point of view. On the other hand, in the modern approach going towards clouds and containers developers weight every MB of dependencies. Moreover, an error message you get might be nice and actionable like the one we have in micropipenv when you try to use it without toml package installed:

https://github.com/thoth-station/micropipenv/blob/3ebb9ebdb00a546a2d031d7a797a5a90e54af72c/micropipenv.py#L154-L165

Feel free to close this issue or discuss it with users of nb2plots.

@matthew-brett
Copy link
Owner

I do understand - and this is the minimal approach I have taken for my brain imaging package - because I knew it might be installed in minimal environments. But I think this is less true of a documentation builder - and the errors for importing a missing optional module in this case will be more obscure, because they appear inside a Sphinx build log - so my temptation is to leave it as it is, but leave this issue open, in case anyone feels like commenting more.

@hroncok
Copy link

hroncok commented Jul 14, 2020

From a different point of view, does the codelinks directive need ipython[notebok] or would notebook nad/or plain ;ipython` do?

@matthew-brett
Copy link
Owner

Oops - sorry - forgot about this one - I don't suppose you had time to check whether notebook or ipython will do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants