Skip to content

Commit

Permalink
Updated uv usage and documentation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JacobCallahan committed Sep 3, 2024
1 parent 5943262 commit 810d339
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,19 @@ jobs:
- name: Pre Commit Checks
uses: pre-commit/[email protected]

- 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
6 changes: 5 additions & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
Expand Down
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down Expand Up @@ -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.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]"}
Expand Down

0 comments on commit 810d339

Please sign in to comment.