You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#158 adds uri but leaves path and url in place, so all three now name a location. Proposal for how they should relate, for discussion before anything is changed.
uri is derived on every access and never stored, so it cannot go stale when the underlying handle changes.
Callers that only want to know where a file lives, log it, compare two controllers, or hand a location to something else use uri and nothing else.
path and url stay, as backend-native handles
They are not redundant with uri, they are the input uri is derived from, and each is the type its backend actually works with:
LocalFileController.path is a pathlib.Path and is used as a path, not as a string: src/osw/express.py:335, :367, :368. It is also part of the public return of osw_download_file(...), which callers use to open the downloaded file.
So the collapse happens at the interface, not in the storage: one name to read a location, the native handle kept where the backend needs it. Removing path and url outright would be a breaking change for a gain that uri already delivers.
Missing piece: the write side
uri has no counterpart for going the other way. A from_uri() classmethod on FileController that dispatches on the scheme would close that:
with FileController.from_uri(c.uri) round-tripping for every controller that has a uri. That is what makes uri an actual interchange format rather than a display string, and it gives from_other / put_from a way to start from a location instead of an already-built controller.
Loose ends
model.RemoteFile does not declare url, so RemoteFileController.uri returning self.url relies on a contract the subclasses happen to keep rather than one the base class states. Declaring url on RemoteFile would fix that, again as a schema change.
The wiki controllers need credentials to build a uri, so from_uri for https:// cannot be a pure constructor. It needs an osw or cred_mngr argument, unlike the local and S3 cases.
Activity
LukasGold commentedon Sep 2, 2026
path/url/uriacross the file controllers#158 adds
uribut leavespathandurlin place, so all three now name a location. Proposal for how they should relate, for discussion before anything is changed.uriis the read interfaceuriin the scheme of its own backend:file://for https://github.com/OpenSemanticLab/osw-python/blob/main/src/osw/controller/file/local.py,s3://forS3FileController,https://<domain>/wiki/File:...forWikiFileController,NoneforInMemoryController.uriis derived on every access and never stored, so it cannot go stale when the underlying handle changes.uriand nothing else.pathandurlstay, as backend-native handlesThey are not redundant with
uri, they are the inputuriis derived from, and each is the type its backend actually works with:LocalFileController.pathis apathlib.Pathand is used as a path, not as a string:src/osw/express.py:335,:367,:368. It is also part of the public return ofosw_download_file(...), which callers use to open the downloaded file.model.S3File.urlis a field of the wiki schema atCategory:OSWc43f749badcb4490a785505de1fc7d20, fetched at runtime by https://github.com/OpenSemanticLab/osw-python/blob/main/examples/file_upload_download.py#L22-L24. Renaming it is a schema change plus a jsondata migration on every existing S3File page, not a Python-only rename.WikiFileController.urlis already a derived property (https://github.com/OpenSemanticLab/osw-python/blob/main/src/osw/controller/file/wiki.py#L167), so there it isuriunder another name.So the collapse happens at the interface, not in the storage: one name to read a location, the native handle kept where the backend needs it. Removing
pathandurloutright would be a breaking change for a gain thaturialready delivers.Missing piece: the write side
urihas no counterpart for going the other way. Afrom_uri()classmethod onFileControllerthat dispatches on the scheme would close that:with
FileController.from_uri(c.uri)round-tripping for every controller that has auri. That is what makesurian actual interchange format rather than a display string, and it givesfrom_other/put_froma way to start from a location instead of an already-built controller.Loose ends
model.RemoteFiledoes not declareurl, soRemoteFileController.urireturningself.urlrelies on a contract the subclasses happen to keep rather than one the base class states. DeclaringurlonRemoteFilewould fix that, again as a schema change.uri, sofrom_uriforhttps://cannot be a pure constructor. It needs anosworcred_mngrargument, unlike the local and S3 cases.