-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new API design doc #447
Changes from 1 commit
ee800d4
1702bb2
6340c9b
ffd6ac1
9e2d414
58500c1
6d731db
6661c28
20cc7dc
3f62f3d
21f361a
7d3266f
201b081
af512df
6f84091
2b32d56
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
DandiMeta
to DandisetMeta
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ Designs for an improved Python API | |
* `get_assets() -> Iterator[Asset]` | ||
* `get_assets_under_path(path: str) -> Iterator[Asset]` — Returns all assets whose paths are either under the given folder or equal the given filepath | ||
* `get_asset_by_path(path: str) -> Optional[Asset]` — Finds the unique asset with the given exact path; returns `None` if no such asset | ||
* `get_metadata() -> DandiMeta` | ||
* `get_metadata() -> DandisetMeta` | ||
* `Asset`: | ||
* `path: str` | ||
* `sha256: str` | ||
|
@@ -37,7 +37,7 @@ Designs for an improved Python API | |
* Add a `get_draft_dandiset(dandiset_id: Union[str, RemoteDandiset]) -> DraftDandiset` method | ||
* Add a `get_dandisets() -> Iterator[RemoteDandiset]` method | ||
* These objects' `Version`s are the `most_recent_version`s | ||
* Retype `create_dandiset` to `create_dandiset(metadata: DandiMeta) -> RemoteDandiset` | ||
* Retype `create_dandiset` to `create_dandiset(metadata: DandisetMeta) -> RemoteDandiset` | ||
* Add a `create_local_dandiset(dirpath: Union[str, Path], name: str, description: str) -> LocalDandiset` method that, in addition to calling `create_dandiset()`, also creates a `dandiset.yaml` file in `dirpath`? | ||
* Add a `get_current_user() -> User` method | ||
* Add a `search_users(username: str) -> Iterator[User]` method | ||
|
@@ -63,7 +63,7 @@ Designs for an improved Python API | |
* `get_users() -> Iterator[User]` | ||
* `set_users(users: List[User]) -> None` | ||
* Should this method also accept strings giving the usernames directly? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would not bother interfacing users calls for now at all at this point |
||
* `get_metadata() -> DandiMeta` | ||
* `get_metadata() -> DandisetMeta` | ||
* `get_raw_metadata() -> dict` — useful when the metadata is invalid | ||
* `publish() -> Version` (Should this be moved to `DraftDandiset`?) | ||
* `get_assets() -> Iterator[RemoteAsset]` | ||
|
@@ -77,7 +77,7 @@ Designs for an improved Python API | |
* TO DO: Add an argument for controlling whether to create a directory under `target_dir` with the same name as the Dandiset ID? | ||
|
||
* Methods of the `DraftDandiset` class (a subclass of `RemoteDandiset` used only for mutable draft versions): | ||
* `set_metadata(metadata: DandiMeta) -> DraftDandiset` — returns the new, modified object | ||
* `set_metadata(metadata: DandisetMeta) -> DraftDandiset` — returns the new, modified object | ||
* Methods for uploading an individual asset: | ||
* `upload_file(filepath: Union[str, Path], metadata: BareAssetMeta, show_progress=True, existing="refesh", validation="require") -> RemoteAsset` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The idea of this method is to support generic file uploads where the user crafts the metadata themselves. If we only want to support upload of files that can be represented with |
||
* `iter_upload_file(filepath: Union[str, Path], metadata: BareAssetMeta, existing="refesh", validation="require") -> Iterator[UploadProgressDict]` | ||
|
@@ -146,11 +146,11 @@ Designs for an improved Python API | |
* `done%: float` — percentage of bytes downloaded (Rename to "download"? or "pct"?) | ||
* `checksum: str` — `"differs"`, `"ok"`, or `"-"` | ||
|
||
* **To discuss:** Should methods that accept `DandiMeta` and `(Bare|Remote)AssetMeta` instances also accept raw `dict`s? If so, should any validation be done on these `dict`s? | ||
* **To discuss:** Should methods that accept `DandisetMeta` and `(Bare|Remote)AssetMeta` instances also accept raw `dict`s? If so, should any validation be done on these `dict`s? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think for starters we can just add a dedicated There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pydantic already provides |
||
|
||
* `dandi.dandiset`: Expand the ability for `Dandiset` (renamed to `LocalDandiset` and made a subclass of the new `Dandiset` base class) to represent a Dandiset on disk: | ||
* `path: Path` (or `dandiset_path`?) | ||
* `set_metadata(metadata: DandiMeta) -> None` ? | ||
* `set_metadata(metadata: DandisetMeta) -> None` ? | ||
* `validate_metadata() -> None` | ||
* `validate_assets() -> ???` ? | ||
* Make `organize()` a method of this class? | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UX sugarings we should consider add on top
? they might be tricky with subclassing though since IIRC we cannot just bind the property to get _assets in super class, since then subclasses .assets would us it instead of overloaded... May be properties should be lazy (cached value) invocations over the methods? That would give them a better purpose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not clear on what exactly you're proposing here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smth like
but we can think about all the sugaring later