'Create conda package across many versions
I have a very simple Pure Python package on PyPI that I'd like to make available on binstar. My package targets Python 2.6+ and 3.2+ with a single codebase. I also expect that it works equally well on Windows as well as Unix.
Is there a simple way to comprehensively build my package and upload it to binstar for many Python versions?
I've tried a naive use of conda skeleton pypi
as suggested in this article. I'd like to replicate this process across many different versions.
Solution 1:[1]
If you want to build recipes for many different versions of the package, use the --version
flag to conda skeleton pypi
. I recommend using package-version
as a naming convention for the recipes.
If you want to build the same package for many different Python versions, use the --py
flag to conda build
, like conda build --py 3.4 recipe
. The flag can be specified multiple times, like conda build --py 3.3 --py 3.4 recipe
, or you can use --py all
to build against Python 2.6, 2.7, 3.3, and 3.4.
To convert the package to other platforms, use conda convert
(see conda convert -h
for usage; be sure to run conda update conda-build
, as the API changed a little bit recently).
The easiest way to get the binstar uploading is to run conda config --set binstar_upload yes
. This will cause conda build
and conda convert
to upload the packages to binstar automatically when they are done.
Solution 2:[2]
For pure Python packages that can run on any Python version, you can use the noarch: python
syntax in the recipe.
Something like:
requirements:
build:
- python
- setuptools
run:
- python
build:
noarch: python
script: python setup.py install --single-version-externally-managed --record=record.txt
Link to the conda-build documentation: https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#architecture-independent-packages
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Adrien Renaud |