uv venv
source .venv/bin/activate
uv sync --all-packagesThe CLI tool changes should be reflected when editing the code while being inside the python virtual environment. This installs all dependencies including dev tools (lefthook, ruff).
To install only the Otto package:
uv pip install ./ottouv can be dropped and use pip instead for installing.
Lefthook runs ruff on commit. To run manually:
lefthook run pre-commitSee .lefthook.yaml for what runs, or use lefthook dump.
Check and fix linting issues automatically:
ruff check
ruff check --fix .For formatting issues:
ruff format --check .
ruff formatRuff follows the rules listed in pyproject.toml under [tool.ruff.lint] and runs on every PR.
Pyinstaller is used to make this CLI usable as a single binary. build.sh can be used to build into a single binary. --container flag can be used
to make sure that the binary is useable on most linux systems.
This is not a static binary as the CLI still dynamically links against system libraries such as glibc. Pyinstaller bundles the python interpreter + dependencies into a single binary. To be compatible with most ceph deployments centos8 was used purely because it has a lower glibc (2.28) version, other images could have been used and may be used to be compatible with older distributions.
ldd otto
linux-vdso.so.1 (0x00007ffebbb34000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f06da360000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f06da344000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f06da33f000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f06da116000)
/lib64/ld-linux-x86-64.so.2 (0x00007f06da379000)The one to note here is libc.so.6. This binary will only run on systems with glibc 2.28 or newer and x86_64. Other binaries can be built as needed, feel free to open an issue about this topic.
Build a binary:
./build.shRecommended to use --container to not use host system libraries. This assumes docker/podman installed.
./build.sh --containerBinary output: dist/otto
Verify:
dist/otto --version
dist/otto --help./build_rpm.sh $(git describe | cut -d - -f 1-1)docker run -it --rm -v $PWD:/clyso rockylinux:9 bashInside container:
dnf install -y epel-release
dnf config-manager --enable crb
dnf install -y git rpm-build rpmdevtools python3-devel python3-setuptools
git config --global --add safe.directory /clyso
curl -LsSf https://astral.sh/uv/install.sh | sh
cd /clyso && ./build_rpm.sh $(git describe | cut -d - -f 1-1)source .venv/bin/activate
python3 -m unittest discover testsOr use the script:
./run_tests.shMaking a new release through the github UI can be done and it will automatically create a new binary and packages to attach to the new release.
Two scenarios on when to update a new uv.lock file.
- Adding/removing/updating packages in pyproject.toml
- When you create a release tag - e.g., git tag v0.4.0 will update the version