Skip to content

Run the Docker build checks with python -I - #4

Merged
traviswheeler merged 1 commit into
mainfrom
fix_docker_build_checks
Aug 13, 2026
Merged

Run the Docker build checks with python -I#4
traviswheeler merged 1 commit into
mainfrom
fix_docker_build_checks

Conversation

@traviswheeler

Copy link
Copy Markdown
Member

The build-time checks added in #3 were inspecting the wrong copy of the package, so the
assertion meant to catch a packaging regression could never fail.

The image holds two copies of BLIMMP_Scripts: the source tree that COPY . . puts at
/app, and the copy pip builds into site-packages. The source tree has every data file,
since they are checked into git. The installed copy has only what package_data selected,
which is what broke in 0.1.2. Both build checks ran under WORKDIR /app, and python -c
puts the working directory first on sys.path, so import BLIMMP_Scripts resolved to
/app and never reached site-packages.

Two effects, both present in the published 0.1.3 image:

  • The packaged-data assertion checked files that exist by construction, so it passed
    regardless of what pip installed. The broken 0.1.2 image would have built cleanly
    under it.
  • ensure_module_graphs() extracted the KEGG module graphs into /app, where nothing
    reads them. site-packages got none of the 340 module_*_nodes.json files, so each run
    re-extracts from the zip into a cache directory.

Adding -I to both commands keeps the working directory off sys.path. The graphs now
extract into the installed package and get baked into the image, and the assertion fails
the build if package_data drops a file again.

Runs were never affected. The BLIMMP console script lives in /usr/local/bin, and for a
script Python puts the script's own directory on sys.path rather than the working
directory, so real runs have always imported from site-packages. Results from 0.1.3 are
correct.

Verification: CI passes on this branch, including the read-only filesystem case, and the
build log now prints

module graphs: /usr/local/lib/python3.10/site-packages/BLIMMP_Scripts/Graph_Dependencies/KEGG_Graphs_Generated_March26
packaged data OK

where it previously printed an /app path. I also confirmed the 0.1.3 behavior directly
by pulling that image's layers from ghcr: site-packages holds the data files but no
extracted graphs, and the extraction sits under /app.

After merge, bump to 0.1.4 and tag v0.1.4 to publish an image with the graphs
pre-extracted.

The image carries two copies of the package: the source tree that
COPY . . places at /app, and the copy pip builds into site-packages.
The source tree has every data file, because they are checked into git.
The installed copy has only what package_data selected, which is what
was broken in 0.1.2.

The build checks were reading the wrong copy. Both ran under WORKDIR
/app, and python -c puts the working directory at the head of sys.path,
so `import BLIMMP_Scripts` found /app/BLIMMP_Scripts and never reached
site-packages. Nothing outside the image was involved; both copies are
baked in.

Two consequences, both visible in the published 0.1.3 image:

  - The packaged-data assertion inspected the source tree, where the
    five required files exist by construction. It could not fail. That
    is why the broken 0.1.2 image built cleanly, and it means the guard
    added against a packaging regression did nothing.

  - ensure_module_graphs() resolved its target directory relative to the
    source copy, so the KEGG module graphs extracted into /app, which
    nothing reads at run time. site-packages received none of the 340
    module_*_nodes.json files, so every run re-extracts from the zip
    into a cache dir instead of using graphs baked into the image.

Run time was never affected. The BLIMMP console script lives in
/usr/local/bin, and for a script Python puts the script's own directory
on sys.path rather than the working directory, so real runs have always
imported from site-packages.

-I (isolated mode) keeps the working directory off sys.path, so both
commands resolve to the installed copy. The assertion now fails the
build if package_data drops a file again.

Verified against the published 0.1.3 image by pulling its layers from
ghcr: site-packages holds the data files but no extracted graphs, and
the extraction sits under /app instead.

Once merged, bump the version to 0.1.4 and tag v0.1.4 to publish an
image with the graphs pre-extracted.

Implemented with assistance from Claude (Opus 5)
@traviswheeler
traviswheeler merged commit f4b8156 into main Aug 13, 2026
2 checks passed
@traviswheeler
traviswheeler deleted the fix_docker_build_checks branch August 13, 2026 14:55
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.

1 participant