Skip to content

Commit

Permalink
Merge pull request #82 from Clinical-Genomics/depend_setuptools
Browse files Browse the repository at this point in the history
Fix #81 - setuptools not explicit in all distros - switch to uv
  • Loading branch information
dnil authored Nov 25, 2024
2 parents 7eebded + c027f70 commit 5fbae0d
Show file tree
Hide file tree
Showing 12 changed files with 634 additions and 226 deletions.
46 changes: 14 additions & 32 deletions .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,27 @@ on:
- created

jobs:
build-n-publish:
name: Build and publish Python distribution to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Check out git repository
uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install build tools
run: >-
python -m
pip install
wheel
twine
--user
- name: Build a binary wheel and a source tarball
run: >-
python
setup.py
sdist
bdist_wheel
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
pypi:
name: Build and publish to PyPI
runs-on: ubuntu-latest
# Environment and permissions trusted publishing.
environment:
name: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
- run: uv build
- run: uv publish --trusted-publishing always

docker-image-CI:
name: Docker Image CI
runs-on: ubuntu-latest
steps:

- name: Check out git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Publish main image (Dockerfile) to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
Expand Down
44 changes: 20 additions & 24 deletions .github/workflows/tests_and_cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,46 +12,42 @@ jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check out git repository
uses: actions/checkout@v4

- name: Set up Python 3.11
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version-file: ".python-version"

# Cache package installation step to speed up the following step
- uses: actions/cache@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }} }}
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Install deps
run: |
pip install --upgrade --upgrade-strategy eager -e .
pip check
- name: Install the project
run: uv sync --all-extras --dev

test:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
python-version: 3.11
enable-cache: true
cache-dependency-glob: "uv.lock"

# Cache package installation step to speed up the following step
- uses: actions/cache@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}

- name: Install pytest
run: pip install pytest pytest-cov
python-version-file: ".python-version"

- name: Run pytest
run: pytest --cov --rootdir=/home/runner/work/stranger
run: uv run pytest tests --cov --rootdir=/home/runner/work/stranger

- name: Upload coverage
uses: actions/upload-artifact@v4
Expand All @@ -65,10 +61,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version-file: ".python-version"
- name: Install deps
run: |
python -m pip install --upgrade pip
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [unreleased]
### Fixed
- Switch build system to uv-hatchling

## [0.9.2]
### Fixed
- Use codecov badge and fix scout link on README page
Expand Down
17 changes: 9 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
# docker run -v $PWD:$PWD clinical-genomics/stranger:v0.9.0 stranger --help
# docker run -v $PWD:$PWD clinical-genomics/stranger:v0.9.0 stranger -f /bin/stranger/stranger/resources/variant_catalog_hg38.json $PWD/sample.joint.repeats.merged.vcf.gz > $PWD/sample.repeats.stranger.vcf
###############################################
FROM continuumio/miniconda3:23.3.1-0-alpine
FROM ghcr.io/astral-sh/uv:python3.13-alpine

# Install git
RUN conda install -c anaconda git && \
cd /bin && \
git clone --depth 1 https://github.com/Clinical-Genomics/stranger.git && \
cd stranger && \
pip install --editable .
# Copy the project into the image
ADD . /app

ENTRYPOINT ["stranger"]
# Sync the project into a new environment, using the frozen lockfile
WORKDIR /app
RUN uv sync --frozen


ENTRYPOINT ["uv", "run", "stranger"]
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ Annotates output files from [ExpansionHunter][hunter] and [TRGT][trgt] with the

## Installation

Stranger uses the `uv` project manager. It is very quick and lightweight - see the [uv installation instructions](https://docs.astral.sh/uv/getting-started/installation/).

```
git clone github.com/clinical-genomics/stranger
cd stranger
pip install --editable .
uv pip install --editable .
```

## Usage

```
uv run stranger --help
Usage: stranger [OPTIONS] VCF
Annotate str variants with str status
Expand Down
67 changes: 67 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[project]
name = "stranger"
version = "0.9.2"
description = "Annotate VCF files with STR variants with pathogenicity implications"
authors = [{name="Daniel Nilsson", email="[email protected]"}, {name="Mans Magnuson", email="[email protected]"}]
license = {text = "MIT License"}
readme = "README.md"
include = [
"README.md",
"stranger/**/*",
"tests/**/*"
]
requires-python = ">=3.7"
keywords = ["vcf", "variants", "str"]
classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: Implementation :: CPython",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Unix",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
]
dependencies = [
"click",
"coloredlogs",
"importlib-resources>=5.12.0",
"PyYAML",
]

[project.urls]
Repository = "https://github.com/Clinical-Genomics/stranger"
Changelog = "https://github.com/Clinical-Genomics/stranger/blob/main/CHANGELOG.md"
"Bug Tracker" = "https://github.com/Clinical-Genomics/stranger/issues"


[project.scripts]
stranger = "stranger.cli:cli"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.black]
line-length = 100
target-version = ['py313']

[tool.ruff]
src = ["stranger", "tests", "scripts"]
line-length = 100

[tool.isort]
profile = "black"

[dependency-groups]
dev = [
"pytest-cov>=4.1.0",
"pytest>=7.4.4",
]
lint = [
"black>=23.3.0",
"isort>=5.11.5",
"ruff>=0.8.0",
]
Loading

0 comments on commit 5fbae0d

Please sign in to comment.