Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,23 @@ jobs:
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Run CI
run: ./toxw
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install the project
run: uv sync --all-extras --dev

- name: Install tox
run: uv tool install tox --with tox-uv

- name: Run tox
run: tox -e py
15 changes: 4 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
FROM python:3.8-slim-bookworm
# So that STDOUT/STDERR is printed
ENV PYTHONUNBUFFERED="1"
ARG UV_VERSION=0.8.3
ENV UV_VERSION=${UV_VERSION}

# We create the default user and group to run unprivileged
ENV OTAVA_HOME /srv/otava
Expand All @@ -37,23 +39,14 @@ RUN apt-get update --assume-yes && \
clang \
build-essential \
make \
curl \
virtualenv \
&& rm -rf /var/lib/apt/lists/*

# Get poetry package
RUN curl -sSL https://install.python-poetry.org | python3 - --version 1.8.3
# Adding poetry to PATH
ENV PATH="/root/.local/bin/:$PATH"

# Copy the rest of the program over
COPY --chown=otava:otava . ${OTAVA_HOME}

ENV PATH="${OTAVA_HOME}/bin:$PATH"

RUN --mount=type=ssh \
virtualenv --python python3.8 venv && \
. venv/bin/activate && \
poetry install -v && \
RUN --mount=from=ghcr.io/astral-sh/uv,source=/uv,target=/bin/uv --mount=type=ssh \
uv pip install --system -e ".[dev]" && \
mkdir -p bin && \
ln -s ../venv/bin/otava ${OTAVA_HOME}/bin
82 changes: 0 additions & 82 deletions ci-tools/wrappers.sh

This file was deleted.

26 changes: 12 additions & 14 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,40 @@

# Setting up for development

* Ensure that `python3` points to a version of python >= 3.8 (`python3 --version` will tell you). If it does not, use [pyenv](https://github.com/pyenv/pyenv) to both install a recent python version and make it your current python.
* The project uses [uv](https://docs.astral.sh/uv/) for dependency management and [tox](https://tox.wiki) for testing environments.

* There are two wrappers (`poetryw` and `toxw`) that install and run the correct versions of [poetry](https://python-poetry.org) and [tox](https://tox.wiki) for you.

* Run poetry to install dependencies:
* Install dependencies using uv:

```
./poetryw install
uv sync --all-extras --dev
```

* Run the development version of otava using poetry:
* Run the development version of otava using uv:

```
./poetryw run otava ...
uv run otava ...
```

See the [poetry docs](https://python-poetry.org/docs) for more.
See the [uv docs](https://docs.astral.sh/uv/) for more.

# Running tests

```
./poetryw run pytest
uv run pytest
```

...or using [tox](https://tox.readthedocs.io/):

```
./toxw
uv run tox
```

# Linting and formatting

Code-style is enforced using [ruff](https://docs.astral.sh/ruff/) and [flake8](https://flake8.pycqa.org/); import optimisation is handled by [isort](https://pycqa.github.io/isort/) and [autoflake](https://pypi.org/project/autoflake/). Linting is automatically applied when tox runs tests; if linting fails, you can fix trivial problems with:

```
./toxw -e format
uv run tox -e format
```

# Changing the LICENSE header
Expand All @@ -63,17 +61,17 @@ To change the license header:
1. Add the `--remove-header` arg to `.pre-commit-config.yaml`
2. Run formatting (this will remove the license header entirely)
```
./toxw -e format
uv run tox -e format
```
3. Remove the `--remove-header` arg from `.pre-commit-config.yaml`
4. Update `ci-tools/license-templates/LICENSE.txt`
5. Run formatting
```
./toxw -e format
uv run tox -e format
```

# Build a docker image

```
./toxw -e docker-build
uv run tox -e docker-build
```
Loading