MaxHalford / prince

:crown: Multivariate exploratory data analysis in Python — PCA, CA, MCA, MFA, FAMD, GPA

Home Page:https://maxhalford.github.io/prince

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Optional dependencies?

Brontomerus opened this issue · comments

I want to see if there is any openness to a possible enhancement. I'd like to try my hand at decoupling the matplotlib dependencies from the various custom transformers and using extras in the setuptools for the package in pypi. The benefit from doing so would allow deployment into applications without matplotlib, as you wouldn't need it in a service-oriented application. I've noticed that while starting up a Flask App or FastAPI application, matplotlib is doing some mischievous activity in the background during startup. as I've copied below:

17:01:13 DEBUG:matplotlib: (private) matplotlib data path: c:\workspace\app\env\lib\site-packages\matplotlib\mpl-data
17:01:13 DEBUG:matplotlib: matplotlib data path: c:\workspace\app\env\lib\site-packages\matplotlib\mpl-data
17:01:13 DEBUG:matplotlib: CONFIGDIR=C:\Users<username>.matplotlib
17:01:13 DEBUG:matplotlib: matplotlib version 3.3.2
17:01:13 DEBUG:matplotlib: interactive is False
17:01:13 DEBUG:matplotlib: platform is win32
17:01:13 DEBUG:matplotlib: CACHEDIR=C:\Users<username>.matplotlib
17:01:13 DEBUG:matplotlib.font_manager: Using fontManager instance from C:\Users\bdonelan.matplotlib\fontlist-v330.json
17:01:13 DEBUG:matplotlib.pyplot: Loaded backend tkagg version unknown.
17:01:13 DEBUG:matplotlib.pyplot: Loaded backend TkAgg version unknown.

To allow use of the library without matplotlib as a required dependency, I'd imagine the library could follow a pattern similar to that of Dask. Here's an example from the Dask repository of how their setup.py functions: Dask Setup.py. I'm envisioning that I could use something like: pip install 'prince[complete]' for everything, while if you want to only use the transformers, you could simply use pip install 'prince[transformers]' to only bring in the actual pre-processors.

Anyway, I wanted to inquire whether this is something maintainers would be open to given I put some time into that. I've never really attempted something along those lines, but I'd be willing to take a crack at it over the holidays. As reference, the docs for the 'optional' dependencies are here: here.

Hey there. That's a worthy feature and I sort of know how to go about doing it, but I really don't have the time to work on it between my day job and River :(((

Apologies for taking some time to respond to you. I have definitely been feeling the same crunch as you lately!

I think I have a window of time to attack this, so I'm going to attempt to approach it and will hopefully open a PR for your review given I arrive at a solution that I believe to be satisfactory (or near enough that we can work through it quickly). I plan to just "lift and shift", so expect very little new code in there - but I'll have to see where this journey takes me!

Hello there 👋

I apologise for not answering earlier. I was not maintaining Prince anymore. However, I have just refactored the entire codebase. This refactoring should have fixed many bugs.

I don’t have time and energy to check if this fixes your issue, but there is a good chance it does. Feel free to reopen this issue if the problem persists after installing the new version — that is, version 0.8.0 and onwards.