Split core dependencies from models extra#75
Merged
Conversation
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
This change separates slide2vec's lightweight core dependencies from the heavier model integration stack and introduces a dedicated
slide2vec[models]extra for the full model runtime.Users who only need the core package surface, artifact handling, and configuration helpers can continue to install the base package without pulling in the full model stack. Users who want model execution can opt into the
modelsextra or the repository's foundation requirements overlay.Problem
The repository's dependency story mixed together core runtime requirements and optional model-integration requirements. That made it hard to isolate the minimal install surface, and it also blurred which dependencies were truly required by core modules versus only needed for model backends and external integrations.
While splitting the dependencies, there was an important constraint to preserve: several packages that look model-adjacent are still imported by core data and inference paths. In practice,
torch,torchvision,einops,wholeslidedata,matplotlib, andwandbstill need to remain in the base/core requirements because those modules import them directly.Root Cause
The original packaging metadata and repository requirements files treated all runtime dependencies as one layer. The repository also had a runtime
transformerstype import inslide2vec.data.dataset, which made the split more coupled than necessary.Fix
This PR updates
setup.cfgso the package metadata keeps true core runtime dependencies ininstall_requiresand moves the heavier model integration packages into amodelsextra.It also updates
requirements.inandrequirements.txtso the shared core runtime dependencies stay generic there, whilerequirements-foundation.inlayers on top with the strictertorch,torchvision, andeinopsversion constraints used by the full model runtime. The Docker build paths were updated to install from that full overlay.To make the boundary cleaner,
slide2vec.data.datasetnow keeps thetransformersimport underTYPE_CHECKINGand uses a lightweight runtime capability check instead of a runtimeBaseImageProcessortype import.Finally, the README and dependency regression coverage were updated so the public install story and the packaging rules stay aligned.