Skip to content

Bug: PlotPy stores custom colormaps in ~/.config/.none/ instead of its own configuration directory #70

Closed

Description

@StefanoPierini-Codra

Component: plotpy.config / plotpy.mathutils.colormap
Affected version: 2.11.0 and, as far as can be told, every earlier version
Severity: medium — user-created colormaps are written to a bogus directory, and never follow the host application's configuration directory

Symptom

  1. Custom colormaps created by the user are saved to ~/.config/.none/colormaps_custom.json (Windows: %USERPROFILE%\.none\colormaps_custom.json), not to a PlotPy-owned directory.
  2. A stray ~/.config/.none/ directory is created merely by importing PlotPy, even when the user never saves anything.
  3. When a host application claims a configuration directory via CONF.set_application("MyApp_v1/plotpy", …), the INI file moves but the colormaps do not: they keep pointing at .none.

Root cause

Two independent defects combine.

1. PlotPy never names its own UserConfig

plotpy/config.py:

CONF = UserConfig(DEFAULTS)

guidata.userconfig.UserConfig.__init__ sets self.name = "none", and get_path() resolves — and creates, via os.makedirs — ~/.config/.{self.name}/…. Without a set_application() call the name stays "none", so every path derived from CONF lands in ~/.config/.none/.

2. Colormap paths are resolved at import time and never refreshed

plotpy/mathutils/colormap.py computes its paths as module-level constants:

DEFAULT_COLORMAPS_PATH = get_cmap_path(CONF.get("colormaps", "colormaps/default", …))
CUSTOM_COLORMAPS_PATH = get_cmap_path(CONF.get("colormaps", "colormaps/custom", …))

CUSTOM_COLORMAPS_PATH is the file PlotPy writes to (save_colormaps(CUSTOM_COLORMAPS_PATH, CUSTOM_COLORMAPS)). A host application's set_application() call necessarily happens after plotpy.mathutils.colormap has been imported, so the path is already frozen. This is why symptom 3 affects host applications such as DataLab even though they do claim a configuration directory.

Note that PlotPy never calls CONF.save(), so no PlotPy settings are actually stored in .none/none.ini — that file belongs to guidata (see the companion issue). Only the colormaps are at stake.

Activity

  1. PierreRaybaut commented on Oct 29, 2026

    @PierreRaybaut
    Contributor

    Thanks for the report: both root causes are confirmed, and reproduced on the current develop sources (PlotPy 2.12.0.dev, guidata 3.16) with a temporary home directory.

    Two clarifications:

    • When the .none directory is created: import plotpy and import plotpy.config alone do not create it. It is created when plotpy.mathutils.colormap is imported, because the module calls CONF.get_path(), which creates the directory. In practice this happens in almost every use of PlotPy, since image items, styles and tools import this module.
    • Host applications: the actual location depends on the import order, not only on whether set_application() is called. For instance, SigimaX names PlotPy's configuration "plotpy" when its options are instantiated, and DataLab later renames it "DataLab_v1/plotpy". Today's results:
    Context Custom colormaps file
    PlotPy alone ~/.none/colormaps_custom.json
    DataLab application (datalab.app) ~/.plotpy/colormaps_custom.json
    DataLab scripts / tests (import datalab.config first) ~/.none/colormaps_custom.json
    Location intended by DataLab (DataLab_v1/plotpy) never used

    Colormaps are therefore shared by accident, between applications that happen to resolve to the same directory. Even then, they are loaded only once per process, and each save rewrites the whole file, so two applications running at the same time overwrite each other's additions.

    The chosen fix follows the existing intent of host applications: custom colormaps are stored per application, in the configuration directory set with CONF.set_application(), with .plotpy as PlotPy's own default. Existing colormaps from .none and .plotpy are copied to the new location the first time, without modifying the old files. Details in #88.

  2. added a commit that references this issue on Oct 29, 2026
    9984b49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions