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 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
build.
NOTE: If you use Setuptools, you must first import Setuptools and then
import distutils.command.bdist_conda
, because Setuptools monkeypatches
distutils.dist.Distribution
.
Example¶
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'],
)
Setup options¶
Options that can be passed to setup()
(must include
distclass=distutils.command.bdist_conda.CondaDistribution)
:
Build number¶
The number of the build. Can be overridden on the command line with the --buildnum
flag.
Defaults to 0.
conda_buildnum=1
Build string¶
The build string. Default is generated automatically from the Python version, NumPy version
if relevant, and the build number, like py34_0
.
conda_buildstr=py34_0
Import tests¶
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.
conda_import_tests=False
Command line tests¶
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 doesn’t run any
command tests, or a list of command tests to run.
conda_command_tests=False
Binary files relocatable¶
Whether binary files should be made relocatable (using install_name_tool
on macOS or patchelf
on Linux).
The default is True.
conda_binary_relocation=False
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 console_scripts
and gui_scripts
.
conda_preserve_egg_dir=False
Command line options¶
Build number¶
Set the build number. Defaults to the conda_buildnum
passed to setup()
, or 0. Overrides any conda_buildnum
passed to setup()
.
--buildnum=1
Notes¶
bdist_conda
must be installed into a root conda environment, as it importsconda
andconda_build
. It is included as part of theconda build
package.- All metadata is gathered from the standard metadata from the
setup()
function. Metadata that are not directly supported bysetup()
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 --help
are run for eachsetuptools entry_points
command. This is done to ensure that the package is built correctly. These can be disabled or changed using theconda_import_tests
andconda_command_tests
options specified below. - The Python version used in the build must be the same as where conda is installed, as
bdist_conda
usesconda-build
. bdist_conda
uses the metadata provided to thesetup()
function.- If you want to pass any
bdist_conda
specific options tosetup()
, insetup()
you must setdistclass=distutils.command.bdist_conda.CondaDistribution
.