Skip to content

refactor: avoid star-imports in analytics package (#4927) - #4933

Merged
NoopDog merged 4 commits into
mainfrom
hunter/4927-remove-analytics-star-imports
Aug 19, 2026
Merged

NoopDog merged 4 commits into
mainfrom
hunter/4927-remove-analytics-star-imports

Conversation

@hunterckx

Copy link
Copy Markdown
Contributor

Closes #4927

For the entities import, I decided that importing the whole module under the alias e would be nicer that listing out every imported constant, which means that most of the changes to report_elements.py are prefixing the constants with e.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the analytics package to eliminate star-import re-export leakage from report_elements.py, and updates the static-site fetcher to import ADDITIONAL_DATA_BEHAVIOR explicitly so static-site generation does not depend on accidental re-exports.

Changes:

  • Replace report_elements.py star imports with explicit imports from _report_utils and an entities module alias.
  • Update static_site/fetch.py to import and use ADDITIONAL_DATA_BEHAVIOR directly from entities.
  • Bump analytics package version to 5.0.4.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
analytics/analytics_package/setup.py Bumps the analytics package version for the refactor.
analytics/analytics_package/analytics/static_site/fetch.py Stops relying on report_elements re-exports by importing ADDITIONAL_DATA_BEHAVIOR directly.
analytics/analytics_package/analytics/report_elements.py Removes star imports and prefixes entity constants to reduce unintended public exports.
Suppressed comments (1)

analytics/analytics_package/analytics/report_elements.py:9

  • from . import entities as e introduces a new public name e on report_elements (including on import *), which is the same kind of module-alias export leak called out in #4927. Consider renaming this to a private alias (e.g., _entities) or adding __all__ so only the intended symbols are exported.
from . import entities as e

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread analytics/analytics_package/analytics/report_elements.py Outdated
Comment thread analytics/analytics_package/analytics/report_elements.py
@NoopDog
NoopDog merged commit 4909c28 into main Aug 19, 2026
3 checks passed
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.

chore: make analytics package public exports explicit (remove star-import leak)

3 participants