Skip to content

Commit 191df10

Browse files
authored
Merge pull request #87 from ttngu207/main
Bugfix, improvements to DANDI upload functionality
2 parents 548e4fd + 9e23c3f commit 191df10

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
44
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention.
55

6+
7+
## [0.6.1] - 2023-08-02
8+
9+
+ Update DANDI upload funtionality to improve useability
10+
11+
612
## [0.6.0] - 2023-07-26
713

814
+ Update - `prairieviewreader.py` -> `prairie_view_loader.py`

element_interface/dandi.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def upload_to_dandi(
1212
working_directory: str = None,
1313
api_key: str = None,
1414
sync: bool = False,
15+
existing: str = "refresh",
1516
):
1617
"""Upload NWB files to DANDI Archive
1718
@@ -25,6 +26,7 @@ def upload_to_dandi(
2526
environmental variable DANDI_API_KEY
2627
sync (str, optional): If True, delete all files in archive that are not present
2728
in the local directory.
29+
existing (str, optional): see full description from `dandi upload --help`
2830
"""
2931

3032
working_directory = working_directory or os.path.curdir
@@ -36,11 +38,11 @@ def upload_to_dandi(
3638
working_directory, str(dandiset_id)
3739
) # enforce str
3840

39-
download(
40-
f"https://gui-staging.dandiarchive.org/#/dandiset/{dandiset_id}"
41-
if staging
42-
else f"https://dandiarchive.org/dandiset/{dandiset_id}",
43-
output_dir=working_directory,
41+
dandiset_url = f"https://gui-staging.dandiarchive.org/#/dandiset/{dandiset_id}" if staging else f"https://dandiarchive.org/dandiset/{dandiset_id}/draft"
42+
43+
subprocess.run(
44+
["dandi", "download", "--download", "dandiset.yaml", "-o", working_directory, dandiset_url],
45+
shell=True,
4446
)
4547

4648
subprocess.run(
@@ -52,14 +54,13 @@ def upload_to_dandi(
5254
["dandi", "organize", "-d", dandiset_directory, data_directory], shell=True
5355
)
5456

55-
print(
56-
f"work_dir: {working_directory}\ndata_dir: {data_directory}\n"
57-
+ f"dand_dir: {dandiset_directory}"
57+
subprocess.run(
58+
["dandi", "validate", dandiset_directory], shell=True
5859
)
5960

6061
upload(
61-
[dandiset_directory],
62-
# dandiset_path=dandiset_directory, # dandi.upload has no such arg
62+
paths=[dandiset_directory],
6363
dandi_instance="dandi-staging" if staging else "dandi",
64+
existing=existing,
6465
sync=sync,
6566
)

element_interface/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Package metadata"""
22

3-
__version__ = "0.6.0"
3+
__version__ = "0.6.1"

0 commit comments

Comments
 (0)