No project description provided
Project description
irods_fsspec
Allows you to open files from iRODS servers using irods://
URLs in fsspec.
Usage
Implicit authentication
If you already have the iRODS iCommands, log in with iinit
to store your username and password. Subsequent use of irods_fsspec will use those credentials automatically. (You may also set $IRODS_ENVIRONMENT_FILE
in your shell to point to an irods_environment.json
.)
import fsspec
import irods_fsspec
irods_fsspec.register() # register irods:// handler
# Write to iRODS path
f1 = fsspec.open('irods://data.cyverse.org/iplant/home/myuser/test.txt', 'wb')
with f1 as fh:
fh.write(b'test\n')
# Read from iRODS path
f2 = fsspec.open('irods://data.cyverse.org/iplant/home/myuser/test.txt', 'rb')
with f2 as fh:
assert fh.read() == b'test\n'
Explicit authentication
The user, zone, password, and port can all be included in the URL, bypassing the need for iinit
/ iCommands:
f3 = fsspec.open('irods://myuser+iplant:mypass@data.cyverse.org:1247/iplant/home/myuser/test.txt', 'rb')
with f3 as fh:
assert fh.read() == b'test\n'
The format looks like this:
irods://<username>+<zone>:<password>@<hostname>[:<port>]/<path to data object>
Note the +
to separate user name from the zone name. irods_fsspec will use the default port if :<port>
is omitted, but all other components are required.
Filesystem API usage
To use the IRODSFileSystem
API, either import it yourself or use fsspec:
irodsfs = fsspec.filesystem('irods', user='myuser', zone='iplant', password='mypass', host='data.cyverse.org', port=1247)
irodsfs.mkdir('/iplant/home/myuser/_irods_fsspec_test/')
irodsfs.mv('/iplant/home/myuser/test.txt', '/iplant/home/myuser/_irods_fsspec_test/test2.txt')
f4 = irodsfs.open('/iplant/home/myuser/_irods_fsspec_test/test2.txt', 'rb')
with f4 as fh:
assert fh.read() == b'test\n'
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
Built Distribution
File details
Details for the file irods_fsspec-0.0.1.tar.gz
.
File metadata
- Download URL: irods_fsspec-0.0.1.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffa2e16ec97e4958b4dab69b1ae8bf5942a341f4d7506f0e57cc13159559d87f |
|
MD5 | 8ec98d91fdd5cb6f07fd8a5be694e24f |
|
BLAKE2b-256 | 808893f27f35bb1092ada788dc5effaa8edae47dc48621742ec0f41dc74c7521 |
Provenance
File details
Details for the file irods_fsspec-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: irods_fsspec-0.0.1-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33771b100df840f850471a5dc96a1cd1e7c26f94f235724953d66f5b8acf0265 |
|
MD5 | 8bb965ccffc8b2fb3c42cf8fcbd74f44 |
|
BLAKE2b-256 | 8eec24877b2093647d4270c78cdf7d3d3fa08453eb1aa293ac530c7672579b82 |