Conversation
Release previewNo version bump from the current commits (stays at Changelog preview (truncated)Preview via python-semantic-release and conventional commits. |
- file:// for LocalFileController, via Path.as_uri - the stored url for RemoteFileController, so s3:// and https:// follow - None for InMemoryController, a stream has no location
998e846 to
5ec4038
Compare
- returns None on the base class, so controllers outside this package that predate uri stay instantiable (ModelMetaclass extends ABCMeta) - document uri as the derived read interface for a location - state the implicit url contract on RemoteFileController
|
Changed Reason: pydantic v1's That is a breaking change for any file controller outside this package, and it was not marked as one, so it would have shipped as a minor release.
Follow-up on harmonizing |
LukasGold
left a comment
There was a problem hiding this comment.
Reasonable changes that provide a uniform access point
|
Closing and reopening to make the Integration workflow attach to this PR. It never ran here because the branch was originally stacked on fix/in-memory-file-upload, and retargeting to main did not register the pull_request trigger. |
Closes #68.
Stacked on #148, which makes
InMemoryControllerconstructible. Merge that first, this base retargets tomainautomatically.Changes
FileController.uri: the location of the file in the URI scheme of its storage backend. Concrete, returnsNoneby default.LocalFileController.uri:file://, viaPath.absolute().as_uri(), see https://en.wikipedia.org/wiki/File_URI_scheme.RemoteFileController.uri: the storedurl.S3FileControllerandWikiFileControllerinherit it, so they reports3://...andhttps://.../wiki/File:...without an override.InMemoryController.uri:None.tests/test_file_controller_uri.py: 7 offline tests.Rationale
A caller holding a
FileControllerhad no way to ask where the file actually is. Each subclass kept that in a different shape: aPath, aurl, or nothing at all.WikiFileControlleralready builds the page url in itsurlproperty (src/osw/controller/file/wiki.py:167), andS3FileControllerparsesself.urlfor its bucket and key, so puttingurionRemoteFileControllercovers both from what they already carry.uriis a read interface: derived on every access, never stored, so it cannot go stale. Each controller keeps the handle its backend actually needs and answersuriin its own scheme. The wider harmonization ofpath/url/uri, and afrom_uri()write-side counterpart, are proposed in #68 (comment) and are out of scope here.Notes
ModelMetaclassextendsABCMeta, so@abstractmethodis enforced at instantiation and an abstracturiwould break every file controller outside this package that predates it. A concreteNonedefault keeps this afeat, not a breaking change.InMemoryControllerreturnsNonerather than raising. A stream is a legitimate file source, it just has no address.Verification
Offline suite passes (66 passed, 1 skipped). The wiki and S3 controllers need a live backend, so their
uriis covered throughRemoteFileControllerand, for the wiki page url, by calling the property directly on a stand-in.