Skip to content

Fix stale public exports blocking wildcard imports - #686

Merged
hameerabbasi merged 4 commits into
finch-tensor:mainfrom
Doribelove:yl/fix-public-exports
Oct 7, 2026
Merged

hameerabbasi merged 4 commits into
finch-tensor:mainfrom
Doribelove:yl/fix-public-exports

Conversation

@Doribelove

@Doribelove Doribelove commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

from finch import * fails because the top-level __all__ advertises names that are not bound on finch. This also prevents sparse from importing its Finch backend, which uses a wildcard Finch import.

Restore Reflector and element_type as top-level exports from their existing public submodules. Remove the three names without module-level objects (extent, fill_value, and shape_type) and remove duplicate entries.

Following review, keep Ruff's ordering of __all__ and remove the local RUF022 suppression. The regression test checks that every advertised name exists and that there are no duplicates; ordering is enforced by Ruff. The resulting diff against current main touches only two files, with 8 insertions and 11 deletions.

Validation

Rebased onto main at 819923917af8dcad3eb201107974ccd4eafa13f3; current head 280a1ec71c9f624bf9f0317dc21a93abe6e241eb. Checks used Linux and Python 3.12.14 against the actual source tree.

  • python -m pytest src/finch/tests/test_public_exports.py src/finch/tests/test_interface.py --no-cov -q: 3,093 passed, 54 skipped.
  • All seven repository pre-commit hooks passed with the official configuration, including Ruff 0.16.8 check and format.
  • A separate wildcard-import smoke check passed for all 280 available, unique exports.
  • git diff --check: passed.

The original wildcard-import reproduction failed on unchanged source with an unavailable export, then passed with the export fix. The current rebase includes upstream's removal of the old automatic benchmark-julia job. On the new head, pre-commit.ci passes; GitHub CI, Docs and Benchmark workflows are action_required, awaiting workflow approval. These are not reported as test failures. The complete backend/platform matrix has not been run locally.

AI assistance: Codex prepared the implementation, test, review revisions and description. The reported local checks were executed.

@hameerabbasi hameerabbasi 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.

Please import things where possible instead of deleting from __all__.

Comment thread src/finch/tests/test_public_exports.py Resolved
@Doribelove

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I updated the existing PR branch in 0a7b205c.

I restored the two names that are available from public submodules: Reflector from finch.symbolic and element_type from finch.finch_assembly. The other three removed names (extent, fill_value, and shape_type) have no module-level export to import. I also removed duplicate __all__ entries and made the static list lexically sorted. The new test includes the suggested availability and sorted-unique assertions, checks those restored objects retain their identities, and retains the wildcard-import regression.

Validation: python -m pytest src/finch/tests/test_public_exports.py src/finch/tests/test_interface.py --no-cov -q reported 3,095 passed and 54 skipped. Ruff 0.16.8 check and format checks on the changed files passed, as did git diff --check. The local # noqa: RUF022 is limited to __all__: Ruff's natural/isort ordering differs from Python's sorted(...) order required by the suggested invariant. Remote checks have not reported results on this new head yet.

Posted on behalf of @Doribelove by OpenAI Codex (GPT-6, autonomous). Codex generated this review-round change, tests, and response and ran the checks above.

Comment thread src/finch/tests/test_public_exports.py Outdated
exec("from finch import *", namespace)

for name in finch.__all__:
assert namespace[name] is getattr(finch, name)

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.

We don't need these two tests anymore.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed both test_existing_public_exports_stay_available and test_star_import_exposes_public_names, together with the unused imports, in 61419bbc. The test file now contains only the suggested availability and sorted-unique invariant.

Validation: the public-export and interface tests report 3,093 passed and 54 skipped; Ruff 0.16.8 check/format and git diff --check pass. The PR description now reflects the final test coverage.

Posted on behalf of @Doribelove by OpenAI Codex (GPT-6, autonomous). Codex prepared this test-only revision and response and ran the checks above.

@Doribelove

Copy link
Copy Markdown
Contributor Author

I checked the newly completed benchmark-julia run on 61419bbc: 2 failed, 13 passed, 2 deselected. The failures are the empty_last-optimize and empty_last-downstream cases in benchmarks/test_galley.py. Both fail during warmup at AliasedForm.validate_inputs, with ValueError: Query must write to a Table of an Alias, before the timed benchmark executes.

The benchmark and validator files are byte-for-byte unchanged from this PR's pre-export-change baseline, b2b78e6de6d907be662966aa12674bf9fec867b7. I also ran a minimal validator reproduction with the same Query(Alias(...), Table(...)) node shape against the actual baseline source and the current PR source; both raise the same error. This reproduces the validation rejection only: I have not rerun the complete Julia benchmark suite on the baseline.

Upstream 431a36f / #665 has since removed the benchmark-julia job from .github/workflows/benchmark.yml. The current PR still has the older workflow. The other 17 reported checks pass. This evidence points to the existing Galley plan validation path; I have kept this export fix scoped to the public imports, __all__, and its regression test.

Investigation performed with Codex assistance.

@hameerabbasi

Copy link
Copy Markdown
Contributor

Please rebase; that should cause the Julia benchmark failure to go away.

