Nextstrain CLI Development
nextstrain-cli happens at https://github.com/nextstrain/cli.
We currently target compatibility with Python 3.6 and higher.
Versions for this project follow the Semantic Versioning rules.
Setup an isolated development environment in
Activate the venv to run any of the commands below:
(Or alternatively, run the commands below via
Now test that you can run:
The development environment includes our dev tools (described below):
pytest # runs doctests as well as mypy and flake8 mypy -p nextstrain.cli flake8 make -C doc livehtml
Running with local changes
The project is installed into editable mode when using the venv setup above, so any changes you make during development will be used automatically.
If you need to run with local changes in setups without editable mode, you can
./bin/nextstrain to test your local changes without installing them.
./bin/nextstrain is not the script that gets installed by pip as
nextstrain; that script is generated by the
entry_points configuration in
New releases are made frequently and tagged in git using a signed tag.
There is a
./devel/release script which will prepare a new release from your
local repository. It ends with instructions for you on how to push the release
Tests are run with pytest. To run everything, use:
This includes the type annotation and static analysis checks described below.
Type annotations and static analysis
Our goal is to gradually add type annotations to our code so that we can catch errors earlier and be explicit about the interfaces expected and provided. Annotation pairs well with the functional approach taken by the package.
During development you can run static type checks using mypy:
$ mypy nextstrain # No output is good!
$ npx pyright ... Found 40 source files 0 errors, 0 warnings, 0 infos Completed in 2sec
There are also many editor integrations for mypy, and Pyright is integrated into VS Code’s Python support.
typing_extensions module should be used for features added to the
typings module after 3.6.
We also use Flake8 for some static analysis checks focusing on runtime safety and correctness. You can run them like this:
$ flake8 # No output is good!
A Sphinx project for Nextstrain CLI’s documentation, primarily reference and
explanatory material, lives in the
directory. Pages are written in reStructuredText (rST), though some older
pages originally written in Markdown haven’t been converted yet.
To locally build the HTML version of the documentation (i.e. what’s served at https://docs.nextstrain.org/projects/cli/), run:
$ make -C doc livehtml
This will start a server on http://localhost:8000 which you can browse. Changes to source documentation files will be reflected automatically.