Pixi is a package management tool for developers. It allows the developer to install libraries and applications in a reproducible way. Use pixi cross-platform, on Windows, Mac and Linux.
Installation:
curl -fsSL https://pixi.sh/install.sh | bash
Then logout and login and you can then install Python with:
pixi global install python==3.11
pyenv is a more conventional alternative to pixi. It installs slower but it's more tested. Use it if pixi doesn't work for you.
In order to manage python versions, you can use the pyenv installer.
Installing pyenv would be something like:
curl https://pyenv.run | bash
Then log off and log back on, in order to ensure that the
~/.local/bin
directory (used by pip
) is
available in your session's $PATH
, as well as the pyenv
shims directory.
On Mac, pyenv can be installed with Brew https://brew.sh/
brew install pyenv
If you get an error configure: error: C compiler cannot create executables
,
you may not have recent development tools. Run the following:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
You should verify that a new terminal session has added
the pyenv shims directory to your $PATH
, then continue
in that new terminal session from now on.
pyenv will install a clean Python for you. This installation will insist on a few important libraries which you should have on your system before it installs our chosen Python development version.
sudo apt install -y libncurses-dev libbz2-dev libreadline-dev \
libssl-dev make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev \
libffi-dev liblzma-dev
Note: if the list of dependencies above changes, update the [docker/Dockerfile] file accordingly, so CI stays in sync with local development environments.
Run the following from the repo root:
# change into the directory of the repo
# cd ~/src/release
pyenv install 3.11.6 # installs Python 3.11.6 via pyenv
pyenv local 3.11.6 # tells pyenv to use 3.11.6 for this repo
pip3 install poetry # installs poetry to your 3.11.6
poetry env use $(which python) # instructs poetry to use 3.11.6
poetry install # installs all our dependencies to 3.11.6
Follow the instructions onscreen. Once the install is done,
close and open your shell window, or run bash
again.
When you change into the release
directory (this repo),
typing poetry env info
should show that the current
folder is associated with a 3.11-based virtualenv.
You can see the full path to your virtualenv's Python interpreter
with the command poetry env info -p
. This is the interpreter
you should use in your IDE and in day-to-day commands with regards
to the Python programs in this repo. To activate the use of
this interpreter on the shell:
source "$(poetry env info -p)/bin/activate"
Install and enable pre-commit. It's highly recommended in order to prevent pushing code to github that will surely cause failures.
# cd ~/src/release
# source "$(poetry env info -p)/bin/activate"
pip3 install --user pre-commit
pre-commit install
More detailed instructions at https://pre-commit.com/#installation .
If you build with cargo, and not with bazel, you need an installation of rustup
and cargo
. You can follow the instructions from https://www.rust-lang.org/tools/install
This is typically as simple as running
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
command -v apt && sudo apt install -y clang mold protobuf-compiler || true
No need to install Clang for Mac OS user since it comes with Xcode.
brew install mold protobuff
Make sure you add $HOME/.cargo/bin
to your PATH, as written in the page above.
In the Rust development environment, all tools are installed to the ~/.cargo/bin directory, and this is where you will find the Rust toolchain, including rustc, cargo, and rustup.
To check if your Rust tooling is set up correctly, you can go to the repo root and then
cd rs
cargo check
This should succeed.
To install bazel, do not use the version provided by your OS package manager. Please make sure you use bazelisk.
https://github.com/nvm-sh/nvm#installing-and-updating
nvm install 14
nvm use 14
npm install --global yarn
sudo sysctl -w fs.inotify.max_user_watches=1048576
Bazel eats up a lot of inotify user watches.
cargo install cargo-watch
cd dashboard
yarn install
To start the release dashboard locally, run the following from dashboard folder
yarn dev
To use the dre
CLI tool with the local dashboard instance run it with --dev
flag.
E.g.
dre --dev subnet --id <id> replace -o1