Skip to content

Commit 3614a7a

Browse files
authored
fix: support int | str group ids
* Update `virtool-workflow` to support `int | str` ids. * Remove deepsource coverage analyzer.
1 parent 3811565 commit 3614a7a

File tree

8 files changed

+799
-956
lines changed

8 files changed

+799
-956
lines changed

.deepsource.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ version = 1
22

33
test_patterns = ["tests/**"]
44

5-
[[analyzers]]
6-
name = "test-coverage"
7-
enabled = true
8-
95
[[analyzers]]
106
name = "python"
117
enabled = true

.github/workflows/publish.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
uses: docker/build-push-action@v4
3535
with:
3636
context: .
37+
labels: ${{ steps.meta.outputs.labels }}
3738
push: true
3839
tags: ${{ steps.meta.outputs.tags }}
39-
labels: ${{ steps.meta.outputs.labels }}
40+
target: "base"

Dockerfile

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,42 @@
1-
FROM python:3.10-buster as rustPyo3
1+
FROM debian:buster as prep
2+
WORKDIR /build
3+
RUN apt-get update && apt-get install -y make gcc zlib1g-dev wget unzip
4+
RUN wget https://zlib.net/pigz/pigz-2.8.tar.gz && \
5+
tar -xzvf pigz-2.8.tar.gz && \
6+
cd pigz-2.8 && \
7+
make
8+
RUN wget https://github.com/BenLangmead/bowtie2/releases/download/v2.3.2/bowtie2-2.3.2-legacy-linux-x86_64.zip && \
9+
unzip bowtie2-2.3.2-legacy-linux-x86_64.zip && \
10+
mkdir bowtie2 && \
11+
cp bowtie2-2.3.2-legacy/bowtie2* bowtie2
12+
13+
FROM python:3.10-buster as rust
214
WORKDIR /build
315
RUN apt-get update && apt-get install -y curl build-essential
416
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
517
ENV PATH="/root/.cargo/bin:${PATH}"
6-
RUN pip install maturin==0.14.5
18+
RUN pip install maturin==0.14.7
719
COPY src src
820
COPY Cargo.toml Cargo.lock ./
921
RUN maturin build --release
1022

