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
6 changes: 0 additions & 6 deletions .flake8

This file was deleted.

54 changes: 25 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Test & lint package & deploy documentation

on:
workflow_dispatch:
schedule:
# run every Monday at 15:00 UTC
- cron: "0 15 * * 1"
Expand All @@ -11,54 +12,49 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-24.04
python: "3.12"
- os: ubuntu-latest
python: "3.13"

name: Python ${{ matrix.python }}

env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
- uses: actions/checkout@v5
- name: Install the latest version of uv and setup Python
uses: astral-sh/setup-uv@v6
with:
version: "latest"
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
enable-cache: true
- name: Install dependencies
run: |
export FLIT_ROOT_INSTALL=1
python -m pip install --upgrade pip
python -m pip install flit
python -m flit install --deps production
python -m pip install biocframe dolomite dolomite-se summarizedexperiment
python -m pip install bandit mypy==1.15.0 ruff==0.11.2
python -m pip install coverage pytest sphinx sphinx-autoapi \
myst-parser pygments sphinx-autodoc-typehints sphinx-rtd-theme furo sphinx_design sphinx-copybutton \
sphinxcontrib-bibtex sphinxcontrib-mermaid nbsphinx pandoc
sudo apt-get update
sudo apt-get install -y pandoc
uv sync --all-extras
- name: Lint with ruff
run: |
ruff check --fix --exit-non-zero-on-fix pytximport
uv run ruff check --fix --exit-non-zero-on-fix pytximport
- name: Format with ruff
run: |
ruff format --check pytximport
uv run ruff format --check pytximport
- name: Type check with mypy
run: |
python -m mypy -p pytximport
uv run mypy -p pytximport
- name: Check security with bandit
run: |
python -m bandit --verbose --ini .bandit.ini -ll --recursive pytximport
uv run bandit --verbose --ini .bandit.ini -ll --recursive pytximport
- name: Test with pytest
run: |
coverage run -m pytest --maxfail=10
coverage xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
uv run coverage run -m pytest --maxfail=10 -m "not gpu" -m "not no_github_ci"
uv run coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
40 changes: 20 additions & 20 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Upload Python Package
name: Publish Package

on:
release:
Expand All @@ -8,25 +8,25 @@ permissions:
contents: read

jobs:
deploy:

pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment: pypi
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flit
- name: Build package
run: flit build
- name: Publish package
run: flit publish
env:
FLIT_USERNAME: '__token__'
FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }}
FLIT_INDEX_URL: 'https://upload.pypi.org/legacy/'
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v6
with:
version: "latest"
- name: Build package
run: uv build
- name: Publish package
run: uv publish --trusted-publishing always
17 changes: 9 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_stages: [pre-commit, pre-push]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v6.0.0
hooks:
- id: check-yaml
stages: [pre-commit]
Expand All @@ -21,33 +21,34 @@ repos:
stages: [pre-commit]
- id: mixed-line-ending
stages: [pre-commit]
- id: no-commit-to-branch
args: [--branch=main]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.2
rev: v0.13.2
hooks:
- id: ruff
args: [--select, I, --fix]
- id: ruff-check
args: [--select, "I,RUF022", --fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
rev: "v1.18.2"
hooks:
- id: mypy
stages: [pre-commit]
language: system
pass_filenames: false
args: [-p, pytximport]
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
rev: 1.8.6
hooks:
- id: bandit
stages: [pre-commit]
args: [--verbose, --ini, .bandit.ini, -ll, --recursive, pytximport]
# run the unittests
- repo: local
hooks:
- id: unittests
stages: [pre-commit]
name: unittests
entry: python -m coverage run -m pytest --maxfail=10
entry: uv run coverage run -m pytest --maxfail=10
language: system
types: [python]
pass_filenames: false
Expand Down
24 changes: 13 additions & 11 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
version: 2
build:
os: ubuntu-22.04
os: ubuntu-24.04
tools:
python: "3.11"
python: "3.12"
jobs:
create_environment:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
- uv venv $READTHEDOCS_VIRTUALENV_PATH
- UV_PROJECT_ENVIRONMENT=$READTHEDOCS_VIRTUALENV_PATH uv sync --all-extras --link-mode=copy
install:
- "true"

sphinx:
configuration: docs/source/conf.py
fail_on_warning: false

python:
install:
- method: pip
path: .
extra_requirements:
- dev
configuration: docs/source/conf.py
fail_on_warning: false
37 changes: 11 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,48 +1,33 @@
.DEFAULT_GOAL := test

#
# Virtual environment setup
# You may want to replace python3 with the path to your python3 executable,
# e.g. the output of `pyenv which python3`when using pyenv
#
create-venv:
python3 -m venv '.venv'
echo "Don't forget to activate with 'source .venv/bin/activate'"

#
# Install requirements
#
install:
python3 -m pip install --upgrade pip
python3 -m pip install flit poetry
python3 -m flit install --deps production
uv sync

install-dev: install
python3 -m pip install '.[dev]'
python3 -m certifi
install-dev:
uv sync --all-extras
pre-commit install --hook-type pre-commit --hook-type pre-push
echo "Please also install pandoc to create the documentation."

#
# Checks & package upload
# Checks
#
check: install-dev
ruff format --check pytximport
ruff check pytximport
mypy -p pytximport
bandit -ll --recursive pytximport

upload: check
flit publish
uv run ruff format --check pytximport
uv run ruff check pytximport
uv run mypy -p pytximport
uv run bandit -ll --recursive pytximport

#
# Testing
#
unittest:
coverage run -m pytest --maxfail=10
uv run coverage run -m pytest --maxfail=10

coverage-report: unittest
coverage report
coverage html
uv run coverage report
uv run coverage html

test: check unittest
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ The recommended way to install `pytximport` is through Bioconda:
mamba install -c bioconda pytximport
```

`pytximport` can also be installed via pip:
`pytximport` can also be installed via `pip` or added to your project via `uv`:

```bash
pip install pytximport
```

```bash
uv add pytximport
```

While not required, we recommend users also install `pyarrow` for faster import of tab-separated value-based quantification files:

```bash
Expand Down Expand Up @@ -120,6 +124,7 @@ Generally, outputs from `pytximport` correspond to the outputs from `tximport` w
While the outputs are identical within floating point tolerance for the same configuration, there remain some differences between the packages:

Features unique to `pytximport`:

- Generating transcript-to-gene maps, either from a BioMart server or an `annotation.gtf` file. Use `create_transcript_gene_map` or `create_transcript_gene_map_from_annotation` from `pytximport.utils`.
- Command line interface. Type `pytximport --help` into your terminal to explore all options.
- `AnnData`-support, enabling seamless integration with the `scverse`.
Expand All @@ -129,6 +134,7 @@ Features unique to `pytximport`:
- Post-hoc biotype-filtering using `pytximport.utils.filter_by_biotype`.

Features unique to `tximport`:

- Alevin single-cell RNA-seq data support

Argument order and argument defaults may differ between the implementations.
Expand All @@ -142,8 +148,7 @@ To set up `pytximport` for development on your machine, we recommend to git clon
```bash
git clone --depth 1 -b dev https://github.com/complextissue/pytximport.git
cd pytximport
pyenv local 3.12
make create-venv
uv venv --python 3.13
source .venv/source/activate
make install-dev
```
Expand Down
Loading