Skip to content

Add wildcard ignore and pragma: no cover for compat shims#6275

Merged
masenf merged 2 commits intomainfrom
masenf/import-shim-pragmas
Apr 2, 2026
Merged

Add wildcard ignore and pragma: no cover for compat shims#6275
masenf merged 2 commits intomainfrom
masenf/import-shim-pragmas

Conversation

@masenf
Copy link
Copy Markdown
Collaborator

@masenf masenf commented Apr 2, 2026

These shims are for maintaining compatibility with previous imports for the 0.9.x series.

masenf added 2 commits April 1, 2026 22:39
These shims are for maintaining compatibility with previous imports for the
0.9.x series.
Ignore non-exported name in monkeypatch call
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 2, 2026

Greptile Summary

This PR applies a uniform, mechanical update to all 0.9.x compatibility shim files across the reflex and reflex-components-core packages. Each shim file that uses from <reflex_core_module> import * now receives two additions:

  1. A file-level # pyright: reportWildcardImportFromLibrary=false directive to silence Pyright's wildcard-import-from-library warning, since these files are explicitly designed to re-export via wildcard.
  2. A # pragma: no cover comment on every import line so that coverage.py excludes these pass-through lines from the coverage report.

Two substantive (non-directive) changes are also included:

  • packages/reflex-core/src/reflex_core/components/tags/__init__.py: An explicit __all__ list is added so that from reflex_core.components.tags import * has a well-defined, stable public surface.
  • packages/reflex-core/src/reflex_core/constants/__init__.py: ReflexHostingCLI is added to __all__, fixing a previously missing public export.
  • tests/units/test_config.py: A # pyright: ignore[reportPrivateImportUsage] suppression is added to the monkeypatch.setattr(reflex_core.config.os, …) line.

The changes are purely additive with no runtime behaviour change and do not introduce any logic issues.

Confidence Score: 5/5

  • Safe to merge — all changes are mechanical pragma/directive additions with no logic or runtime impact
  • Every modified file is either a thin wildcard re-export shim receiving identical two-line updates, or a minor correctness fix (all completeness, missing constant export). No new logic is introduced, no existing behaviour is altered, and the test change only suppresses a false-positive static-analysis warning.
  • No files require special attention

Important Files Changed

Filename Overview
packages/reflex-core/src/reflex_core/components/tags/init.py Adds explicit all list to make wildcard imports well-defined and predictable for downstream shims
packages/reflex-core/src/reflex_core/constants/init.py Adds ReflexHostingCLI to all, completing the public API surface for this module
reflex/vars/init.py Adds pyright wildcard-import suppression directive and pragma: no cover to both the wildcard import and the explicit all import
reflex/_upload.py Representative compat shim: adds pyright directive and pragma: no cover to suppress tooling warnings
tests/units/test_config.py Adds pyright: ignore[reportPrivateImportUsage] to monkeypatch call that accesses reflex_core.config.os, suppressing a pyright diagnostic
packages/reflex-components-core/src/reflex_components_core/core/breakpoints.py Compat shim in the components-core package also updated with pyright directive and pragma: no cover

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["User code\n(0.9.x import paths)"]
    B["reflex/vars/__init__.py\nreflex/config.py\nreflex/environment.py\n…(compat shims)"]
    C["reflex_core / reflex_components_core\n(canonical implementations)"]

    A -->|"from reflex.vars import X\nfrom reflex.config import Y"| B
    B -->|"from reflex_core.vars import *  # pragma: no cover\n# pyright: reportWildcardImportFromLibrary=false"| C

    style B fill:#fffbe6,stroke:#f0ad4e
    style C fill:#e6f4ea,stroke:#34a853
Loading

Reviews (1): Last reviewed commit: "Fix missing exports from reflex-core" | Re-trigger Greptile

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 2, 2026

Merging this PR will not alter performance

✅ 8 untouched benchmarks


Comparing masenf/import-shim-pragmas (c05ed75) with main (980a97d)

Open in CodSpeed

@masenf masenf merged commit 2755a7b into main Apr 2, 2026
38 of 40 checks passed
@masenf masenf deleted the masenf/import-shim-pragmas branch April 2, 2026 17:22
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.

2 participants