Conda is a package manager and environment management system for the Python programming language. I generally recommend using a minimal version called Miniconda, described below.
To install Miniconda on a Linux machine, run the following:
It is generally best to keep your base conda environment clean and to rely on other environments instead for installing new packages. It is often wise to make a conda environment for each project as a matter of reproducibility and ease of use.
Every now and then, you may need to run conda clean --all to remove the cached installers that end up accumulating a lot of space.
Nuking a Conda Environment
More often than one would like, you'll need to destroy your conda environment and start fresh if things just get messy. To do that:
conda env remove --name quacc
Then re-make your Conda environment like before.
Python Code Formatting
For internal consistency in the group, all publicly accessible Python code (and codes we work on collaboratively) should be formatted with ruff. Ruff is by no means a "perfect" formatter (which is largely a matter of preference). However, there are few things more frustrating in scientific computing than dealing with formatting inconsistencies when you're just trying to get things done. Ruff is fast, uncompromising, and "just works."
To format your code with Ruff, make sure it is installed (e.g. pip install ruff). To format code from the command line, run ruff format . --fix in the directory of files you want to format. VS Code will also do this automatically on-save if you have the Ruff extension installed.
Jupyter Notebooks
Looking for a tutorial on how to use Jupyter Notebooks? See a written setup tutorial here and a video walkthrough here.
To use Jupyter Notebooks on the Princeton HPC clusters, refer to this guide.
Jupyter Notebooks are a great way to do exploratory data analysis, preparing small scripts, launch workflows on the HPC cluster, and write up tutorials. That said, Jupyter Notebooks are rarely ideal for writing research code. Most programming efforts should be with their own dedicated Python package that you use in editable mode (pip install -e .). Jupyter Notebooks make it difficult to adopt good programing practices, like modularity and testing. This isn't to say that you should avoid Jupyter Notebooks, but as they say: with great power comes great responsibility.