Remove unused template globals from helpers.py __all__ (#13422) - #13426
Merged
RayBB merged 1 commit intoAug 25, 2026
Conversation
…ve#13422) safesort, private_collection_in, and private_collections are registered as Templetor template globals via openlibrary/core/helpers.py __all__ (consumed at helpers.py:367), but no template references them. Remove the three entries from __all__ to de-register them as template globals. The function definitions stay in helpers.py and every Python caller uses a direct import or module-attribute access (core/models.py, core/lists/model.py, tests/core/test_helpers.py), so they are unaffected. There is no `from openlibrary.core.helpers import *` in the codebase, so __all__ feeds only the template-global builder. Verified by grepping .py/.html/.js/.md across the repo (zero template/JS references to any of the three).
12 tasks
Merged
2 tasks
RayBB
approved these changes
Aug 25, 2026
RayBB
left a comment
Collaborator
There was a problem hiding this comment.
Working well and I double checked these are definitely not used on any other pages.
Thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #13422 — the
openlibrary/core/helpers.py__all__section.What
helpers.pyexposes helpers as Templetor template globals via its__all__list (consumed atopenlibrary/core/helpers.py:367,return web.storage((k, _globals[k]) for k in __all__)). Three of those are never used by any template:safesortprivate_collection_inprivate_collectionsThis removes those three entries from
__all__. The function definitions stay inhelpers.py, and only their template-global registration is dropped.Why it's safe
.py,.html,.js, and.mdacross the repo; none of the three is referenced as a template global anywhere.safesort→openlibrary/core/models.py(from openlibrary.core.helpers import safesort),openlibrary/core/lists/model.py(h.safesort),openlibrary/tests/core/test_helpers.py(h.safesort)private_collection_in→openlibrary/core/models.py(direct import)private_collections→ called only withinhelpers.pybyprivate_collection_in()import *— there is nofrom openlibrary.core.helpers import *in the codebase, so__all__feeds only the template-global builder; removing entries can't break a star-import.Verification
.py/.html/.js) — done, zero references outside the registration (see above).make test-py-uv) — I don't have the full Docker environment locally (the import chain requiresinfogami), so I couldn't run these here. Flagging for a reviewer to confirm in CI.Scoped to just this one section per the "one PR per section" guidance.