11-
FROM virtool/workflow:5.3.0 as test
12-
WORKDIR /test
13-
COPY poetry.lock pyproject.toml /test/
23+
FROM python:3.10-buster as base
24+
WORKDIR /workflow
1425
RUN curl -sSL https://install.python-poetry.org | python -
15-
RUN poetry install
16-
COPY tests / test/
17-
COPY fixtures.py workflow.py pytest.ini /test/
18-
COPY --from=rustPyo3 /build/target/wheels/count_nucleotides_and_seqs*.whl ./
19-
RUN ls
20-
RUN pip3.10 install count_nucleotides_and_seqs*.whl
21-
RUN poetry install
22-
RUN poetry add ./count_nucleotides_and_seqs*.whl
23-
RUN poetry run pytest
26+
ENV PATH="/root/.local/bin:${PATH}"
27+
COPY --from=prep /build/bowtie2/* /usr/local/bin/
28+
COPY --from=prep /build/pigz-2.8/pigz /usr/local/bin/pigz
29+
COPY --from=rust /build/target/wheels/count_nucleotides_and_seqs*.whl ./
30+
COPY fixtures.py workflow.py pyproject.toml poetry.lock ./
31+
RUN poetry export > requirements.txt
32+
RUN pip install --upgrade pip
33+
RUN pip install -r requirements.txt
34+
RUN pip install ./count_nucleotides_and_seqs*.whl
2435

25-
FROM virtool/workflow:5.3.0 as build
36+
FROM base as test
2637
WORKDIR /workflow
27-
COPY fixtures.py workflow.py /workflow/
28-
COPY --from=rustPyo3 /build/target/wheels/count_nucleotides_and_seqs*.whl ./
29-
RUN ls
30-
RUN pip3.10 install count_nucleotides_and_seqs*.whl
31-
RUN poetry install
32-
RUN poetry add ./count_nucleotides_and_seqs*.whl
38+
RUN poetry export --with dev > requirements.txt
39+
RUN pip install -r requirements.txt
40+
COPY pytest.ini ./
41+
COPY tests ./tests
42+
RUN pytest

fixtures.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
from pathlib import Path
22
from types import SimpleNamespace
3-
from typing import List
43

54
from pyfixtures import fixture
65
from virtool_workflow.api.subtractions import SubtractionProvider
76

87

98
@fixture
10-
def subtraction_provider(subtraction_providers: List[SubtractionProvider]):
11-
return subtraction_providers[0]
12-
13-
14-
@fixture
15-
def intermediate():
16-
"""A namespace for intermediate variables."""
17-
return SimpleNamespace()
9+
def fasta_path(work_path: Path) -> Path:
10+
"""The path to the decompressed FASTA file."""
11+
return work_path / "subtraction.fa"
1812

1913

2014
@fixture
@@ -24,6 +18,13 @@ def input_path(input_files: dict) -> Path:
2418

2519

2620
@fixture
27-
def fasta_path(work_path: Path) -> Path:
28-
"""The path to the decompressed FASTA file."""
29-
return work_path / "subtraction.fa"
21+
def intermediate() -> SimpleNamespace:
22+
"""A namespace for intermediate variables."""
23+
return SimpleNamespace()
24+
25+
26+
@fixture
27+
def subtraction_provider(
28+
subtraction_providers: list[SubtractionProvider],
29+
) -> SubtractionProvider:
30+
return subtraction_providers[0]

poetry.lock

Lines changed: 737 additions & 902 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
[tool.poetry]
22
name = "workflow-create-subtraction"
33
version = "0.0.0"
4-
description = ""
5-
authors = ["Ian Boyes <igboyes@gmail.com>"]
4+
description = "A workflow for creating Virtool subtractions"
5+
authors = [
6+
"Ian Boyes",
7+
"Blake Smith",
8+
"Tiansheng Sui",
9+
"Markus Swoveland",
10+
"Christine Wong Chong"
11+
]
612

713
[tool.poetry.dependencies]
8-
python = "^3.10"
9-
pyfixtures = "^1.1.0"
10-
virtool-workflow = "^5.0.0"
11-
pre-commit = "^3.0.4"
12-
black = "^23.1.0"
14+
python = "~3.10"
15+
virtool-workflow = "^5.4.2"
1316

1417
[tool.poetry.group.dev.dependencies]
15-
pytest = "^7.1.2"
16-
pytest-aiohttp = "^1.0.4"
18+
pytest = "^7.4.2"
19+
pytest-aiohttp = "^1.0.5"
20+
pytest-asyncio = "^0.21.1"
1721
pytest-datafiles = "^2.0.1"
18-
pytest-asyncio = "^0.17.0"
1922

2023
[build-system]
2124
requires = ["poetry-core>=1.0.0"]

tests/test_workflow.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,5 @@ async def test_decompress_and_compute_gc(datafiles, tmpdir):
2121

2222
await compute_gc_and_count(fasta_path, intermediate)
2323

24-
print(intermediate.gc)
25-
2624
assert intermediate.gc == {"a": 0.319, "t": 0.319, "g": 0.18, "c": 0.18, "n": 0.002}
2725
assert intermediate.count == 7

workflow.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from types import SimpleNamespace
55

66
import count_nucleotides_and_seqs
7-
87
from virtool_core.utils import compress_file, decompress_file, is_gzipped
98
from virtool_workflow import hooks, step
109
from virtool_workflow.api.subtractions import SubtractionProvider
@@ -60,11 +59,11 @@ async def compute_gc_and_count(fasta_path: Path, intermediate: SimpleNamespace):
6059

6160
@step
6261
async def build_index(
63-
proc: int,
6462
fasta_path: Path,
6563
intermediate: SimpleNamespace,
66-
work_path: Path,
64+
proc: int,
6765
run_subprocess: RunSubprocess,
66+
work_path: Path,
6867
):
6968
"""Build a Bowtie2 index."""
7069
bowtie_path = work_path / "index-build"
@@ -88,8 +87,8 @@ async def build_index(
8887
async def finalize(
8988
fasta_path: Path,
9089
intermediate: SimpleNamespace,
91-
subtraction_provider: SubtractionProvider,
9290
proc: int,
91+
subtraction_provider: SubtractionProvider,
9392
):
9493
"""Compress and subtraction data."""
9594
compressed_path = fasta_path.parent / "subtraction.fa.gz"

0 commit comments

Comments
 (0)