# Installation

There are several different ways to install the `asdf` package. Each is described in detail below.

## Requirements

The `asdf` package has the following dependencies:

- python 3.3 or later
- numpy 1.8 or later
- jsonschema 2.3.0 or later
- pyyaml 3.10 or later
- semantic_version 2.3.1 or later
- six 1.9.0 or later

Support for units, time, transform, wcs, or running the tests also requires:

- astropy 3.0 or later

Optional support for lz4 compression is provided by:

- lz4 0.10 or later

Also required for running the tests:

- pytest-astropy

## Installing with pip

Stable releases of the ASDF Python package are registered at PyPi. The latest stable version can be installed using `pip`:

    $ pip install asdf

## Installing with conda

ASDF is also distributed as a conda package via the conda-forge channel. It is also available through the astroconda channel.

To install `asdf` within an existing conda environment:

    $ conda install -c conda-forge asdf

To create a new conda environment and install `asdf`:

    $ conda create -n new-env-name -c conda-forge python asdf

## Building from source

The latest development version of ASDF is available from the `master` branch on github. To clone the project:

    $ git clone https://github.com/spacetelescope/asdf

To install:

    $ cd asdf
    $ git submodule update --init
    $ pip install .

To install in development mode:

    $ pip install -e .

Note

The source repository makes use of a git submodule for referencing the schemas provided by the ASDF standard. While this submodule is automatically initialized when installing the package (including in development mode), it may be necessary for developers to manually update the submodule if changes are made upstream. See the documentation on git submodules for more information.

## Running the tests

To install the test dependencies from a source checkout of the repository:

    $ pip install -e .[tests]

To run the unit tests from a source checkout of the repository:

    $ pytest

It is also possible to run the test suite from an installed version of the package. In a Python interpreter:

    import asdf
    asdf.test()

Please note that the astropy package must be installed to run the tests.

It is also possible to run the tests using tox. It is first necessary to install `tox` and tox-conda:

    $ pip install tox tox-conda

To list all available environments:

    $ tox -va

To run a specific environment:

    $ tox -e <envname>