Skip to content

opencadc/cadctools

Repository files navigation

cadctools

https://github.com/opencadc/cadctools/workflows/CI/badge.svg?branch=master&event=schedule

Client tools and utilities for using Canadian Astronomy Data Centre services

Developers Guide

Requires pip.

Installing Packages

Note: might need to escape chars in your shell

cd cadcutils && pip install -e .[test]
cd cadcdata && pip install -e .[test]
cd cadctap && pip install -e .[test]

Testing packages

Testing cadcutils

cd ./cadcutils
pytest cadcutils

Testing cadcdata

cd ./cadcdata
pytest cadcdata

Testing cadctap

cd ./cadcdata
pytest cadctap

Checkstyle

flake8 style checking is enforced on pull requests. Following commands should not report errors

flake8 cadcutils/cadcutils cadcdata/cadcdata

Testing with tox

If tox, the generic virtual environment tool, is available it can be used to test with different versions of python is isolation. For example, to test on all supported versions of Python in cadcdata (assuming that they are available in the system):

cd ./cadcdata && tox

To test a specific version:

cd ./cadcdata && tox -e py3.9

To list all the available environments:

cd ./cadcdata && tox -a

Usage Example

In library mode

Write the following into a file named test.py

from cadcdata import StorageInventoryClient
print(StorageInventoryClient().cadcinfo('cadc:IRIS/I429B4H0.fits'))

Then Run

python test.py

Direct Usage

After installing the cadcdata package, run

cadcget cadc:IRIS/I429B4H0.fits

This will download the fits file to your current directory.

To see more information do

cadcput --help
cadcget --help
cadcinfo --help
cadcremove --help

Docker image

Rather than deploying a project environment, you could just use docker.

To use

  1. Install docker.

  2. Then run:

    docker build . -t cadc/cadctools
    docker run --name cadctools cadc/cadctools