Introduce an experimental AST-based optimizer that can be evaluated alongside the existing legacy optimizer without changing public behavior.
Provide a separate entrypoint so both optimizers can coexist for comparison and iterative rule development.
Description
Added a new experimental submodule delayed_image.experimental.astopt with driver, rule registry, traversal helpers, and canonical-signature helpers (optimizer.py, rules.py, transformer.py, signature.py, plus package __init__.py).
Exposed new entrypoints: delayed_image.experimental.astopt.optimize() and optimize_trace(), and added DelayedOperation.optimize_ast() (and .pyi stub) which forwards to the experimental optimizer; the existing optimize() behavior is unchanged.
Tests: added tests/conftest.py with fixtures to parametrize between the legacy and AST optimizer, added equivalence/idempotence tests in tests/test_ast_optimize_equivalence.py, and updated several existing tests to run against both optimizer callables.
Documentation: added an Unreleased changelog entry describing the experimental optimizer and how to invoke it (CHANGELOG.md).
Testing
Ran the full test suite via the project test driver (python run_tests.py, which runs pytest plus xdoctest); the run collected 184 items and produced a mixed result: 113 passed, 19 failed, 52 skipped, and 2 warnings.
The new AST equivalence/idempotence tests (tests/test_ast_optimize_equivalence.py) passed in the test runs that exercised them, and the paramaterized tests exercised both optimize() and optimize_ast() paths.
Remaining failures are mostly environment/backend related (examples: NotImplementedError from kwimage.warp_affine because the skimage backend is not available in this environment, and xdoctest failures caused by blocked external demo image downloads); these are pre-existing environment-sensitive failures rather than regressions in the new optimizer integration.
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
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.
Motivation
Description
Testing
Codex Task