Skip to content

Make dependencies smaller: use tiled[minimal-client] - #69

Merged
genematx merged 7 commits into
mainfrom
make-dependencies-smaller
Oct 14, 2026
Merged

genematx merged 7 commits into
mainfrom
make-dependencies-smaller

Conversation

@ZohebShaikh

Copy link
Copy Markdown
Contributor

I'm trying to make the dependencies of bluesky-tiled-plugins smaller so that downstream services such as blueapi don't have to install the whole of tiled[client] just to use TiledWriter.

This swaps tiled[client] for tiled[minimal-client] and lists the packages the plugin actually imports at module level:

  • xarray: clients/bluesky_event_stream.py
  • pandas: streaming.py
  • pyarrow: writing/tiled_writer.py
  • numpy
  • ndindex: imported by tiled.ndslice. None of tiled's smaller extras include it.

Size

Measured as a runtime install of blueapi (no dev dependencies):

Install size
with tiled[client] 730 MB
with this branch 497 MB (about 32% smaller)

Most of the saving comes from llvmlite and numba (about 190 MB together), plus blosc2, zstandard, awkward, sparse and numexpr.

Known limitation

Ragged arrays still need awkward and ragged, which only tiled[client] provides. _write_internal_data imports tiled.structures.ragged lazily, so a scan with a variable-length array signal fails during the scan, not at import time. Happy to add an optional ragged extra if you'd prefer that.

Testing

  • blueapi's unit tests pass against this branch.
  • An ophyd-async count with TiledWriter against a local tiled server writes and reads back correctly, including arrays large enough to be written as zarr arrays.

Downstream PR: DiamondLightSource/blueapi#1665

🤖 Generated with Claude Code

ZohebShaikh and others added 3 commits October 6, 2026 14:57
The plugin imports xarray, pandas, pyarrow and numpy at module level,
and tiled.ndslice needs ndindex, which tiled's xarray extra omits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.76%. Comparing base (2d1d76a) to head (05d5c67).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #69      +/-   ##
==========================================
+ Coverage   78.38%   78.76%   +0.38%     
==========================================
  Files          16       16              
  Lines        2387     2430      +43     
==========================================
+ Hits         1871     1914      +43     
  Misses        516      516              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…d deps

With tiled[minimal-client], the awkward and ragged packages are no longer
installed, so writing ragged (variable-length) array data fails at the lazy
import inside TiledWriter. Declare the optional dependencies as published
extras -- bluesky-tiled-plugins[ragged] (pins matching the tiled[client]
extra) and an [all] aggregate -- and wrap the lazy import so the mid-scan
failure tells the user which extra to install.

Also bump the minimum tiled to 0.2.19 (runtime and test group).
The test dependency group includes tiled[server], which transitively provides
awkward, ragged, and more -- so the regular test jobs can not catch a missing
runtime dependency. Add a minimal-install job that installs the package with
no extras and no dependency groups, then runs tests/minimal_smoke.py: it
import-walks every submodule (except the server-only routers.validator),
exercises the document-processing machinery without a server, and asserts the
optional ragged dependencies are genuinely absent so the slimmed dependency
footprint can not silently regress.

The smoke script is not collected by pytest (no test_ prefix); it fails by
design in a full dev environment.
@genematx

Copy link
Copy Markdown
Contributor

Thank you, Zoheb. I've added ragged and awkward as optional dependencies in bluesky-tiled-plugins[ragged], added a smoke test, and also bumped the minimal version of Tiled.

The name-tests-test pre-commit hook requires files under tests/ to match
test_*.py, and the smoke script must not be collected by pytest (it fails by
design in a full dev environment). Place it under .github/scripts/, next to
the workflow that runs it.
The CI jobs only check out the repository and run tests; the codecov upload
authenticates with its own CODECOV_TOKEN secret. Setting an explicit minimal
permissions block follows the practice already used in cd.yml and resolves
the GitHub Actions security warning.
@genematx
genematx merged commit 300ee50 into main Oct 14, 2026
18 checks passed
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