Minimum Intrusion Grid (MiG) Utilities library
Project description
=========
mig_utils
=========
.. image:: https://travis-ci.org/rasmunk/mig_utils.svg?branch=master
:target: https://travis-ci.org/rasmunk/mig_utils
.. |br| raw:: html
A Minimum Intrusion Grid(MiG) utilities python library:
It includes the mig.io module that provides access to MiG Sharelinks through
python by wrapping around (https://github.com/althonos/fs.sshfs) for sshfs
connections.
Installation
------------
Installation from pypi
.. code-block:: sh
pip install mig-utils
Installation from a local git repository
.. code-block:: sh
cd mig-utils
pip install .
IO Example
----------
ERDA (https://erda.dk) sharelink access with python3 example.
A likewise sharelink class (IdmcShare) exists for IDMC (https://idmc.dk)
.. code-block:: python
# First import the class that gives you access to the share in question*
from mig.io import ErdaShare
# Initialize sharelink
share = ErdaShare('SHARELINKID')
# List files/dirs in share
print(share.list())
# Read file directly as string
print(share.read('tmp'))
# Read file directly as binary
print(str(share.read_binary('tmp')))
# Get a _io.TextIOWrapper object with automatic close
with share.open('tmp', 'r') as tmp:
print(tmp.read())
# Get a default _io.TextIOWrapper object with manual lifetime
file = share.open('tmp', 'r')
print(file.read())
file.close()
# Writing strings to a file
test_string = "Hello There"
test_num = 42342342
test_float = 3434.231
with share.open('write_test', 'w') as w_file:
w_file.write(test_string)
w_file.write(str(test_num))
w_file.write(str(test_float))
# Writing bytes to a file
test_binary = b'Hello again'
test_b_num = (255).to_bytes(1, byteorder=sys.byteorder)
with share.open('binary_test', 'wb') as b_file:
b_file.write(test_binary)
b_file.write(test_b_num)
# Removing files, likewise for dirs by using share.removedir(path)
share.remove('writes_test')
share.remove('binary_test')
mig_utils
=========
.. image:: https://travis-ci.org/rasmunk/mig_utils.svg?branch=master
:target: https://travis-ci.org/rasmunk/mig_utils
.. |br| raw:: html
A Minimum Intrusion Grid(MiG) utilities python library:
It includes the mig.io module that provides access to MiG Sharelinks through
python by wrapping around (https://github.com/althonos/fs.sshfs) for sshfs
connections.
Installation
------------
Installation from pypi
.. code-block:: sh
pip install mig-utils
Installation from a local git repository
.. code-block:: sh
cd mig-utils
pip install .
IO Example
----------
ERDA (https://erda.dk) sharelink access with python3 example.
A likewise sharelink class (IdmcShare) exists for IDMC (https://idmc.dk)
.. code-block:: python
# First import the class that gives you access to the share in question*
from mig.io import ErdaShare
# Initialize sharelink
share = ErdaShare('SHARELINKID')
# List files/dirs in share
print(share.list())
# Read file directly as string
print(share.read('tmp'))
# Read file directly as binary
print(str(share.read_binary('tmp')))
# Get a _io.TextIOWrapper object with automatic close
with share.open('tmp', 'r') as tmp:
print(tmp.read())
# Get a default _io.TextIOWrapper object with manual lifetime
file = share.open('tmp', 'r')
print(file.read())
file.close()
# Writing strings to a file
test_string = "Hello There"
test_num = 42342342
test_float = 3434.231
with share.open('write_test', 'w') as w_file:
w_file.write(test_string)
w_file.write(str(test_num))
w_file.write(str(test_float))
# Writing bytes to a file
test_binary = b'Hello again'
test_b_num = (255).to_bytes(1, byteorder=sys.byteorder)
with share.open('binary_test', 'wb') as b_file:
b_file.write(test_binary)
b_file.write(test_b_num)
# Removing files, likewise for dirs by using share.removedir(path)
share.remove('writes_test')
share.remove('binary_test')
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
mig-utils-0.1.2.tar.gz
(3.1 kB
view hashes)
Built Distributions
mig_utils-0.1.2-py3.6.egg
(5.4 kB
view hashes)
Close
Hashes for mig_utils-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73a8cf199dd20c07ffe3d56d23ea5cb5626c9bce0d26b38cf566ece3815326d0 |
|
MD5 | b4e5fb9a3a45af270df26214300e68d0 |
|
BLAKE2b-256 | 178183198cc823fdc172b25b1dafb4fbc6320258aa9e0b71893202e4a25eb806 |