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

Write colorbrewer palettes to .py file and remove setuptools dependency #46

Merged
merged 1 commit into from
Apr 6, 2023

Conversation

wch
Copy link
Contributor

@wch wch commented Apr 1, 2023

Loading palettable requires loading setuptools, which is 2.8 MB, and also may not be installed on all systems. This is causing a nontrivial performance penalty for my application because I'm loading palettable on Pyodide (Python compiled to WebAssembly, running in the browser).

This PR removes the dependency on setuptools. Instead of serializing the colorbrewer data to JSON, it saves the data directly as Python code in a .py file. The JSON code is also valid Python code for creating nested dictionaries and lists. I made the change by basically renaming the .json file to .py, and storing the result in a variable.

With this change, there's no need for setuptools, so loading palettable should be faster.

@jiffyclub
Copy link
Owner

Looks reasonable, thanks!

@jiffyclub jiffyclub merged commit 12509bd into jiffyclub:master Apr 6, 2023
@wch
Copy link
Contributor Author

wch commented Apr 6, 2023

Great, thanks!

@wch wch deleted the remove-setuptools branch April 6, 2023 12:47
@jiffyclub
Copy link
Owner

This has been released in version 3.3.1.

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

Successfully merging this pull request may close these issues.

2 participants