ACP ACP Conda Build & Distribution 1 — Questions and Answers
Question 1: What file is required at the root of a conda package recipe to define its build metadata and dependencies?
- setup.py
- meta.yaml (Correct answer)
- build.sh
- conda.yaml
Correct answer: meta.yaml
The meta.yaml file is the recipe descriptor that defines package name, version, source, build requirements, and runtime dependencies for conda-build.
Question 2: Which conda-build command is used to build a package from a local recipe directory called `my-package`?
- conda install my-package
- conda-build my-package (Correct answer)
- conda package my-package
- conda create my-package
Correct answer: conda-build my-package
Running `conda-build my-package` processes the recipe in that directory and produces a .tar.bz2 or .conda artifact.
Question 3: In a meta.yaml recipe, where do you specify packages that are needed ONLY during the build process (e.g., compilers)?
- requirements: run
- requirements: host
- requirements: build (Correct answer)
- requirements: test
Correct answer: requirements: build
The `requirements: build` section lists cross-compilation tools and compilers that run on the build machine but are not needed in the final environment.
Question 4: What does the `conda convert` command allow you to do with an existing conda package?
- Convert a .conda file to .whl format
- Repackage a built artifact for a different platform/OS (Correct answer)
- Convert pip packages to conda format
- Merge two packages into one
Correct answer: Repackage a built artifact for a different platform/OS
`conda convert` repackages a compiled conda artifact for alternative platforms (e.g., from linux-64 to osx-64) when no compiled C extensions are involved.
Question 5: Which Anaconda-hosted service allows you to upload and share your built conda packages publicly or within a team?
- PyPI
- Anaconda.org (Correct answer)
- conda-forge
- Binstar
Correct answer: Anaconda.org
Anaconda.org (formerly Binstar) is the cloud repository where users and organizations can upload, manage, and share conda packages and channels.
Question 6: In meta.yaml, which top-level key defines the scripts (build.sh on Linux/macOS and bld.bat on Windows) used to compile and install the package?
- source
- build (Correct answer)
- about
- test
Correct answer: build
The `build` section in meta.yaml controls the build scripts, number (build string), skip conditions, and entry points for the package.
What file is required at the root of a conda package recipe to define its build metadata and dependencies?