Repository navigation
fix: explicit motile submodule imports for motile ≥1.0.1 - #68
Merged
bentaculum merged 1 commit intoAug 4, 2026
Merged
Conversation
motile 1.0.1 moved the `from .constraints.constraint import Constraint`
import in solver.py behind `TYPE_CHECKING`, so `import motile` alone no
longer registers `motile.constraints` in sys.modules at runtime.
Adding explicit `import motile.constraints` (and the same for
`motile.costs` and `motile.variables` to be future-proof) fixes:
AttributeError: module 'motile' has no attribute 'constraints'
which broke the `test_empty_window_ilp` test on CI after motile 1.0.1
was released on 2026-07-21.
bentaculum
marked this pull request as ready for review
August 4, 2026 11:42
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.
Summary
import motile.constraints,import motile.costs, andimport motile.variablesintrackastra/tracking/ilp.pyAttributeError: module 'motile' has no attribute 'constraints'that started occurring after motile 1.0.1 was released on 2026-07-21Root cause
motile 1.0.1 moved the
from .constraints.constraint import Constraintimport in itssolver.pybehindif TYPE_CHECKING:(+from __future__ import annotations). In 1.0.0, that top-level import caused Python to registermotile.constraintsinsys.modulesas a side effect ofimport motile, makingmotile.constraints.MaxParentsetc. work. In 1.0.1, the subpackage is never imported at runtime, somotile.constraintsraisesAttributeError.The same could happen to
motile.costsandmotile.variablesin a future release, so all three are now imported explicitly.Test plan
ruff checkpasses on the changed file