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

Feature Request: move matplotlib into extras dependency #31

Closed
wwuck opened this issue Jan 10, 2022 · 8 comments
Closed

Feature Request: move matplotlib into extras dependency #31

wwuck opened this issue Jan 10, 2022 · 8 comments

Comments

@wwuck
Copy link
Contributor

wwuck commented Jan 10, 2022

Hi, would it be possible to move matplotlib into an extras dependency? We are currently building a custom version of phik for our local production usage without the report.py module as matplotlib is a relatively large download on top of the tiny phik library and we don't need matplotlib for our use cases.

If if is too hard to split out, we can still continue with building our local wheels on each phik release.

Thanks for considering this request.

@RUrlus
Copy link
Contributor

RUrlus commented Jan 11, 2022

Hi @wwuck, I don't think placing a burden on the vast majority of users/downstream libs to update the installation is a good tradeoff for this very specific scenario.

@mbaak
Copy link
Contributor

mbaak commented Jan 11, 2022

Hi @wwuck @RUrlus, we could think about having a dedicated requirements section without matplotlib, if that is possible. (I.e. default installation includes it.) I'm happy to look into that.

@mbaak
Copy link
Contributor

mbaak commented Jan 11, 2022

I'm afraid I don't see an easy way to opt out of installing a (heavy) dependency, if one wants it to be present by default. setuptools only allows extra requirements, but not less.

@wwuck
Copy link
Contributor Author

wwuck commented Jan 12, 2022

The only other alternative that comes to mind is doing similar to what the gitlint project did recently, and split into two packages (jorisroovers/gitlint#162).

It's not directly equivalent, but in essence you would change the original phik package in the codebase to be a phik-core package without matplotlib dependency or reporting module by default and an extras specifying matplotlib dependency for the reporting module to use.

Then you create a new minimal phik package configuration that just has an install dependency on phik[reporting] (or phik[matplotlib] or similar naming).

Existing phik package users wouldn't need to change anything, and most likely wouldn't notice anything except an extra dependency being installed. This would allow people not needing the heavy matplotlib dependency to just install phik-core instead of the full phik package.

@RUrlus
Copy link
Contributor

RUrlus commented Jan 12, 2022

Hi @wwuck, Max and I had a chat about a possible solution and we're not keen on splitting the package at this time. However, what do you think about using an environment variable, e.g. PHIK_NO_MPL to remove Matplotlib as a dependency. The setup.py can check if this variable is set and remove Matplotlib from the INSTALL_REQUIRES list.

@mbaak
Copy link
Contributor

mbaak commented Jan 24, 2022

@wwuck Can you work with the proposed solution?

@wwuck
Copy link
Contributor Author

wwuck commented Jan 26, 2022

Sorry, using an environment variable feels like too much of a giant hacky band-aid to this problem and leaves too many ways to run into problems if the environment variable needs to be defined every time that we install a package that depends on phik across all of our projects (using virtualenv, tox, nox, vscode, docker, CI/CD, etc.).

We are happy to continue with building a custom phik package for our local pypi repository if there is no better fix available.

@mbaak
Copy link
Contributor

mbaak commented Jan 29, 2022

Ok. We will keep following setuptools, to see if the feature to remove dependencies will get introduced. For now I'll close the issue.

@mbaak mbaak closed this as completed Jan 29, 2022
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