This is the source for creating the nextstrain-base Conda package.
This meta-package depends on all the other packages needed for a base Nextstrain runtime installed as a Conda environment. As the nextstrain/base image is to Nextstrain CLI's Docker runtime, this nextstrain-base package is to Nextstrain CLI's Conda runtime. The package's dependencies which completely lock its full transitive dependency tree. This means that if version X of nextstrain-base worked some way in the past, it'll work the same way in the future.
Note that this is not a general purpose package for installing Nextstrain. It's intended for use by Nextstrain CLI's managed Conda runtime and may be unsuitable for use in a user-managed Conda environment.
The meta-package source recipe is in src/meta.yaml. This is a conda-build
recipe spec. It defines our runtime's direct dependencies, typically
without version restrictions (pins) or with only loose pinning as necessary.
The recipe declares pin_depends: strict in order to fully lock its
dependency tree at package build time.
As the fully locked dependency trees are platform-specific, CI produces
packages for both Linux and macOS (i.e. for Conda's linux-64 and osx-64
subdirs).
You can build this package locally during development, but it's important for production releases to happen via CI so packages are built for both Linux and macOS.
First, setup a Conda environment for development in .dev-env/ so that
conda-build is available.
./devel/setup
You only need to do this once, or whenever you want to refresh your development environment. Either Micromamba, Mamba, or Conda must be available for setup to succeed. You do not need to create a new environment yourself, the script automatically sets everything up without interfering with your existing environments.
To build this package locally, run:
./devel/build
The final built package will be written to
build/<arch>/nextstrain-base-*.conda, where <arch> is a Conda subdir, i.e.
linux-64, osx-64 or osx-arm64.
CI builds store the entire build/ directory as an artifact attached to
each CI run. You can download the artifacts to inspect the built packages or
install them.
To install the built package into a new environment, run:
mamba create \
--prefix /path/to/new/env \
--strict-channel-priority \
--override-channels \
--channel conda-forge \
--channel bioconda \
--channel ./build/ \
nextstrain-base
To upload the built package to anaconda.org, run:
./devel/upload
You'll need an appropriate Anaconda API token set in the ANACONDA_TOKEN
environment variable. The token must have at least the api:read,
api:write, and conda scopes attached to it. CI uses a token issued for the
Nextstrain Anaconda organization.
You can adjust the label applied to the uploaded package by setting the LABEL
environment variable. By default the Git ref is used to determine the label:
-
Uploads from our
mainbranch are given themainlabel. These packages will be found by default for anyone using our Anaconda channel (e.g.--channel nextstrain). -
Uploads from other branches, tags, and PRs will get
branch-<name>,tag-<name>, andpull-<number>labels. These packages can be used by asking for them explicitly (e.g.--channel nextstrain/label/pull-123).
If no label can be worked out, then dev is used as a final fallback.
CI uploads the built package if it passes the test phase. You can use the above labels to install CI-uploaded packages locally without downloading the CI artifacts.
src/ contains the package recipe source. Any files in this directory will be
automatically included in the built package. (meta.yaml doesn't live in the
top-level of the repo, and thus src/ exists, to avoid including the whole
repo in each built package.)
build/ contains build outputs not tracked in version control.
devel/ contains programs for development of this package.
.condarc is used to specify configuration (e.g. channels) for conda build.
-
Initial suggestion of the meta-package on the Nextstrain CLI PR introducing the Conda runtime.
-
Further discussion about the meta-package on Slack, motivated by the Conda runtime breaking between one day and the next due to upstream changes.