pythonwindowscondaconda-build

Using conda build to build win32 and win64 packages in 1 go


My pure python scripts are 32 bits or 64 bits agnostic but my dependencies are not. I want to use cython to speed up some functions making the package not pure python. And I want to use them on windows with python 32 bits or 64 bits.

Is there a way to build with 1 conda recipe a conda python package for win32 and win64 platforms?

One would assume that runtime dependencies (e.g. Numpy, etc.) are available for both platforms. Setup could either start from a miniconda 32 or 64 bits installation.

I have read the documentation differentiating the build, host requirements in meta.yaml, the conda build variants, and the architecture virtual packages but I am struggling to see if a clever combination of these functionalities would allow me to build both packages in one go.

Thanks!


Solution

  • After a few experimentations, I found the solution to my question. If you put the following in conda_build_config.yaml:

    target_platform:
      - win-32
      - win-64
    

    And make sure you're using the Jinja compiler functions in the requirements/build: section of the recipe meta.yaml:

    build:
      - {{ compiler('c')  }}
      - {{ compiler('cxx')  }}
    

    then conda build will build both win-32 and win-64 packages in one go. (I used conda-build 64 bits but i do not think it matters).