This project provides a Development Container (or Dev Container for short) with a full-featured development environment containing all the tools, libraries, and runtimes needed to work with the Pants codebase. Here are some advantages of using dev containers:
- Faster setup: Dev containers can be pre-built with all the necessary tools, libraries and runtimes, making setting up a new development environment faster. This is especially useful for new team members joining a project who can quickly get started without spending time setting up their development environment.
- Portability: Dev containers provide portability between different platforms and clouds, allowing developers to write once and run anywhere. This ensures that developers can use the same development environment across different machines and platforms without compatibility issues.
- Consistency: Dev containers provide a consistent development environment for all developers working on a project. This ensures that everyone is using the same tools, libraries and runtimes, reducing the chances of compatibility issues and making it easier to collaborate and reproduce bugs.
- Isolation: Dev containers run in isolation from the host system, which improves security and reduces the chances of conflicts with other software installed on the host system.
- Reproducibility: Dev containers can be version-controlled, making it easy to reproduce the development environment at any point in time. It also allows developers to roll back to an earlier environment version if necessary.
- Rust engine and common Rust utilities
- Python 3.11
- Docker-in-Docker (DinD)
- Shell History
- Local Git hooks
- Useful VS Code extensions like
Python
,Pylance
,Black Formatter
,rust-analyser
,Even Better TOML
, etc. - Volumes for Pants cache directories
hyperfine
,py-sy
,memray
anddbg
for debugging and benchmarking
You need three (3) things to get started with development containers:
- VS Code
- Docker
- Dev Containers extension for VS Code
More on getting started can be found here.
- After forking and cloning
pantsbuild/pants
, start VS Code and run theDev Containers: Open Folder in Container...
command from the Command Palette... (F1
) and select the Pants project folder. - The VS Code window (instance) will reload and start building the dev container. A progress notification provides status updates.
- After the build completes, VS Code will automatically connect to the container. You can now work with the repository source code in this independent environment.
- Pants sets up its development virtualenv at
~/.cache/pants/pants_dev_deps/<venv_fingerprint>.venv/
. Point VS Code to thebin/python
file in this folder by running thePython: Select Interpreter
command from the Command Palette... (F1
), and thenEnter interpreter path...
. You may need to restart your terminal. See Configure your IDE (optional).
More on starting a dev container can be found here.