Comment thread src/finch/__init__.py Resolved
Comment thread src/finch/tests/test_public_exports.py Resolved
Restore the existing Reflector and element_type exports from their public submodules. Keep unavailable property names out of __all__, normalize its static order and duplicates, and cover availability, uniqueness, and wildcard imports.

Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
Signed-off-by: 李永祺 <[email protected]>
Remove the redundant object identity and wildcard import tests, along with their unused imports, as requested in review.

Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
Signed-off-by: 李永祺 <[email protected]>
Remove the RUF022 suppression and redundant ordering assertion as requested in review. Preserve export availability and uniqueness checks. Validate 3093 public-export and interface tests, with 54 skips, and all repository pre-commit hooks.

Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
Signed-off-by: 李永祺 <[email protected]>
@Doribelove
Doribelove force-pushed the yl/fix-public-exports branch from 61419bb to 280a1ec Compare October 7, 2026 10:08
@hameerabbasi
hameerabbasi enabled auto-merge (squash) October 7, 2026 11:41
@hameerabbasi
hameerabbasi merged commit be39687 into finch-tensor:main Oct 7, 2026
17 checks passed
Ruchika-2003 pushed a commit that referenced this pull request Oct 9, 2026
* Fix stale public exports blocking wildcard imports

Signed-off-by: 李永祺 <[email protected]>

* Preserve importable public exports and validate the export list

Restore the existing Reflector and element_type exports from their public submodules. Keep unavailable property names out of __all__, normalize its static order and duplicates, and cover availability, uniqueness, and wildcard imports.

Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
Signed-off-by: 李永祺 <[email protected]>

* Keep the requested public export invariant test

Remove the redundant object identity and wildcard import tests, along with their unused imports, as requested in review.

Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
Signed-off-by: 李永祺 <[email protected]>

* Keep Ruff export ordering after rebasing main

Remove the RUF022 suppression and redundant ordering assertion as requested in review. Preserve export availability and uniqueness checks. Validate 3093 public-export and interface tests, with 54 skips, and all repository pre-commit hooks.

Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
Signed-off-by: 李永祺 <[email protected]>

---------

Signed-off-by: 李永祺 <[email protected]>
andystopia pushed a commit that referenced this pull request Oct 13, 2026
* Fix stale public exports blocking wildcard imports

Signed-off-by: 李永祺 <[email protected]>

* Preserve importable public exports and validate the export list

Restore the existing Reflector and element_type exports from their public submodules. Keep unavailable property names out of __all__, normalize its static order and duplicates, and cover availability, uniqueness, and wildcard imports.

Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
Signed-off-by: 李永祺 <[email protected]>

* Keep the requested public export invariant test

Remove the redundant object identity and wildcard import tests, along with their unused imports, as requested in review.

Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
Signed-off-by: 李永祺 <[email protected]>

* Keep Ruff export ordering after rebasing main

Remove the RUF022 suppression and redundant ordering assertion as requested in review. Preserve export availability and uniqueness checks. Validate 3093 public-export and interface tests, with 54 skips, and all repository pre-commit hooks.

Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
Signed-off-by: 李永祺 <[email protected]>

---------

Signed-off-by: 李永祺 <[email protected]>
willow-ahrens added a commit that referenced this pull request Oct 14, 2026
…ngs (#703)

* fixing LRU implementation

* precommit error fixing

* cached_matrix form implemented

* [pre-commit.ci] pre-commit autoupdate (#712)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.16.9 → v0.16.10](astral-sh/ruff-pre-commit@v0.16.9...v0.16.10)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* `pixi update` and fix new `ty` lints (#710)

* `pixi update`

* Fix type checking errors caught by new version of `ty`.

* Memory Management for MLIR (#685)

* Added dev_doc.md for mlir codegen

* First draft of memref_buffer

* Edit: added sparse output and finished memeory management

* fix description

* Added test for memrefbuffer

* Fin

* Add sponsors section to README (#714)

Added sponsors section with acknowledgments for NSF and Codspeed.

* Update sponsorship section in README.md (#715)

* Fix stale public exports blocking wildcard imports (#686)

* Fix stale public exports blocking wildcard imports

Signed-off-by: 李永祺 <[email protected]>

* Preserve importable public exports and validate the export list

Restore the existing Reflector and element_type exports from their public submodules. Keep unavailable property names out of __all__, normalize its static order and duplicates, and cover availability, uniqueness, and wildcard imports.

Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
Signed-off-by: 李永祺 <[email protected]>

* Keep the requested public export invariant test

Remove the redundant object identity and wildcard import tests, along with their unused imports, as requested in review.

Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
Signed-off-by: 李永祺 <[email protected]>

* Keep Ruff export ordering after rebasing main

Remove the RUF022 suppression and redundant ordering assertion as requested in review. Preserve export availability and uniqueness checks. Validate 3093 public-export and interface tests, with 54 skips, and all repository pre-commit hooks.

Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
Signed-off-by: 李永祺 <[email protected]>

---------

Signed-off-by: 李永祺 <[email protected]>

* precommig

* fix

---------

Signed-off-by: 李永祺 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Hameer Abbasi <[email protected]>
Co-authored-by: Yu Sheng <[email protected]>
Co-authored-by: Willow Ahrens <[email protected]>
Co-authored-by: Dori <[email protected]>
Co-authored-by: Willow Ahrens <[email protected]>
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