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

Matplotlib is Heavy Load for a Simple Function #20

Closed
alanderex opened this issue Jun 18, 2024 · 1 comment
Closed

Matplotlib is Heavy Load for a Simple Function #20

alanderex opened this issue Jun 18, 2024 · 1 comment

Comments

@alanderex
Copy link
Collaborator

alanderex commented Jun 18, 2024

matplotlib is a huge dependency and still may cause trouble on macOS-arm64

matplotlib is a dependency and only used to convert color names to RBG tuples.

def mark_rows(worksheet, mask: pd.Series, color: ColorType):
    ...
    fmt = cellFormat(backgroundColor=Color(*to_rgb(color)))

👉 Installing matplotlib can still be tricky on macOS-arm64 due and fail.
👉 Having a huge package as matplotlibas a dependency just to convert color names to RBG tuples is a bad idea.

Proposed Solution: webcolors

webcolors is a lightweight library offering conversion of color names to RBG tuples

def mark_rows(worksheet, mask: pd.Series, color: ColorType):
    ...
    color_rgb = name_to_rgb(color)if isinstance(color, str) else color[:3]
    fmt = cellFormat(backgroundColor=Color(*color_rgb))

remove matplotlib from dependencies (it's still used via seaborn in optional dependencies)

Versions and main components

  • Pytanis Version: 0.7.1
  • Python Version: 3.12
  • Operating system: macOS 14.1
@FlorianWilhelm
Copy link
Owner

Really good point! Thanks @alanderex for directly providing a PR :-)

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

2 participants