Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

BuildForConda

Anselm Kruis edited this page Sep 17, 2018 · 6 revisions

How to build Stackless for (Ana-)Conda

The most important ready to use Python distribution of today is probably Anaconda or its little cousin Miniconda, which is a subset of Anaconda. I'll use the term :dfn:`Conda` to refer to both of them. The vendor of Conda is Continuum Analytics, Inc..

A Conda installation contains packages. Packages come from channels. The channel defaults provides official packages from the vendor. It is possible use other channels to provide additional packages like Stackless. For Stackless two channels are relevant:

  1. The channel stackless

    It provides a package named python, that contains Stackless-Python and replaces the package 'python' from channel defaults.

  2. The channel conda-forge

    It provides over 2000 packages build by the community project CONDA-FORGE. Everybody can contribute build recipes to this project. If the recipe gets accepted, the build infrastructure of CONDA-FORGE will build and publish the resulting packages. CONDA-FORGE provides its own python packages. Currently we try to get a recipe for Stackless accepted (pull request).

If you add least one of these channels to your Conda environment, you can use Stackless-Python in your Conda-environment. Because the Stackless Python must be used instead of the regular C-Python, the Conda feature mechanism is used to select the Stackless python package over the regular python package. This mechanism requires two packages: a Conda (meta-) package tracks a feature with a certain name. This causes the Conda package manager to prefer packages which provide the feature over packages without the feature. For Stackless we provide the meta-package stackless, which tracks the feature named stackless. Our python-packages provide the feature stackless.

Building the meta package stackless

This package is trivial, because it does nothing but tracking the feature stackless. There is no need to change or rebuild this package. The build recipe is included into the package archives.

Building the package python

This documentation assumes, that you are familiar with the Conda build instructions.

Because the Stackless python package is a drop in replacement for the python package from Continuum, it is very important to use a build procedure, that creates a comparable result. Fortunately Continuum publishes build instructions on GitHub. The project github.com/ContinuumIO/anaconda-recipes contains instructions in README.md and the recipes for Python (subdirectories python-X.Y). I forked github.com/stackless-dev/stackless27-anaconda-recipe and modified the recipe for Python 2.7 to use Stackless Python 2.7. The modified recipe is in the new branch stackless.

Building on Linux

I used a docker host and followed the instructions from Continuum to set up the container. I extracted the shell scripts from build64.zip. Then I run the following commands:

$ git clone https://github.com/akruis/anaconda-recipes.git
$ ( cd anaconda-recipes && git checkout stackless )
$ start the container, mount the recipe dir
$ ./start_cpp98*.sh -v anaconda-recipes/python-2.7:/home/dev/code
The container should start with a bash shell
$ conda config --set add_pip_as_python_dependency False
$ conda config --add channels stackless
$ conda update --all --yes
The next command builds the recipe
$ conda build code
Upload the result to anaconda.org/stackless
$ anaconda login --username stackless
$ anaconda upload /opt/miniconda/conda-bld/linux-64/python-2.7.13-stackless_0.tar.bz2

Building on Windows

  1. Get a suitable build host with VS2008 installed

  2. Install/unpack the Stackless MSI installer as \Pythons\2.7.13-32-slp for 32bit Stackless 2.7.13 or \Pythons\2.7.13-64-slp for 64bit Stackless 2.7.13.

  3. Install Miniconda2 (either 32bit or 64bit for building a 32/64 package)

  4. Update conda and install the following conda packages:

    > conda update --all --yes
    > conda install anaconda-client conda-build cio-bt
    
  5. Get the recipe:

    > git clone https://github.com/akruis/anaconda-recipes.git
    > cd anaconda-recipes
    > git checkout stackless
    
  6. Build the recipe:

    > conda build python-2.7
    
  7. Upload the result to anaconda.org/stackless

Clone this wiki locally