This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Installing OCW using the conda package manager

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

 

Code Block
languagebash
conda config --add channels agoodman

Now you can perform any of the above commands without needing to specify '-c agoodman'. 

To upload your packages to the main OCW channel, you will need to obtain a secure token which you may request by sending an email to the dev mailing list (dev@climate.apache.org). If approved, you may update your config with:

Code Block
languagebash
conda config --add channels https://conda.anaconda.org/t/<TOKEN>/agoodman

Where <TOKEN> is the token string.

Updating and Building the OCW conda package

Info

It is highly recommended that you read the conda build documentation first.

Edit the recipe configuration file

The main recipes for the OCW package (and the non-default conda dependencies) can be found in the OCW codebase. Navigate to the conda_recipes directory:

Code Block
languagebash
cd climate/conda_recipes

Each subdirectory contains the recipes specific to each package, and these too will be necessary to edit, rebuild, and upload to the OCW channel if we wish to keep everything up to date. For now though we will focus our example workflow on how to update the main ocw package itself. Our hypothetical case will involve creating a package for version 1.1.0. Open ocw/meta.yaml and edit the following entries:

Code Block
languagebash
# Under package:
version: 1.1.0
 
# Under source:
git_rev: 1.1.0

Here of course the version numbers could be set to whatever release you want. If you wish to just test your build for the latest code from the git repo rather than a stable release, leave git_rev commented out.  If Alternatively, if you are testing changes you have made locally, you may comment out the the git_url and use:

Code Block
languagebash
# Under source:
path: /path/to/climate

Where path is the location of the climate directory in your local filesystem. If needed, you should also add any new dependencies under the run section.

Build and test the package

You should now save your changes and prepare to build the package. If you do not already have it installed, you will first need to obtain the latest version of conda build:

Code Block
languagebash
conda update conda
conda install conda-build

To build the package, being sure you are in the conda_recipes directory, use:

Code Block
languagebash
conda build ocw

If successful, your newly built package will be found in a tarball located in your conda environment's <conda_environment>/conda-bld/<platform> directory. For an anaconda user's default environment on Mac OSX, this would be located in ~/anaconda/conda-bld/osx-64. 

Before proceeding, you should (preferably in a clean environment) install and test your newly built package locally:

Code Block
languagebash
conda clean -pt
conda install --use-local ocw

If everything checks out, you are finally ready to move on to the next step.

Uploading packages to the OCW conda channel

Convert the package to other platforms

Having successfully built a package on your system, you should first add versions for all available platforms. The Mac OSX anaconda user in our example would do this with:

Code Block
languagebash
conda convert --platform all ~/anaconda/conda-bld/osx-64/ocw-1.1.0-py27_0.tar.bz2 -o ~/anaconda/conda-bld

The directory structure here should be altered for the name of your base conda directory, OS platform and package tarball, of course.

Uploading your package

Info

Additional information on the anaconda cloud can be found here.

To begin uploading your packages, create an account for the anaconda cloud if you have not already done so. You will also need to install the anaconda client:

Code Block
languagebash
conda install anaconda-client

Then log in with your account info:

Code Block
languagebash
anaconda login

Finally to upload our OSX package as per our example, use:

Code Block
languagebash
anaconda upload -u agoodman ~/anaconda/conda-bld/osx-64/ocw-1.1.0-py27_0.tar.bz2

Where again the location should point to your desired package tarball and platform. You should repeat this process for each platform.

Sharing your updated recipe files

Changes to the recipe files should be committed to our git repo with each release, especially if dependencies are changed.

...