Search code examples
pythonbuildanacondapypi

Conda build for universal PyPI package: which Python versions do I need to build for?


I am creating a conda build for a pure Python package based on the respective PyPI package.

In case that matters: The PyPI package is universal, i.e., it has been generated using the command python setup.py sdist bdist_wheel --universal and works with both Python 2 and Python 3.

When I build for conda in a conda environment running a specific Python version like 2.7, the resulting package files also carry that version in their file name.

I know that I can build for several Python variants using build variants, e.g., I could build for 3.4, 3.5, and 3.6. But should I do that and upload all these package to anacondacloud, or are the resulting packages redundant?

(So far I have uploaded versions for 2.7 and 3.6, and I noticed that when I installed in a Python 3.4 conda environment, conda downloaded Python 3.6. This suggests that I should upload for all versions, but on the other hand when I visit the website for my package on anaconda cloud, there is nothing on there which indicates the different Python versions the package is available for. If it mattered, I would expect to see that information on there.)


Solution

  • You can use the noarch option in the build section of your meta.yaml file.

    build:
      number: 0
      noarch: python
    ...
    

    This allows you to upload one conda package that can be used for all versions of Python that you set as compatible in the requirements section. See also the documentation