Developer Install#

Important

The following commands will install landlab into your current environment. Although not necessary, we highly recommend you install landlab into its own virtual environment.

If you will be modifying code or contributing new code to landlab, you will first need to get landlab’s source code and then install landlab from that code.

Source Install#

Landlab is actively being developed on GitHub, where the code is freely available. If you would like to modify or contribute code, you can either clone our repository

git clone git@github.com:landlab/landlab.git
git clone https://github.com/landlab/landlab.git

or download a zip file:

curl -OL https://github.com/landlab/landlab/archive/refs/heads/master.zip

Once you have a copy of the source code, you can install it into your current Python environment by first installing Landlab dependencies and then building and installing Landlab.

Install dependencies#

Landlab’s dependencies are listed in requirements.in.

cd landlab
mamba install --file=requirements.in -c nodefaults -c conda-forge --override-channels
cd landlab
conda install --file=requirements.in -c nodefaults -c conda-forge --override-channels
cd landlab
pip install -r requirements.in

Build and install Landlab#

Landlab’s build process includes compiling Python extensions, which requires you to have a C++ compiler installed. Linux will usually already have one, on Mac you can use XCode, and on Windows you will need to install MSVC. For help on installing MSVC, you may want to refer to the conda-forge page on compiling code on Windows or the Python wiki page for Windows compilers.

If you are using conda/mamba, set up your compilers to build libraries compatible with other installed packages,

mamba install compilers -c nodefaults -c conda-forge --override-channels
conda install compilers -c nodefaults -c conda-forge --override-channels

With compilers set up and dependencies installed, build and install Landlab,

pip install -e .

Developer Tools#

Once you start developing with Landlab, we recommend that you use nox to automate common tasks such as, for example, running the tests, building the docs, and finding lint.

pip install nox

The following list shows how to use nox for some of the more common tasks:

  • Run the tests:

    nox -s test
    
  • Run the tests on the notebooks:

    nox -s test-notebooks
    
  • Build the docs:

    nox -s build-docs
    
  • Run the linters:

    nox -s lint
    
  • To get a complete list of the available targets:

    nox -l