Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[MNT]: Cleanup internal import dependencies and initialization logic #29813

Open
@timhoffm

Description

@timhoffm

Summary

There's a delicate dependency on who goes first in the import order because we couple module dependencies (imports) and intialization (code execution at import).

See e.g.#29808 (comment)

Proposed fix

I think we can make this simpler by applying the following rules

  • no submodule is allowed to run intialization code (e.g. loading the colormaps) as part of their import
  • initialization should be lazy if possible
  • if lazy initialization is not possible, the initalization code must be placed in a_mpl_init() function in that module. ( (e.g. it's tricky for colormaps because the colormaps are injected as globals into the cm module)
  • only the top-levelmatplotlib module is allowed to call._mpl_init() of the submodules.

This way, we can decouple initialization from import and have one central place that orchestrates the initialization.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp