Skip to content

Drop dependencies#279

Merged
julianstirling merged 9 commits intomainfrom
drop-dependencies
Mar 4, 2026
Merged

Drop dependencies#279
julianstirling merged 9 commits intomainfrom
drop-dependencies

Conversation

@rwb27
Copy link
Collaborator

@rwb27 rwb27 commented Mar 3, 2026

This PR gets rid of dependencies, included the much-disliked DirectThingClient. It also removes blob_type.

The code that's deleted is:

  • labthings_fastapi.deps (a convenience-import module for dependencies)
  • labthings_fastapi.dependencies.* (includes a bunch of submodules)
  • labthings_fastapi.blob.blob_type (function that returns a Blob subclass)

I've also changed the signature of ActionManager.invoke_action and the endpoint that starts an action, to remove the invocation ID dependency. Invocation IDs are now generated in ActionManager.invoke_action.

I've removed the documentation on dependencies, and had a quick skim of the docs to check for anything obsolete in there.

I've checked that this doesn't appear to break the OpenFlexure Microscope Server unit or integration tests, as of b6324e9

Closes #196
Closes #128
Closes #122

@barecheck
Copy link

barecheck bot commented Mar 3, 2026

Barecheck - Code coverage report

Total: 96.31%

Your code coverage diff: -0.21% ▾

Uncovered files and lines
FileLines
src/labthings_fastapi/actions.py507-508, 521, 546-547, 720, 862-863, 866, 869, 917
src/labthings_fastapi/base_descriptor.py287, 301-302, 610
src/labthings_fastapi/outputs/blob.py301, 904-905
src/labthings_fastapi/server/__init__.py178, 192-195, 356

@rwb27 rwb27 added this to the v0.1.0 milestone Mar 3, 2026
@bprobert97
Copy link
Contributor

Not entirely sure how this MR closes #145? It appears this context variable was removed before this MR.

@bprobert97
Copy link
Contributor

I see in the PR description you've put 'I've checked that this doesn't appear to break the OpenFlexure Microscope Server unit or integration tests, as of b6324e9' - It would be good to see some evidence of this. Should we wait until the PR more putting OFM tests in CLI is merged before merging this? Just to be on the safe side.

@bprobert97
Copy link
Contributor

Final note - I'm not worried about test coverage going down 0.21%. The deleted tests only refer to deleted dependency and blob_type functionality.

@julianstirling
Copy link
Contributor

It would be good to see some evidence of this. Should we wait until the PR more putting OFM tests in CLI is merged before merging this? Just to be on the safe side.

I'd put that on the critical path for release rather than merging each MR.

@julianstirling
Copy link
Contributor

Not entirely sure how this MR closes #145? It appears this context variable was removed before this MR.

I have closed #145 as it is already fixed. I think we can just update the description to remove it from the closing list.

@rwb27
Copy link
Collaborator Author

rwb27 commented Mar 4, 2026

Not entirely sure how this MR closes #145? It appears this context variable was removed before this MR.

Ah, at the point when I put that in I had already deleted the invocation-related dependencies, and mistakenly thought it was in that module. Nice to know it was fixed already.

@rwb27
Copy link
Collaborator Author

rwb27 commented Mar 4, 2026

I see in the PR description you've put 'I've checked that this doesn't appear to break the OpenFlexure Microscope Server unit or integration tests, as of b6324e9' - It would be good to see some evidence of this. Should we wait until the PR more putting OFM tests in CLI is merged before merging this? Just to be on the safe side.

As I wrote that, I realised it was almost inevitable that commits would be added and that statement would then become incorrect...

#280 is now passing, so I propose we merge it and rebase this, then merge this once we're happy.

rwb27 and others added 9 commits March 4, 2026 22:27
These tests cover code that will be deleted in this PR.
This commit removes dependencies related to Invocations. It moves generation of the invocation ID into `ActionManager.invoke_action`.
This is replaced by functionality in `Thing._thing_server_interface`.
This is replaced by functionality in `ThingServerInterface`.
This gets rid of a bunch of now-obsolete code that used dependencies for inter-thing communication. The new `lt.thing_slot` system does this much better.

This required removing a section of the docs and its example code, as that was being tested. That's helpful, as said section detailed the features I'm removing.

I have retained the `_dependencies` reference in Sphinx but moved it to a new section on removed features: this should help redirect people to how the code has changed.
blob_type is deprecated in favour of subclassing `Blob` explicitly.
Co-authored-by: Beth <167304066+bprobert97@users.noreply.github.com>
@rwb27 rwb27 force-pushed the drop-dependencies branch from c97ac99 to 265b869 Compare March 4, 2026 22:28
Copy link
Contributor

@julianstirling julianstirling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I note that @bprobert97's comments have been acted on. Great to see the OFM tests running on this with no problems (as expected, but nice to see).

This is a very very useful clean up of the repository. Delighted to accept it.

@julianstirling julianstirling merged commit ac66808 into main Mar 4, 2026
14 of 15 checks passed
@julianstirling julianstirling deleted the drop-dependencies branch March 4, 2026 23:10
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.

Remove dependencies from the codebase Retire blob_type Make it clearer that DirectThingClient actions don't require dependencies

3 participants