Building a package without a recipe (bdist_conda)¶
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 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 build.
NOTE: If you use Setuptools, you must first import Setuptools and
distutils.command.bdist_conda, because Setuptools
EXAMPLE: A minimal
setup.py file using the setup options
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'], )
You can pass the following options to
setup(). You must
The number of the build. Can be overridden on the command line
--buildnum flag. Defaults to
The build string. Default is generated automatically from the
Python version, NumPy version—if relevant—and the build
number, such as
Whether to automatically run import tests. The default is
True, which runs import tests for 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 to run. Default is
True, which runs
command --help for each command in the console_scripts and
gui_scripts entry_points. Also allowed are
False, which does
not run any command tests, or a list of command tests to run.
Whether binary files should be made relocatable, using
install_name_tool on macOS or patchelf on Linux. The default is
For more information, see Making packages relocatable.
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 console_scripts and
A list of features for the package.
mkl with the features that you want to list.
For more information, see Features.
- You must install
bdist_condainto 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 above.
- 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. You can disable or change these using the
conda_command_testsoptions specified above.
- 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