Skip to content

Use flask-caching class names for CACHE_TYPE (fixes #544) - #546

Draft
computron wants to merge 1 commit into
mainfrom
fix-flask-caching-cache-types
Draft

computron wants to merge 1 commit into
mainfrom
fix-flask-caching-cache-types

Conversation

@computron

Copy link
Copy Markdown
Member

flask-caching 2.5.0 (released 2026-08-24) removed the lowercase CACHE_TYPE aliases, so any structure display in Jupyter fails with ImportStringError: import_string() failed for 'flask_caching.backends.simple'. This PR switches every CACHE_TYPE to the class name. Fixes #544; together with #542 this is what #545 needs for a stable release.

  • crystal_toolkit/core/plugin.py: "simple" -> "SimpleCache", "null" -> "NullCache"
  • crystal_toolkit/apps/main.py: "null" -> "NullCache", "redis" -> "RedisCache"

No new flask-caching minimum is needed: SimpleCache and NullCache also initialize on flask-caching 2.2.0 and 2.4.1.

Testing: installed this branch in a fresh Python 3.12 environment (pymatgen 2026.9.24, pymatgen-core 2026.9.23, flask-caching 2.5.1, dash 3.4.0) and executed Parts 1, 4, and 5 of https://github.com/computron/pymatgen_tutorials; all structure and molecule displays render. The RedisCache path in apps/main.py was only checked to resolve under flask-caching 2.5.1, not run against a Redis server. No tests added.

🤖 Generated with Claude Code

flask-caching 2.5.0 removed the lowercase aliases ("null", "simple",
"redis"), so creating a CrystalToolkitPlugin fails with
ImportStringError. The class names work on older flask-caching too.

Fixes #544

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

[Bug]: Flask-Caching compatibility issue: need explicit class name

1 participant