Skip to content

Commit 8005406

Browse files
authored
Merge pull request #37 from complextissue/dev
2 parents 2ffa0cc + 8bd498c commit 8005406

16 files changed

Lines changed: 4572 additions & 348 deletions

.flake8

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Test & lint package & deploy documentation
22

33
on:
4+
workflow_dispatch:
45
schedule:
56
# run every Monday at 15:00 UTC
67
- cron: "0 15 * * 1"
@@ -11,54 +12,49 @@ on:
1112

1213
jobs:
1314
build:
14-
runs-on: ubuntu-latest
15+
runs-on: ${{ matrix.os }}
1516
strategy:
1617
fail-fast: true
1718
matrix:
1819
include:
19-
- os: ubuntu-24.04
20-
python: "3.12"
20+
- os: ubuntu-latest
21+
python: "3.13"
22+
23+
name: Python ${{ matrix.python }}
24+
25+
env:
26+
OS: ${{ matrix.os }}
27+
PYTHON: ${{ matrix.python }}
2128

2229
steps:
23-
- uses: actions/checkout@v3
24-
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@v3
30+
- uses: actions/checkout@v5
31+
- name: Install the latest version of uv and setup Python
32+
uses: astral-sh/setup-uv@v6
2633
with:
34+
version: "latest"
2735
python-version: ${{ matrix.python-version }}
28-
- uses: actions/cache@v3
29-
with:
30-
path: ${{ env.pythonLocation }}
31-
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
36+
enable-cache: true
3237
- name: Install dependencies
3338
run: |
34-
export FLIT_ROOT_INSTALL=1
35-
python -m pip install --upgrade pip
36-
python -m pip install flit
37-
python -m flit install --deps production
38-
python -m pip install biocframe dolomite dolomite-se summarizedexperiment
39-
python -m pip install bandit mypy==1.15.0 ruff==0.11.2
40-
python -m pip install coverage pytest sphinx sphinx-autoapi \
41-
myst-parser pygments sphinx-autodoc-typehints sphinx-rtd-theme furo sphinx_design sphinx-copybutton \
42-
sphinxcontrib-bibtex sphinxcontrib-mermaid nbsphinx pandoc
43-
sudo apt-get update
44-
sudo apt-get install -y pandoc
39+
uv sync --all-extras
4540
- name: Lint with ruff
4641
run: |
47-
ruff check --fix --exit-non-zero-on-fix pytximport
42+
uv run ruff check --fix --exit-non-zero-on-fix pytximport
4843
- name: Format with ruff
4944
run: |
50-
ruff format --check pytximport
45+
uv run ruff format --check pytximport
5146
- name: Type check with mypy
5247
run: |
53-
python -m mypy -p pytximport
48+
uv run mypy -p pytximport
5449
- name: Check security with bandit
5550
run: |
56-
python -m bandit --verbose --ini .bandit.ini -ll --recursive pytximport
51+
uv run bandit --verbose --ini .bandit.ini -ll --recursive pytximport
5752
- name: Test with pytest
5853
run: |
59-
coverage run -m pytest --maxfail=10
60-
coverage xml
61-
- name: Upload coverage reports to Codecov
62-
uses: codecov/codecov-action@v4.0.1
54+
uv run coverage run -m pytest --maxfail=10 -m "not gpu" -m "not no_github_ci"
55+
uv run coverage xml
56+
- name: Upload coverage to Codecov
57+
uses: codecov/codecov-action@v5
6358
with:
59+
fail_ci_if_error: true
6460
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/publish.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Upload Python Package
1+
name: Publish Package
22

33
on:
44
release:
@@ -8,25 +8,25 @@ permissions:
88
contents: read
99

1010
jobs:
11-
deploy:
12-
11+
pypi-publish:
12+
name: Upload release to PyPI
1313
runs-on: ubuntu-latest
14+
environment: pypi
15+
permissions:
16+
contents: read
17+
id-token: write
1418

1519
steps:
16-
- uses: actions/checkout@v4
17-
- name: Set up Python
18-
uses: actions/setup-python@v3
19-
with:
20-
python-version: '3.11'
21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
pip install flit
25-
- name: Build package
26-
run: flit build
27-
- name: Publish package
28-
run: flit publish
29-
env:
30-
FLIT_USERNAME: '__token__'
31-
FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }}
32-
FLIT_INDEX_URL: 'https://upload.pypi.org/legacy/'
20+
- uses: actions/checkout@v5
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version-file: "pyproject.toml"
25+
- name: Install the latest version of uv
26+
uses: astral-sh/setup-uv@v6
27+
with:
28+
version: "latest"
29+
- name: Build package
30+
run: uv build
31+
- name: Publish package
32+
run: uv publish --trusted-publishing always

.pre-commit-config.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ default_stages: [pre-commit, pre-push]
22

