Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
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. Stackless uses the channel stackless. It provides a package named
python, that contains Stackless-Python and replaces the package 'python' from channel
Before you can use Stackless Python you must add the channel stackless to your Conda environment.:
conda --add channels stackless
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
python-packages provide the feature
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.
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 AnacondaRecipes/python-feedstock contains the recipes for their official Python packages. Each Python version has its own branch.
I forked AnacondaRecipes/python-feedstock as
stackless-dev/anaconda-python-feedstock and modified the recipes to use Stackless Python. Additionally I added a build script
build_stackless.sh. Stackless branch names have the suffix
Building on Linux
You need a host with a recent miniconda installation. Build steps:
- Activate miniconda;
- check out the appropriate branch from stackless-dev/anaconda-python-feedstock
- Run the build script:
It downloads dependencies and sources and builds the python package in
You can use the command
anaconda upload to upload the created package into the anaconda cloud.
Building on Windows
Fortunately the process is exactly the same as on Linux. But you need additional Software:
- Microsoft Visual Studio 2015 Professional (or any other version that supports PGO)
- Microsoft Visual Studio 2008 (only for Stackless version 2.7)
- Windows 10 SDK (ver. 10.0.15063.468) available from https://developer.microsoft.com/en-us/windows/downloads/sdk-archive
- Git for Windows
Use the git-bash to run
Building for MacOS
I don't have a Mac. Therefore I use Travis CI
to build the osx-64 packets. Make sure, that the file
.travis.yml of the appropriate branch from
is up to date and then trigger a build of that branch using the Travis GUI. Make sure, that the resulting package does not yet exist on Anaconda.org. Otherwise the upload fails. (Intentionally disabled builds on every push.)
The uploaded package has the label "test".
To install it use the command
conda install --channel stackless/label/test python=$ver. If the package is ok,
set the label to "main" in the anaconda UI.
As a smoke test I install and test stackless-testsuite and the Python extension package bitarray. It contains a C-extension and a test suite. The package is available as a precompiled conda package as well as a source only package on PyPi.
Commands used to test:
#!/bin/bash ver="3.6" # or whatever your version is # Setup of the test environment command -v conda || exit 1 conda_dir="$(dirname "$(which conda)")" conda remove --yes --all --name testenv conda create --yes --name testenv . "$conda_dir/activate" testenv conda config --env --add channels stackless conda install --yes stackless conda install --yes python="$ver" # or: conda install --yes --channel stackless/label/test python="$ver" conda install --yes pip python -m pip install -U pip # Tests start here python -m pip install git+https://github.com/stackless-dev/stackless-testsuite.git python -m unittest discover -v stackless_testsuite conda install --yes bitarray python -c "import stackless, bitarray; bitarray.test()" conda uninstall --yes bitarray python -m pip install --no-binary :all: bitarray python -c "import stackless, bitarray; bitarray.test()" # Cleanup . "$conda_dir/deactivate" conda remove --yes --all --name testenv #