Getting Started For Developers#
We strongly recommend using the mambaforge conda distribution.
Warning
The following guide is used only if you want to develop the
nectarchain package, if you just want to write code that uses it
as a dependency, you can install nectarchain from PyPI or conda-forge.
See Getting Started for Users
Installation#
This is the recommended installation procedure for developers. nectarchain should be pip-installed in development (aka editable) mode.
$ git clone https://github.com/cta-observatory/nectarchain.git
$ cd nectarchain
$ mamba env create --name nectarchain --file environment.yml
$ mamba activate nectarchain
$ pip install -e .
Enable pre-commit hooks, which enforces adherence to PEP8 coding style:
$ pre-commit install
Please follow the same conventions as ctapipe regarding settings of git remotes, and how to contribute to the code with pull requests.
Optional DIRAC support#
Note: this is not needed if you are using nectarchain as a container (see As an Apptainer container), as DIRAC is already fully installed and configured within.
To enable support for DIRAC within the same environment, do the following after the installation of nectarchain described above:
$ mamba activate nectarchain
$ mamba install -c conda-forge dirac-grid
$ conda env config vars set X509_CERT_DIR=${CONDA_PREFIX}/etc/grid-security/certificates X509_VOMS_DIR=${CONDA_PREFIX}/etc/grid-security/vomsdir X509_VOMSES=${CONDA_PREFIX}/etc/grid-security/vomses DIRACSYSCONFIG=${CONDA_PREFIX}/etc/dirac.cfg
$ # The following is needed for the environment variables, used for DIRAC configuration, to be available:
$ mamba deactivate
$ mamba activate nectarchain
$ pip install "CTADIRAC<3"
$ dirac-configure
Some Mac OS users (running on M1 or M2 CPU chips) may experience issues with DIRAC, please refer to Note to macOS users.
Building the documentation#
To locally build the documentation, optional dependencies should be installed with:
$ pip install -e ".[docs]"
The documentation can then be compiled with:
$ make -C docs html
Interactive Development Environment#
It is recommended that a fully python-aware interactive development environment (IDE) is used to develop code, rather than a basic text editor. IDEs will automatically mark lines that have style problems. The recommended IDEs are:
PyCharm CE (Jetbrains)
VS Code (Microsoft)
The IDEs provide a lot of support for avoiding common style and coding mistakes, and automatic re-formatting.