jiffyclub / palettable

Color palettes for Python
https://jiffyclub.github.io/palettable/
Other
768 stars 73 forks source link

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

Closed wch closed 1 year ago

wch commented 1 year ago

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 commented 1 year ago

Looks reasonable, thanks!

wch commented 1 year ago

Great, thanks!

jiffyclub commented 1 year ago

This has been released in version 3.3.1.