Skip to content

Python 3.12 #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 27, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
load: true
target: test
- name: Test
run: docker run --rm -t ${{ steps.build.outputs.imageid }} pytest
run: docker run --rm -t ${{ steps.build.outputs.imageid }} poetry run pytest
release:
runs-on: ubuntu-22.04
needs: [commitlint, test]
Expand Down
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml

This file was deleted.

46 changes: 34 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,48 @@
FROM debian:buster as prep
FROM debian:bookworm as pigz
WORKDIR /build
RUN apt-get update && apt-get install -y make gcc zlib1g-dev wget unzip
RUN apt-get update && apt-get install -y gcc make wget zlib1g-dev
RUN wget https://zlib.net/pigz/pigz-2.8.tar.gz && \
tar -xzvf pigz-2.8.tar.gz && \
cd pigz-2.8 && \
make

FROM debian:bookworm as bowtie2
WORKDIR /build
RUN apt-get update && apt-get install -y unzip wget
RUN wget https://github.com/BenLangmead/bowtie2/releases/download/v2.3.2/bowtie2-2.3.2-legacy-linux-x86_64.zip && \
unzip bowtie2-2.3.2-legacy-linux-x86_64.zip && \
mkdir bowtie2 && \
cp bowtie2-2.3.2-legacy/bowtie2* bowtie2

FROM python:3.10-buster as base
FROM python:3.12-bookworm as build
WORKDIR /workflow
COPY --from=prep /build/bowtie2/* /usr/local/bin/
COPY --from=prep /build/pigz-2.8/pigz /usr/local/bin/pigz
RUN curl -sSL https://install.python-poetry.org | python -
ENV PATH="/root/.local/bin:${PATH}"
COPY pyproject.toml poetry.lock utils.py workflow.py VERSION* ./
RUN poetry export > requirements.txt
RUN pip install -r requirements.txt
ENV PATH="/root/.local/bin:${PATH}" \
POETRY_CACHE_DIR='/tmp/poetry_cache' \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1
COPY pyproject.toml poetry.lock ./
RUN poetry install --without dev --no-root

FROM base as test
RUN poetry export --with dev > requirements.txt
RUN pip install -r requirements.txt
FROM python:3.12-bookworm as base
WORKDIR /workflow
ENV VIRTUAL_ENV=/app/.venv \
PATH="/workflow/.venv/bin:/opt/fastqc:${PATH}"
COPY --from=bowtie2 /build/bowtie2/* /usr/local/bin/
COPY --from=pigz /build/pigz-2.8/pigz /usr/local/bin/pigz
COPY --from=build /workflow/.venv /workflow/.venv
COPY fixtures.py utils.py workflow.py VERSION* ./

FROM build as test
COPY --from=bowtie2 /build/bowtie2/* /usr/local/bin/
COPY --from=pigz /build/pigz-2.8/pigz /usr/local/bin/pigz
RUN curl -sSL https://install.python-poetry.org | python -
ENV PATH="/root/.local/bin:${PATH}" \
POETRY_CACHE_DIR='/tmp/poetry_cache' \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1
RUN poetry install
COPY tests ./tests
COPY fixtures.py utils.py workflow.py ./
30 changes: 0 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,3 @@ A workflow for building Virtool reference indexes.
poetry install
poetry run pytest
```

#### Docker Container With External Dependencies Installed

```shell script
cd tests && docker-compose up
```

### Commits

All commits must follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) specification.

These standardized commit messages are used to automatically publish releases using [`semantic-release`](https://semantic-release.gitbook.io/semantic-release)
after commits are merged to `main` from successful PRs.

**Example**

```text
feat: add API support for assigning labels to existing samples
```

Descriptive bodies and footers are required where necessary to describe the impact of the commit. Use bullets where appropriate.

Additional Requirements
1. **Write in the imperative**. For example, _"fix bug"_, not _"fixed bug"_ or _"fixes bug"_.
2. **Don't refer to issues or code reviews**. For example, don't write something like this: _"make style changes requested in review"_.
Instead, _"update styles to improve accessibility"_.
3. **Commits are not your personal journal**. For example, don't write something like this: _"got server running again"_
or _"oops. fixed my code smell"_.

From Tim Pope: [A Note About Git Commit Messages](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
25 changes: 25 additions & 0 deletions fixtures.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import asyncio
from pathlib import Path

from pyfixtures import fixture


@fixture
async def bowtie_path(work_path: Path) -> Path:
"""The path to the generated Bowtie2 index files."""
path = work_path / "bowtie"
await asyncio.to_thread(path.mkdir)

return path / "reference"


@fixture
async def export_json_path(work_path: Path) -> Path:
"""The path to the generated JSON index export file."""
return work_path / "reference.json.gz"


@fixture
async def fasta_path(work_path: Path) -> Path:
"""The path to the generated index file."""
return work_path / "reference.fa"
Loading
Loading