From 3ee1c5bb0aedf6969d7c034d4ecaafaf81b58398 Mon Sep 17 00:00:00 2001 From: Jacob Callahan Date: Tue, 3 Sep 2024 10:18:52 -0400 Subject: [PATCH] Updated uv usage and documentation With recent changes to uv, I am solidifying my position for the use of it over pip. Part of this includes changing the usage of uv in our actions as well as recomending it in our documentation. Since most Broker users are no longer also Broker developers, I've changed the quickstart to not involve local development. --- .github/workflows/codeql-analysis.yml | 7 +++++-- .github/workflows/python-publish.yml | 6 +++++- README.md | 28 +++++++++++++++++++++------ pyproject.toml | 1 - 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ecc81e23..1feceb75 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -42,16 +42,19 @@ jobs: - name: Pre Commit Checks uses: pre-commit/action@v3.0.1 + - name: Set up uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + - name: Setup Temp Directory run: mkdir broker_dir - name: Unit Tests env: BROKER_DIRECTORY: "${{ github.workspace }}/broker_dir" + UV_SYSTEM_PYTHON: 1 run: | cp broker_settings.yaml.example ${BROKER_DIRECTORY}/broker_settings.yaml - pip install uv - uv pip install --system "broker[dev,docker] @ ." + uv pip install "broker[dev,docker] @ ." ls -l "$BROKER_DIRECTORY" broker --version pytest -v tests/ --ignore tests/functional diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 2c73b1a2..a142af8e 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -22,9 +22,13 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Set up uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + - name: Setup and Build + env: + UV_SYSTEM_PYTHON: 1 run: | - pip install uv uv pip install --system "broker[setup] @ ." python -m build python -m twine check dist/* diff --git a/README.md b/README.md index e8a8c33c..dc91e949 100644 --- a/README.md +++ b/README.md @@ -13,17 +13,24 @@ Broker's docs can be found at the wiki for this repo: https://github.com/Satelli # Quickstart Install cmake with `dnf install cmake` -Install Broker either by cloning locally with `pip install .` or with `pip install broker` for the latest version from PyPI. +**Note:** We recommend using [uv](https://github.com/astral-sh/uv?tab=readme-ov-file#installation) to manage your Broker installation. -Copy the example settings file to `broker_settings.yaml` and edit it. +Install Broker either as a tool with uv `uv tool install broker` -(optional) If you are using the Container provider, install the extra dependency based on your container runtime of choice with either `pip install broker[podman]` or `pip install broker[docker]`. +or with pip `pip install broker` -(optional) If you are using the Beaker provider, install the extra dependency with `dnf install krb5-devel` and then `pip install broker[beaker]`. +**Note:** If you install with pip it is recommended that you do so in a virtual environment. -To run Broker outside of its base directory, specify the directory with the `BROKER_DIRECTORY` environment variable. +(optional) If you are using the Container provider, install the extra dependency based on your container runtime of choice with either `... install broker[podman]` or `... install broker[docker]`. + +(optional) If you are using the Beaker provider, install the extra dependency with `dnf install krb5-devel` and then `... install broker[beaker]`. -Configure the `broker_settings.yaml` file to set configuration values for broker's interaction with its providers. +The first time you run Broker, like with `broker --version`, it will check if you already have a `broker_settings.yaml` in the location it expects. +If not, then it will help you get one setup and place it in the default broker directory `~/.broker/` + +If you want Broker to operate out of a different location, export a `BROKER_DIRECTORY` environment variable with the desired path. + +You can check `broker --version` at any time to verify where it is looking for its config file. # Basic CLI Usage **Checking out a VM or container** @@ -123,3 +130,12 @@ broker checkout --background --nick rhel7 broker checkin -b --all broker execute -b --workflow my-awesome-workflow --artifacts ``` + +# Development Setup +Install cmake with `dnf install cmake` + +Clone the Broker repository and install locally with `uv pip install "broker[dev] @ ."` + +Copy the example settings file to `broker_settings.yaml` and edit it. + +To run Broker outside of its base directory, specify the directory with the `BROKER_DIRECTORY` environment variable. diff --git a/pyproject.toml b/pyproject.toml index f2103ec4..420dff05 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,6 @@ name = "broker" description = "The infrastructure middleman." readme = "README.md" requires-python = ">=3.10" -license = {file = "LICENSE", name = "GNU General Public License v3"} keywords = ["broker", "AnsibleTower", "docker", "podman", "beaker"] authors = [ {name = "Jacob J Callahan", email = "jacob.callahan05@gmail.com"}