PSLmodels / Package-Builder

Policy Simulation Library tool that builds packages and uploads them to the Anaconda Cloud's PSLmodels channel for public distribution
4 stars 7 forks source link

How to make taxcalc packages for a Tax-Calculator release #86

Closed martinholmer closed 5 years ago

martinholmer commented 6 years ago

Here is an example of a bash shell script that uses the policybrain-builder CLI, pb (release 0.1.0), to build and upload conda taxcalc packages for Python 3.6 for a specified Tax-Calculator release (0.21.0 or later).

Before executing this bash script be sure that the conda-build package is installed. If it is not installed, then execute this command: conda install conda-build. And also be sure you have executed python setup.py install in the top directory of the policybrain-builder directory tree, as described in the README.md file.

Here are the contents of the bash shell script, which is called release-taxcalc-packages.sh:

policybrain-builder$ pb --version pb, version 0.1.0

policybrain-builder$ cat release-taxcalc-packages.sh

#!/bin/bash
# Script to build and upload taxcalc packages for specified release using
# policybrain-builder CLI, pb, with a single parameter, TAG (e.g., 0.22.1)
# USAGE: ./release-taxcalc-package.sh TAG

echo "STARTING : `date`"

TOKEN=<secret-token>
OPTIONS="--token $TOKEN --clean --label main --python 3.6"
pb release $OPTIONS taxcalc=$1 2>&1 | awk '$1~/\[taxcalc\]/'

conda build purge
find ~/anaconda3/conda-bld -name "*tar.bz2" -exec rm -f {} \;

echo "FINISHED : `date`"
exit 0

Here's a recent use example:

iMac:policybrain-builder mrh$ ./release-taxcalc-packages.sh 0.21.0
STARTING : Tue Sep 11 13:20:20 EDT 2018
[taxcalc] removing
[taxcalc] cloning
[taxcalc] fetching
[taxcalc] checking out '0.21.0'
[taxcalc] archiving
[taxcalc] building 3.6
[taxcalc] converting to linux-64
[taxcalc] converting to win-32
[taxcalc] converting to win-64
[taxcalc] uploading osx-64 packages
[taxcalc] uploading linux-64 packages
[taxcalc] uploading win-32 packages
[taxcalc] uploading win-64 packages
FINISHED : Tue Sep 11 13:24:14 EDT 2018

Note that this script builds four packages: four platforms (osx-64, linux-64, win-32, win-64) and one Python version (3.6).

And finally, here is what things look like on www.anaconda.org after the bash script finishes execution:

screen shot 2018-09-11 at 3 30 55 pm
martinholmer commented 5 years ago

The Package-Builder FAQ in issue #86 is now obsolete, and so, is being deleted. In the next few days there will be a new README.md file that documents how to use the new pbrelease CLI to Package-Builder.