Skip to content
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
120 changes: 120 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: CI

on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff mypy

- name: Run Ruff linter
run: ruff check .

- name: Run Ruff formatter check
run: ruff format --check .

- name: Run mypy
run: mypy ribotricer --ignore-missing-imports
continue-on-error: true # Remove this once type hints are added

test:
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
include:
- os: macos-latest
python-version: "3.12"

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install system dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y samtools

- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install samtools

- name: Install package
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run unit tests
run: |
pytest tests/ -v --cov=ribotricer --cov-report=xml
continue-on-error: true # Remove once unit tests are added

- name: Run integration tests
run: |
bash ./run_test.sh

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'
with:
file: ./coverage.xml
fail_ci_if_error: false

build:
name: Build package
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v4

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

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
run: python -m build

- name: Check package
run: twine check dist/*

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
85 changes: 85 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Publish to PyPI

on:
release:
types: [published]
workflow_dispatch:
inputs:
test_pypi:
description: 'Publish to Test PyPI instead'
required: false
default: 'false'
type: boolean

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
run: python -m build

- name: Check package
run: twine check dist/*

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

publish-test-pypi:
name: Publish to Test PyPI
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && inputs.test_pypi == 'true'
environment:
name: test-pypi
url: https://test.pypi.org/p/ribotricer
permissions:
id-token: write

steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

publish-pypi:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.test_pypi == 'false')
environment:
name: pypi
url: https://pypi.org/p/ribotricer
permissions:
id-token: write

steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
34 changes: 0 additions & 34 deletions .github/workflows/pythonpackage.yml

This file was deleted.

25 changes: 24 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,33 @@ snakemake/*.stats
*.sqlite.gz
*.sra

#pytest
# pytest
.pytest_cache/
utils/*
snakemake/configs/test*
tests/data/.hg38*
tests/data/hg38.fa.fai
record.txt

# Type checking
.mypy_cache/
.dmypy.json
dmypy.json

# Ruff
.ruff_cache/

# Virtual environments
.venv/
venv/
ENV/

# IDE
.idea/
.vscode/
*.swp
*.swo
*~

# Pre-commit
.pre-commit-cache/
38 changes: 38 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ['--maxkb=1000']
- id: check-merge-conflict
- id: check-toml
- id: debug-statements

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
hooks:
- id: mypy
additional_dependencies:
- types-tqdm
args: [--ignore-missing-imports]
exclude: ^(tests/|docs/)

ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks
autofix_prs: true
autoupdate_branch: ''
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: weekly
skip: []
submodules: false
8 changes: 8 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v1.5.0 (2025-02-14)

- Modernized packaging with `pyproject.toml` (PEP 517/518 compliant)
- Dropped support for Python 3.7 and 3.8 (end of life)
- Added support for Python 3.13
- Added type checking
- Default to sans-serif fonts for plotting

# v1.4.0 (2024-04-14)

- Added `meta_min_reads` parameter to control minimum coverage for metagene plots ([#155](https://github.com/smithlabcode/ribotricer/pull/155))
Expand Down
Loading
Loading