Setting up a Phalanx development environment#

The Phalanx repository uses pre-commit to lint source files and generate Helm chart documentation with helm-docs. It also has a command-line tool, phalanx, which aids in maintaining Phalanx applications and environments.

If you are contributing to Phalanx as either a developer or an environment administrator, you should enable these tools in your local environment to ensure that you can use the command-line tool as intended, that your changes are clean, and that the Helm chart documentation is kept up-to-date.

Important

Pre-commit also runs in GitHub Actions to ensure that contributions conform to the linters. If your pull request’s “lint” step fails, it’s likely because pre-commit wasn’t enabled locally. This page shows you how to fix that.

Clone phalanx#

Start by cloning Phalanx into your own editing environment. You will likely need to make changes to Phalanx and create pull requests, so you need to create a branch or fork of the repository to which you can push changes.

Members of the lsst-sqre/phalanx repository on GitHub can clone the repository directly and create a ticket branch, per the Data Management workflow guide.

Otherwise, fork lsst-sqre/phalanx following GitHub’s guide.

Create a Python virtual environment#

Phalanx comes with a Python command-line tool which depends on a variety of Python libraries. To ensure consistent behavior, those dependencies are pinned to specific versions. This tool should therefore always be run from inside a Python virtual environment or venv.

Create a virtual environment with your method of choice. virtualenvwrapper is one popular approach. Whenever you do Phalanx development, you will switch back to this virtualenv.

Initialize the development environment#

From the phalanx directory, initialize your environment:

make init

This step populates your virtual environment with Phalanx’s dependencies, installs tox (used for testing and other build steps), and installs pre-commit (used to check and sometimes reformat your changes before committing them).

You will also need to install helm-docs separately. See the helm-docs installation guide for details.

Warning

You must have the same verison of helm-docs installed locally that is used by GitHub Actions, or you risk GitHub Actions seeing output changes, which will block merging of your PR. To see what version of helm-docs is used by GitHub actions, look for helm-docs in .github/workflows/ci.yaml.

The best (but possibly not the most convenient) way to make certain you have the same version is to run the same go install command that GitHub Actions uses. However, this (unlike the installation methods documented in the installation guide) will require that you have Go installed locally.

You are now ready to use the Phalanx command-line tool and make changes to Phalanx.

Next steps#