A high-level API for interacting with the Human Brain Project archival storage at CSCS
Project description
A high-level API for interacting with the Human Brain Project archival storage at CSCS.
Authors: Andrew Davison and Shailesh Appukuttan, CNRS
Documentation: https://hbp-archive.readthedocs.io
Installation: `pip install hbp_archive`
Usage:
```python
from hbp_archive import Container, PublicContainer, Project, Archive
# Working with a public container
container = PublicContainer("https://object.cscs.ch/v1/AUTH_id/my_container")
files = container.list()
local_file = container.download("README.txt")
print(container.read("README.txt"))
number_of_files = container.count()
size_in_MB = container.size("MB")
# Working with a private container
container = Container("MyContainer", username="xyzabc") # you will be prompted for your password
files = container.list()
local_file = container.download("README.txt", overwrite=True) # default is not to overwrite existing files
print(container.read("README.txt"))
number_of_files = container.count()
size_in_MB = container.size("MB")
container.move("my_file.dat", "a_subdirectory", "new_name.dat") # move/rename file within a container
# Reading a file directly, without downloading it
with container.open("my_data.txt") as fp:
data = np.loadtxt(fp)
# Working with a project
my_proj = Project('MyProject', username="xyzabc")
container = my_proj.get_container("MyContainer")
# Listing all your projects
archive = Archive(username="xyzabc")
projects = archive.projects
container = archive.find_container("MyContainer") # will search through all projects
```
Authors: Andrew Davison and Shailesh Appukuttan, CNRS
Documentation: https://hbp-archive.readthedocs.io
Installation: `pip install hbp_archive`
Usage:
```python
from hbp_archive import Container, PublicContainer, Project, Archive
# Working with a public container
container = PublicContainer("https://object.cscs.ch/v1/AUTH_id/my_container")
files = container.list()
local_file = container.download("README.txt")
print(container.read("README.txt"))
number_of_files = container.count()
size_in_MB = container.size("MB")
# Working with a private container
container = Container("MyContainer", username="xyzabc") # you will be prompted for your password
files = container.list()
local_file = container.download("README.txt", overwrite=True) # default is not to overwrite existing files
print(container.read("README.txt"))
number_of_files = container.count()
size_in_MB = container.size("MB")
container.move("my_file.dat", "a_subdirectory", "new_name.dat") # move/rename file within a container
# Reading a file directly, without downloading it
with container.open("my_data.txt") as fp:
data = np.loadtxt(fp)
# Working with a project
my_proj = Project('MyProject', username="xyzabc")
container = my_proj.get_container("MyContainer")
# Listing all your projects
archive = Archive(username="xyzabc")
projects = archive.projects
container = archive.find_container("MyContainer") # will search through all projects
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hbp_archive-0.7.0.tar.gz
(14.6 kB
view details)
File details
Details for the file hbp_archive-0.7.0.tar.gz
.
File metadata
- Download URL: hbp_archive-0.7.0.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d758c2bbcaa22cb085ee64bcc5df6da73a88a6832e8c75e8cfdb3023e5a1f148 |
|
MD5 | c9e49ef0b126aa050c64bc4613e4fa27 |
|
BLAKE2b-256 | d9171f879da73378708d972572664807bb748a227a051b78b08a2b5839a3f9f8 |