You can use conda build to build packages for Python to install rather than
conda, by using
setup.py bdist_conda. This is a “quick and dirty” way to
build packages without using a recipe, but it has limitations. The script
is limited to the Python version used in the build. And it is not as
reproducible as using a recipe. We recommend using a recipe with conda
NOTE: If you use Setuptools, you must first import Setuptools and then
distutils.command.bdist_conda, because Setuptools monkeypatches
A minimal setup.py file using setup options name and version:
from distutils.core import setup, Extension import distutils.command.bdist_conda setup( name="foo", version="1.0", distclass=distutils.command.bdist_conda.CondaDistribution, conda_buildnum=1, conda_features=['mkl'], )
Options that can be passed to
setup() (must include
The number of the build. Can be overridden on the command line with the
Defaults to 0.
The build string. Default is generated automatically from the Python version, NumPy version
if relevant, and the build number, like
Whether to automatically run import tests. The default is True, which runs import tests for the all the modules in “packages”. Also allowed are False, which runs no tests, or a list of module names to be tested on import.
Command line tests¶
Command line tests to run. Default is True, which runs
command --help for each command in the
gui_scripts entry_points. Also allowed are False, which doesn’t run any
command tests, or a list of command tests to run.
Binary files relocatable¶
Whether binary files should be made relocatable (using
install_name_tool on OS X or
patchelf on Linux).
The default is True.
SEE ALSO: Making packages relocatable section in the conda build documentation for more information.
Preserve egg directory¶
Whether to preserve the egg directory as installed by Setuptools. The default is True if the package depends
on Setuptools or has Setuptools
entry_points other than
List of features for the package.
SEE ALSO: Features section of the conda build documentation for more information about features in conda.
Command line options¶
Set the build number. Defaults to the
conda_buildnum passed to
setup(), or 0. Overrides any
conda_buildnum passed to
bdist_condamust be installed into a root conda environment, as it imports
conda_build. It is included as part of the
- All metadata is gathered from the standard metadata from the
setup()function. Metadata that are not directly supported by
setup()can be added using one of the options specified below.
- By default, import tests are run for each subpackage specified by packages, and command line tests
command --helpare run for each
setuptools entry_pointscommand. This is done to ensure that the package is built correctly. These can be disabled or changed using the
conda_command_testsoptions specified below.
- The Python version used in the build must be the same as where conda is installed, as
bdist_condauses the metadata provided to the
- If you want to pass any
bdist_condaspecific options to
setup()you must set