33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.4.0
5+
rev: v6.0.0
66
hooks:
77
- id: check-yaml
88
stages: [pre-commit]
@@ -21,33 +21,34 @@ repos:
2121
stages: [pre-commit]
2222
- id: mixed-line-ending
2323
stages: [pre-commit]
24+
- id: no-commit-to-branch
25+
args: [--branch=main]
2426
- repo: https://github.com/astral-sh/ruff-pre-commit
25-
rev: v0.11.2
27+
rev: v0.13.2
2628
hooks:
27-
- id: ruff
28-
args: [--select, I, --fix]
29+
- id: ruff-check
30+
args: [--select, "I,RUF022", --fix, --exit-non-zero-on-fix]
2931
- id: ruff-format
3032
- repo: https://github.com/pre-commit/mirrors-mypy
31-
rev: v1.15.0
33+
rev: "v1.18.2"
3234
hooks:
3335
- id: mypy
3436
stages: [pre-commit]
3537
language: system
3638
pass_filenames: false
3739
args: [-p, pytximport]
3840
- repo: https://github.com/PyCQA/bandit
39-
rev: 1.7.5
41+
rev: 1.8.6
4042
hooks:
4143
- id: bandit
4244
stages: [pre-commit]
4345
args: [--verbose, --ini, .bandit.ini, -ll, --recursive, pytximport]
44-
# run the unittests
4546
- repo: local
4647
hooks:
4748
- id: unittests
4849
stages: [pre-commit]
4950
name: unittests
50-
entry: python -m coverage run -m pytest --maxfail=10
51+
entry: uv run coverage run -m pytest --maxfail=10
5152
language: system
5253
types: [python]
5354
pass_filenames: false

.readthedocs.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
version: 2
22
build:
3-
os: ubuntu-22.04
3+
os: ubuntu-24.04
44
tools:
5-
python: "3.11"
5+
python: "3.12"
6+
jobs:
7+
create_environment:
8+
- asdf plugin add uv
9+
- asdf install uv latest
10+
- asdf global uv latest
11+
- uv venv $READTHEDOCS_VIRTUALENV_PATH
12+
- UV_PROJECT_ENVIRONMENT=$READTHEDOCS_VIRTUALENV_PATH uv sync --all-extras --link-mode=copy
13+
install:
14+
- "true"
615

716
sphinx:
8-
configuration: docs/source/conf.py
9-
fail_on_warning: false
10-
11-
python:
12-
install:
13-
- method: pip
14-
path: .
15-
extra_requirements:
16-
- dev
17+
configuration: docs/source/conf.py
18+
fail_on_warning: false

Makefile

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,33 @@
11
.DEFAULT_GOAL := test
22

3-
#
4-
# Virtual environment setup
5-
# You may want to replace python3 with the path to your python3 executable,
6-
# e.g. the output of `pyenv which python3`when using pyenv
7-
#
8-
create-venv:
9-
python3 -m venv '.venv'
10-
echo "Don't forget to activate with 'source .venv/bin/activate'"
11-
123
#
134
# Install requirements
145
#
156
install:
16-
python3 -m pip install --upgrade pip
17-
python3 -m pip install flit poetry
18-
python3 -m flit install --deps production
7+
uv sync
198

20-
install-dev: install
21-
python3 -m pip install '.[dev]'
22-
python3 -m certifi
9+
install-dev:
10+
uv sync --all-extras
2311
pre-commit install --hook-type pre-commit --hook-type pre-push
2412
echo "Please also install pandoc to create the documentation."
2513

2614
#
27-
# Checks & package upload
15+
# Checks
2816
#
2917
check: install-dev
30-
ruff format --check pytximport
31-
ruff check pytximport
32-
mypy -p pytximport
33-
bandit -ll --recursive pytximport
34-
35-
upload: check
36-
flit publish
18+
uv run ruff format --check pytximport
19+
uv run ruff check pytximport
20+
uv run mypy -p pytximport
21+
uv run bandit -ll --recursive pytximport
3722

3823
#
3924
# Testing
4025
#
4126
unittest:
42-
coverage run -m pytest --maxfail=10
27+
uv run coverage run -m pytest --maxfail=10
4328

4429
coverage-report: unittest
45-
coverage report
46-
coverage html
30+
uv run coverage report
31+
uv run coverage html
4732

4833
test: check unittest

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@ The recommended way to install `pytximport` is through Bioconda:
2929
mamba install -c bioconda pytximport
3030
```
3131

32-
`pytximport` can also be installed via pip:
32+
`pytximport` can also be installed via `pip` or added to your project via `uv`:
3333

3434
```bash
3535
pip install pytximport
3636
```
3737

38+
```bash
39+
uv add pytximport
40+
```
41+
3842
While not required, we recommend users also install `pyarrow` for faster import of tab-separated value-based quantification files:
3943

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

122126
Features unique to `pytximport`:
127+
123128
- 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`.
124129
- Command line interface. Type `pytximport --help` into your terminal to explore all options.
125130
- `AnnData`-support, enabling seamless integration with the `scverse`.
@@ -129,6 +134,7 @@ Features unique to `pytximport`:
129134
- Post-hoc biotype-filtering using `pytximport.utils.filter_by_biotype`.
130135

131136
Features unique to `tximport`:
137+
132138
- Alevin single-cell RNA-seq data support
133139

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

0 commit comments

Comments
 (0)