Skip to content

Commit

Permalink
Merge pull request #19 from js2264/PEP621_compliant
Browse files Browse the repository at this point in the history
  • Loading branch information
js2264 authored Feb 19, 2025
2 parents 55fef37 + 72d81d5 commit 1a1f227
Show file tree
Hide file tree
Showing 43 changed files with 610 additions and 599 deletions.
8 changes: 3 additions & 5 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
*
Dockerfile*
.dockerignore
!metator/*
!setup.py
!setup.cfg
!src/*
!external/*
!metator.yaml
!requirements.txt
!pyproject.toml
!MANIFEST.in
!README.md
!external
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Test and Doc

on:
push:
pull_request:

defaults:
run:
shell: bash -l {0}

permissions:
contents: write

jobs:
Test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [ "3.9", "3.10", "3.11" ]
include:
- os: ubuntu-latest
# - os: windows-latest
# - os: macos-latest
runs-on: ${{ matrix.os }}

steps:

- uses: actions/checkout@v4

- name: 🛠️ Install Python ${{ matrix.python-version }} and deps with micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: metator.yaml
init-shell: bash
cache-environment: false
post-cleanup: 'none'
generate-run-shell: true
create-args: >-
python=${{ matrix.python-version }}
- name: 📦 Install package
run: |
pip install .[test]
shell: micromamba-shell {0}

- name: 🧪 Run tests with Python ${{ matrix.python-version }}
run: |
ruff check . --select=E9,F63,F7,F82
pytest --cov --cov-report=xml
shell: micromamba-shell {0}
16 changes: 8 additions & 8 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@ name: Upload Python Package on PyPI
on:
release:
types: [created]
branches: [master]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
- uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install hatch
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{secrets.PYPI_TOKEN}}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
hatch build
twine upload dist/*
61 changes: 0 additions & 61 deletions .github/workflows/python-package.yml

This file was deleted.

10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ wheels/
.installed.cfg
*.egg
MANIFEST
metator.code-workspace

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down Expand Up @@ -133,6 +134,9 @@ venv.bak/
dmypy.json
nf-metator.sif

# Louvain and Leiden installation
external/gen-louvain/
networkanalysis
# Artifacts installation
artifacts/
gen-louvain/
networkanalysis/
pairix/
bowtie2/
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
args: ['--config=./pyproject.toml']
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.6.9
hooks:
- id: ruff
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

All notable changes to this project will be documented in this file.

## [1.3.4] - 2025-02-19
- Package now relies on `pyproject.toml` for build configuration with `hatch`.
- Binaries for `louvain` and `leiden` clustering algorithms are now embedded in the package.
- Uses pre-commit hooks for code formatting and linting.
- Fix deprecated Bio.SeqUtils.GC to Bio.SeqUtils.gc_fraction.
- `Biopython` is pinned <= 1.80 to work with `micomplete 1.1.1`.

## [1.3.3] - 2023-11-27
- Improve ci.
- Add pairix as requirements.
Expand Down
26 changes: 4 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,21 @@
# syntax=docker/dockerfile:1

FROM mambaorg/micromamba:latest

LABEL Name=metator Version=1.3.3
LABEL Name=metator Version=1.3.4

COPY --chown=$MAMBA_USER:$MAMBA_USER . ./

# Install 3rd party packages
USER root
RUN apt update && \
apt install -y --no-install-recommends git make g++ curl default-jre default-jdk zlib1g-dev

# Install Louvain
RUN cd ./external && \
tar -xzf louvain-generic.tar.gz && \
cd gen-louvain && \
make && \
cd ../
ENV LOUVAIN_PATH=./external/gen-louvain

# Install Leiden through Network analysis repo
RUN git clone https://github.com/vtraag/networkanalysis.git && \
cd ./networkanalysis && \
./gradlew build && \
cd ../
ENV LEIDEN_PATH=$(pwd)/networkanalysis/build/libs/networkanalysis-1.2.0.jar
apt install -y --no-install-recommends git make g++ curl default-jre default-jdk zlib1g-dev unzip

## Install dependencies
# ## Install dependencies
USER mambauser
RUN micromamba install -y -n base --file metator.yaml && \
micromamba install -y -n base pip && \
micromamba clean --all --yes

# Install metator
RUN micromamba run -n base python3 -m pip install -e .
RUN micromamba run -n base pip install -e .[dev]

WORKDIR /home/mambauser/
ENTRYPOINT [ "/bin/bash" ]
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include requirements.txt
include README.md
include external/artifacts/*
recursive-exclude test_data *
recursive-exclude tests *
Loading

0 comments on commit 1a1f227

Please sign in to comment.