Pipeline imports break when easyStitch is consumed as a package #32
Labels
No labels
blocked:children
blocked:depends-101
blocked:depends-103
blocked:depends-104
blocked:needs-attention
blocked:needs-decision
blocked:no-changes
blocked:preflight
bug
chore
feature-request
in-progress
lint-cleanup
needs-decompose
performance
quality
quickfix
security/medium
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/easystitch#32
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug
src/main_pipeline.pyuses top-level (non-relative) imports for componentsin the same package:
These should be relative imports (or absolute imports rooted at the package
name) for the package to be importable from anywhere. As written, the pipeline
only works if you
cd src && python -m main_pipelineor use the Docker imagewhich sets
WORKDIR /app/src.Reproduction
vs.:
Impact
importeasyStitch as aPython package; it has to manipulate
sys.pathto make the relativeimports resolve. That's a deploy-time footgun.
Fix
Change the 5 imports in
src/main_pipeline.pyto be relative or absolute-from-package:Apply the same audit across the rest of
src/— any module that imports asibling should use relative imports. Grep for
^from [a-z_]+ import(not^from \.) insrc/main_pipeline.py,src/main.py, and the entry-pointmodules.
Add a CI step that runs
python -c "import easystitch"(or whatever thepackage name is) from outside
src/to catch this class of bug.Acceptance
import easystitch(orfrom <pkg> import EmbroideryPipeline) works fromany working directory.
importeasyStitch withoutsys.pathhacks.Cross-link: ThreadCraft #11 — unblocks the wrapper's ability to import easyStitch as a package.