Skip to main content

CADC VOS Class Libraries

Project description

https://img.shields.io/pypi/v/vos.svg

vos is a set of python modules and scripts that ease access to VOSpace.

The default installation of vos is tuned for accessing the VOSpace provided by the Canadian Advanced Network For Astronomical Research (CANFAR)

VOSpace is a Distributed Cloud storage service for use in Astronomy.

There are two ways to use vos:

  1. access VOSpace using the command-line script: eg. vcp

  2. use the vos module inside a Python script: import vos

Authentication to the CANFAR VOSpace service is performed using X509 security certificates, header tokens or username/password pairs. The authentication system is managed by the CADC Group Management Service (GMS).

To retrieve an X509 security certificate for use with the vos tools use the cadc-get-cert script included with this package.

Additional information is available in the CANFAR documentation

System Requirments

  • A CANFAR VOSpace account (required for WRITE access, READ access can be anonymous)

  • fuse OR OSX-FUSE (see additional documentation, only required for filesystem based access, not for command line or programmatic)

  • python2.6 or later

Installation

vos is distributed via PyPI/vos and PyPI is the most direct way to get the latest stable release:

pip install vos --upgrade --user

Or, you can retrieve the github distribution and use

python setup.py install --user

Tutorial

  1. Get a CANFAR account

  2. Install the vos package.

  3. Retrieve a X509/SSL certificate using the cadc-get-cert script installed as part of the cadcutils package that is automatically installed wiht vos.

  4. Example Usage.

    1. Commandline usage:

      • vls -l vos: [List a vospace]

      • vcp vos:jkavelaars/test.txt ./ [copies test.txt to the local directory from vospace]

      • vchmod g+q vos:VOSPACE/foo/bar.txt 'GROUP1, GROUP2, GROUP3' to give three user GROUPs permission to write to this file.

      • vmkdir --help [get a list of command line options and arguments]

      • vmkdir, vrm, vrmdir, vsync vcat, vchmod and vln

      • The complete list of vos commmand line tools can be found using pydoc vos.commands

    2. In a Python script (the example below provides a listing of a vospace container)

      #!python
      import vos
      client = vos.Client()
      client.listdir('vos:jkavelaars')

Development

A virtual environment (venv) is recommended to set up external dependencies without installing them system-wide. Following these instructions, install virtualenv:

$ pip install virtualenv

Next, create, and activate a local venv (this example uses bash):

$ virtualenv venv
$ source venv/bin/activate

Setup the new development environment for testing by installing the appropriate packages:

$ pip install -r dev_requirements.txt

The test environment is built into the setup.py so that conducting unit-tests can be achieved like so:

$ python setup.py test

If you would like versbose output formated as a web page, for example, you can add options to the test call:

$ python setup.py test --addopts '--cov-report html:cov_html --cov=vos'

The same option attribute can be used to pass other arguments to py.test that is executing the test. To run specific only tests for example:

$ python setup.py test --addopts 'vos/test/Test_vos.py::TestClient::test_transfer_error'

Each time you resume work on the project and want to use the venv (e.g., from a new shell), simply re-activate it:

$ source venv/bin/activate

When done, just issue a

$ deactivate

command to deactivate the virtual environment.

Integration Tests

The integration tests are, at present, designed to run only with the CADC VOSpace. Tests assume that vos and/or vofs packages have been installed.

Activate the venv and install vos

$ source venv/bin/activate.csh
$ pip install vos

Run the tests:

$ ./test/scripts/vospace-all.tcsh

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

vos-3.3.4.tar.gz (96.1 kB view details)

Uploaded Source

Built Distribution

vos-3.3.4-py3-none-any.whl (107.8 kB view details)

Uploaded Python 3

File details

Details for the file vos-3.3.4.tar.gz.

File metadata

  • Download URL: vos-3.3.4.tar.gz
  • Upload date:
  • Size: 96.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for vos-3.3.4.tar.gz
Algorithm Hash digest
SHA256 a0d32e56efff997e8fa4179a0b3b1cc7a713852df8c4254e2343d7c175b9d7c9
MD5 fd7913d2c6d1af5018c6c4faf263adb1
BLAKE2b-256 deecd893f9743a1c511a55ad4dbd236ac6cc3e9d3e5264221d6eb3015d39dbf0

See more details on using hashes here.

File details

Details for the file vos-3.3.4-py3-none-any.whl.

File metadata

  • Download URL: vos-3.3.4-py3-none-any.whl
  • Upload date:
  • Size: 107.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for vos-3.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5f7c87b7778530b3f48e644c129690c54185cca6416595b47e37ab82f1f74a0f
MD5 3e86c0c860157ccb962ed35028e7188f
BLAKE2b-256 4c3408f693f05e527334ec1f434c334dbbbfa07d61601dbcecdea52da0502cb6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page