Skip to content

Commit 74dcde2

Browse files
authored
fix(deps): use python-3.12
* Move fixtures to dedicated module * Make Docker strategy consistent with other workflows. * Use Python 3.12. * Use ruff.
1 parent d0bde7e commit 74dcde2

File tree

8 files changed

+102
-290
lines changed

8 files changed

+102
-290
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
load: true
3333
target: test
3434
- name: Test
35-
run: docker run --rm -t ${{ steps.build.outputs.imageid }} pytest
35+
run: docker run --rm -t ${{ steps.build.outputs.imageid }} poetry run pytest
3636
release:
3737
runs-on: ubuntu-22.04
3838
needs: [commitlint, test]

.pre-commit-config.yaml

-5
This file was deleted.

Dockerfile

+34-12
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,48 @@
1-
FROM debian:buster as prep
1+
FROM debian:bookworm as pigz
22
WORKDIR /build
3-
RUN apt-get update && apt-get install -y make gcc zlib1g-dev wget unzip
3+
RUN apt-get update && apt-get install -y gcc make wget zlib1g-dev
44
RUN wget https://zlib.net/pigz/pigz-2.8.tar.gz && \
55
tar -xzvf pigz-2.8.tar.gz && \
66
cd pigz-2.8 && \
77
make
8+
9+
FROM debian:bookworm as bowtie2
10+
WORKDIR /build
11+
RUN apt-get update && apt-get install -y unzip wget
812
RUN wget https://github.com/BenLangmead/bowtie2/releases/download/v2.3.2/bowtie2-2.3.2-legacy-linux-x86_64.zip && \
913
unzip bowtie2-2.3.2-legacy-linux-x86_64.zip && \
1014
mkdir bowtie2 && \
1115
cp bowtie2-2.3.2-legacy/bowtie2* bowtie2
1216

13-
FROM python:3.10-buster as base
17+
FROM python:3.12-bookworm as build
1418
WORKDIR /workflow
15-
COPY --from=prep /build/bowtie2/* /usr/local/bin/
16-
COPY --from=prep /build/pigz-2.8/pigz /usr/local/bin/pigz
1719
RUN curl -sSL https://install.python-poetry.org | python -
18-
ENV PATH="/root/.local/bin:${PATH}"
19-
COPY pyproject.toml poetry.lock utils.py workflow.py VERSION* ./
20-
RUN poetry export > requirements.txt
21-
RUN pip install -r requirements.txt
20+
ENV PATH="/root/.local/bin:${PATH}" \
21+
POETRY_CACHE_DIR='/tmp/poetry_cache' \
22+
POETRY_NO_INTERACTION=1 \
23+
POETRY_VIRTUALENVS_IN_PROJECT=1 \
24+
POETRY_VIRTUALENVS_CREATE=1
25+
COPY pyproject.toml poetry.lock ./
26+
RUN poetry install --without dev --no-root
2227

23-
FROM base as test
24-
RUN poetry export --with dev > requirements.txt
25-
RUN pip install -r requirements.txt
28+
FROM python:3.12-bookworm as base
29+
WORKDIR /workflow
30+
ENV VIRTUAL_ENV=/app/.venv \
31+
PATH="/workflow/.venv/bin:/opt/fastqc:${PATH}"
32+
COPY --from=bowtie2 /build/bowtie2/* /usr/local/bin/
33+
COPY --from=pigz /build/pigz-2.8/pigz /usr/local/bin/pigz
34+
COPY --from=build /workflow/.venv /workflow/.venv
35+
COPY fixtures.py utils.py workflow.py VERSION* ./
36+
37+
FROM build as test
38+
COPY --from=bowtie2 /build/bowtie2/* /usr/local/bin/
39+
COPY --from=pigz /build/pigz-2.8/pigz /usr/local/bin/pigz
40+
RUN curl -sSL https://install.python-poetry.org | python -
41+
ENV PATH="/root/.local/bin:${PATH}" \
42+
POETRY_CACHE_DIR='/tmp/poetry_cache' \
43+
POETRY_NO_INTERACTION=1 \
44+
POETRY_VIRTUALENVS_IN_PROJECT=1 \
45+
POETRY_VIRTUALENVS_CREATE=1
46+
RUN poetry install
2647
COPY tests ./tests
48+
COPY fixtures.py utils.py workflow.py ./

README.md

-30
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,3 @@ A workflow for building Virtool reference indexes.
1919
poetry install
2020
poetry run pytest
2121
```
22-
23-
#### Docker Container With External Dependencies Installed
24-
25-
```shell script
26-
cd tests && docker-compose up
27-
```
28-
29-
### Commits
30-
31-
All commits must follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) specification.
32-
33-
These standardized commit messages are used to automatically publish releases using [`semantic-release`](https://semantic-release.gitbook.io/semantic-release)
34-
after commits are merged to `main` from successful PRs.
35-
36-
**Example**
37-
38-
```text
39-
feat: add API support for assigning labels to existing samples
40-
```
41-
42-
Descriptive bodies and footers are required where necessary to describe the impact of the commit. Use bullets where appropriate.
43-
44-
Additional Requirements
45-
1. **Write in the imperative**. For example, _"fix bug"_, not _"fixed bug"_ or _"fixes bug"_.
46-
2. **Don't refer to issues or code reviews**. For example, don't write something like this: _"make style changes requested in review"_.
47-
Instead, _"update styles to improve accessibility"_.
48-
3. **Commits are not your personal journal**. For example, don't write something like this: _"got server running again"_
49-
or _"oops. fixed my code smell"_.
50-
51-
From Tim Pope: [A Note About Git Commit Messages](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)

fixtures.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import asyncio
2+
from pathlib import Path
3+
4+
from pyfixtures import fixture
5+
6+
7+
@fixture
8+
async def bowtie_path(work_path: Path) -> Path:
9+
"""The path to the generated Bowtie2 index files."""
10+
path = work_path / "bowtie"
11+
await asyncio.to_thread(path.mkdir)
12+
13+
return path / "reference"
14+
15+
16+
@fixture
17+
async def export_json_path(work_path: Path) -> Path:
18+
"""The path to the generated JSON index export file."""
19+
return work_path / "reference.json.gz"
20+
21+
22+
@fixture
23+
async def fasta_path(work_path: Path) -> Path:
24+
"""The path to the generated index file."""
25+
return work_path / "reference.fa"

0 commit comments

Comments
 (0)