I would like to write a Python package that also installs an mpl style file. To do that, I can use the data_files attribute of setuptools. This allows me to install files anywhere in the installation directory, which, for pip on Linux, defaults to ~/.local. Unfortunately, mpl will search for mplstyle files only in ~/.config. This means that, for my package, I have to pull a weird stunt:
- Install the file in
~/.local with the rest of the package
- Upon "start-up" of the package (
import or some function call), check if the file is already in mpl.get_configdir(), has the same content (for updates), and if not, copy it there. Possibly create the directory.
This feels a bit off.
I'd hence suggest that mpl also searches for mplstyle file in, e.g., ~/.local/share/matplotlib/. This would also better fit its nature, given that the file is not meant to be edited by the user.
I would like to write a Python package that also installs an mpl style file. To do that, I can use the
data_filesattribute ofsetuptools. This allows me to install files anywhere in the installation directory, which, for pip on Linux, defaults to~/.local. Unfortunately, mpl will search for mplstyle files only in~/.config. This means that, for my package, I have to pull a weird stunt:~/.localwith the rest of the packageimportor some function call), check if the file is already inmpl.get_configdir(), has the same content (for updates), and if not, copy it there. Possibly create the directory.This feels a bit off.
I'd hence suggest that mpl also searches for mplstyle file in, e.g.,
~/.local/share/matplotlib/. This would also better fit its nature, given that the file is not meant to be edited by the user.