Skip to content

Commit cfbc2f2

Browse files
authored
Merge pull request #27 from complextissue/dev
Use ruff, require Python 3.10, improve docstrings, add view source to docs
2 parents 3e80fa6 + d8c2822 commit cfbc2f2

32 files changed

+222
-330
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: maltekuehl

.github/ISSUE_TEMPLATE/help.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ assignees: ''
77
---
88

99
Ask for help on how to best use `pytximport`. Prior to submitting your question, please read through the follwoing resources:
10-
- The `pytximport` documentation available at: [https://pytximport.readthedocs.io](https://pytximport.readthedocs.io)
10+
- The `pytximport` documentation available at: [https://pytximport.complextissue.com](https://pytximport.complextissue.com)
1111
- The `tximport` documentation available at: [https://bioconductor.org/packages/release/bioc/vignettes/tximport/inst/doc/tximport.html](https://bioconductor.org/packages/release/bioc/vignettes/tximport/inst/doc/tximport.html)
1212
- The original `tximport` publication by [Soneson et al.](https://f1000research.com/articles/4-1521).

.github/workflows/ci.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: true
1717
matrix:
18-
python-version: [3.9.16]
18+
python-version: [3.12.6]
1919

2020
steps:
2121
- uses: actions/checkout@v3
@@ -34,21 +34,18 @@ jobs:
3434
python -m pip install flit
3535
python -m flit install --deps production
3636
python -m pip install biocframe dolomite dolomite-se summarizedexperiment
37-
python -m pip install black flake8 flake8-docstrings isort flake8-comprehensions mypy
38-
python -m pip install coverage pytest bandit sphinx sphinx-autoapi \
39-
myst-parser pybiomart pygments sphinx-autodoc-typehints sphinx-rtd-theme furo sphinx_design \
40-
sphinx-copybutton sphinxcontrib-bibtex sphinxcontrib-mermaid nbsphinx pandoc
37+
python -m pip install bandit mypy ruff==0.11.2
38+
python -m pip install coverage pytest sphinx sphinx-autoapi \
39+
myst-parser pygments sphinx-autodoc-typehints sphinx-rtd-theme furo sphinx_design sphinx-copybutton \
40+
sphinxcontrib-bibtex sphinxcontrib-mermaid nbsphinx pandoc
4141
sudo apt-get update
4242
sudo apt-get install -y pandoc
43-
- name: Format with black
43+
- name: Lint with ruff
4444
run: |
45-
python -m black .
46-
- name: Lint with flake8
45+
ruff check --fix --exit-non-zero-on-fix pytximport
46+
- name: Format with ruff
4747
run: |
48-
python -m flake8 pytximport
49-
- name: Check imports with isort
50-
run: |
51-
python -m isort --check-only --diff --recursive pytximport
48+
ruff format --check pytximport
5249
- name: Type check with mypy
5350
run: |
5451
python -m mypy -p pytximport

.pre-commit-config.yaml

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,58 +5,47 @@ repos:
55
rev: v4.4.0
66
hooks:
77
- id: check-yaml
8-
stages: [commit]
8+
stages: [pre-commit]
99
- id: check-toml
10-
stages: [commit]
10+
stages: [pre-commit]
1111
- id: end-of-file-fixer
12-
stages: [commit]
12+
stages: [pre-commit]
1313
- id: trailing-whitespace
14-
stages: [commit]
14+
stages: [pre-commit]
1515
- id: requirements-txt-fixer
16-
stages: [commit]
16+
stages: [pre-commit]
1717
- id: check-added-large-files
18-
stages: [commit]
18+
stages: [pre-commit]
1919
args: ["--maxkb=50000"]
2020
- id: check-case-conflict
21-
stages: [commit]
21+
stages: [pre-commit]
2222
- id: mixed-line-ending
23-
stages: [commit]
24-
- repo: https://github.com/pycqa/isort
25-
rev: 5.12.0
23+
stages: [pre-commit]
24+
- repo: https://github.com/astral-sh/ruff-pre-commit
25+
rev: v0.11.2
2626
hooks:
27-
- id: isort
28-
stages: [commit]
29-
args: ["--profile", "black", "--filter-files"]
30-
- repo: https://github.com/python/black
31-
rev: 23.3.0
32-
hooks:
33-
- id: black
34-
stages: [commit]
35-
args: [--line-length=120]
36-
- repo: https://github.com/pycqa/flake8
37-
rev: 6.0.0
38-
hooks:
39-
- id: flake8
40-
stages: [commit]
27+
- id: ruff
28+
args: [--select, I, --fix]
29+
- id: ruff-format
4130
- repo: https://github.com/pre-commit/mirrors-mypy
42-
rev: "v1.3.0"
31+
rev: v1.15.0
4332
hooks:
4433
- id: mypy
45-
stages: [commit]
34+
stages: [pre-commit]
4635
language: system
4736
pass_filenames: false
4837
args: [-p, pytximport]
4938
- repo: https://github.com/PyCQA/bandit
5039
rev: 1.7.5
5140
hooks:
5241
- id: bandit
53-
stages: [commit]
42+
stages: [pre-commit]
5443
args: [--verbose, --ini, .bandit.ini, -ll, --recursive, pytximport]
5544
# run the unittests
5645
- repo: local
5746
hooks:
5847
- id: unittests
59-
stages: [commit]
48+
stages: [pre-commit]
6049
name: unittests
6150
entry: python -m coverage run -m pytest --maxfail=10
6251
language: system

.vscode/extensions.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
{
22
"recommendations": [
3+
"charliermarsh.ruff",
34
"ms-python.python",
45
"ms-python.vscode-pylance",
56
"ms-python.vscode-pylance-extra-types",
67
"ms-python.python-test-adapter",
78
"ms-python.vscode-pylance-pack",
8-
"ms-python.isort",
99
"njpwerner.autodocstring",
10-
"ms-python.black-formatter",
11-
"ms-python.flake8",
1210
"shardulm94.trailing-spaces",
1311
"ms-vscode.makefile-tools",
1412
]

.vscode/settings.json

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,44 @@
11
{
2-
"editor.rulers": [
3-
{
4-
"column": 120,
5-
"color": "#ddd"
6-
}
7-
],
8-
"editor.tabSize": 4,
9-
"editor.insertSpaces": true,
10-
"editor.detectIndentation": false,
11-
"editor.formatOnSave": true,
12-
"python.languageServer": "Pylance",
13-
"python.analysis.typeCheckingMode": "off",
14-
"[python]": {
15-
"editor.formatOnPaste": false, // not supported by black
16-
"editor.formatOnSaveMode": "file",
17-
"editor.defaultFormatter": "ms-python.black-formatter"
18-
},
19-
"python.analysis.extraPaths": ["pytximport", "test", "examples"],
20-
"python.analysis.exclude": ["**/.venv/**", "**/__pycache__/**"],
21-
"python.defaultInterpreterPath": ".venv/bin/python",
22-
"isort.args": ["--profile", "black"],
23-
"python.testing.unittestEnabled": false,
24-
"python.testing.pytestEnabled": true,
25-
"files.insertFinalNewline": true,
26-
"esbonio.sphinx.confDir": "${workspaceFolder}/docs/source",
27-
"trailing-spaces.trimOnSave": true,
28-
"notebook.formatOnSave.enabled": true,
29-
"notebook.cellFocusIndicator": "gutter",
30-
"notebook.lineNumbers": "on",
31-
"files.watcherExclude": {
32-
"**/.venv/**": true
33-
},
34-
"githubPullRequests.ignoredPullRequestBranches": ["main"]
2+
"[python]": {
3+
"editor.defaultFormatter": "charliermarsh.ruff",
4+
"editor.formatOnPaste": false,
5+
"editor.formatOnSaveMode": "file"
6+
},
7+
"editor.detectIndentation": false,
8+
"editor.formatOnSave": true,
9+
"editor.insertSpaces": true,
10+
"editor.rulers": [
11+
{
12+
"color": "#ddd",
13+
"column": 120
14+
}
15+
],
16+
"editor.tabSize": 4,
17+
"esbonio.sphinx.confDir": "${workspaceFolder}/docs/source",
18+
"files.insertFinalNewline": true,
19+
"files.watcherExclude": {
20+
"**/.venv/**": true
21+
},
22+
"githubPullRequests.ignoredPullRequestBranches": [
23+
"main"
24+
],
25+
"notebook.cellFocusIndicator": "gutter",
26+
"notebook.formatOnSave.enabled": true,
27+
"notebook.lineNumbers": "on",
28+
"python.analysis.exclude": [
29+
"**/.venv/**",
30+
"**/__pycache__/**"
31+
],
32+
"python.analysis.extraPaths": [
33+
"examples",
34+
"pytximport",
35+
"test"
36+
],
37+
"python.analysis.typeCheckingMode": "off",
38+
"python.defaultInterpreterPath": ".venv/bin/python",
39+
"python.languageServer": "Pylance",
40+
"python.testing.pytestEnabled": true,
41+
"python.testing.unittestEnabled": false,
42+
"ruff.organizeImports": true,
43+
"trailing-spaces.trimOnSave": true
3544
}

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ identifiers:
2929
value: 10.1093/bioinformatics/btae700
3030
description: Bioinformatics manuscript
3131
repository-code: 'https://github.com/complextissue/pytximport'
32-
url: 'https://pytximport.readthedocs.io'
32+
url: 'https://pytximport.complextissue.com'
3333
abstract: >-
3434
Transcript quantification tools efficiently map bulk RNA
3535
sequencing reads to reference transcriptomes. However,

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ install-dev: install
2727
# Checks & package upload
2828
#
2929
check: install-dev
30-
isort pytximport
31-
black --check pytximport
32-
flake8 pytximport
30+
ruff format --check pytximport
31+
ruff check pytximport
32+
mypy -p pytximport
3333
bandit -ll --recursive pytximport
3434

3535
upload: check

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55
[![Version](https://img.shields.io/pypi/v/pytximport)](https://pypi.org/project/pytximport/)
66
[![License](https://img.shields.io/pypi/l/pytximport)](https://github.com/complextissue/pytximport)
77
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/complextissue/pytximport/ci.yml)
8-
[![Documentation Status](https://readthedocs.org/projects/pytximport/badge/?version=latest)](https://pytximport.readthedocs.io/en/latest/?badge=latest)
8+
[![Documentation Status](https://readthedocs.org/projects/pytximport/badge/?version=latest)](https://pytximport.complextissue.com/en/latest/?badge=latest)
99
[![Codecov](https://codecov.io/gh/complextissue/pytximport/graph/badge.svg?token=M9JEHJVXYI)](https://codecov.io/gh/complextissue/pytximport)
1010
[![Install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat)](http://bioconda.github.io/recipes/pytximport/README.html)
1111
![Conda Downloads](https://img.shields.io/conda/d/bioconda/pytximport)
1212
![Pepy Total Downloads](https://img.shields.io/pepy/dt/pytximport?label=PyPi%7Cdownloads)
1313
[![Python Version Required](https://img.shields.io/pypi/pyversions/pytximport)](https://pypi.org/project/pytximport/)
14-
[![Code Style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
14+
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
1515
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
1616

1717
`pytximport` is a Python package for efficient (gene-)count estimation from transcript quantification files produced by pseudoalignment/quasi-mapping tools such as `salmon`, `kallisto`, `rsem` and others. `pytximport` is a port of the popular [tximport Bioconductor R package](https://bioconductor.org/packages/release/bioc/html/tximport.html).
1818

1919
## Manuscript & Documentation
2020

2121
The pytximport manuscript can be accessed at: [https://doi.org/10.1093/bioinformatics/btae700](https://doi.org/10.1093/bioinformatics/btae700).
22-
Detailled documentation is made available at: [https://pytximport.readthedocs.io](https://pytximport.readthedocs.io/en/latest/start.html).
22+
Detailled documentation is made available at: [https://pytximport.complextissue.com](https://pytximport.complextissue.com/en/latest/start.html).
2323

2424
## Installation
2525

@@ -142,7 +142,7 @@ To set up `pytximport` for development on your machine, we recommend to git clon
142142
```bash
143143
git clone --depth 1 -b dev https://github.com/complextissue/pytximport.git
144144
cd pytximport
145-
pyenv local 3.9
145+
pyenv local 3.12
146146
make create-venv
147147
source .venv/source/activate
148148
make install-dev

docs/Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,22 @@ help:
1010
# cp ../README.md ./source/introduction.md
1111
build-docs:
1212
@./install.sh
13-
rm -rf build
1413
make html
1514

1615
.PHONY: help Makefile
1716

17+
reset-build:
18+
if [ -d ./build/doctrees ]; then \
19+
rm -r ./build/doctrees; \
20+
fi && \
21+
if [ -d ./build/html ]; then \
22+
rm -r ./build/html; \
23+
fi && \
24+
mkdir -p ./build/doctrees && \
25+
mkdir -p ./build/html
26+
1827
# Catch-all target: route all unknown targets to Sphinx using the new
1928
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
2029
%: Makefile
30+
make reset-build
2131
sphinx-build -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"sphinx.ext.autodoc",
3838
"sphinx.ext.intersphinx",
3939
"sphinx.ext.napoleon",
40+
"sphinx.ext.viewcode",
4041
"sphinx.ext.githubpages",
4142
"sphinx_copybutton",
4243
"sphinx_design",

docs/source/example.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,12 +513,13 @@
513513
},
514514
{
515515
"cell_type": "code",
516-
"execution_count": 6,
516+
"execution_count": null,
517517
"metadata": {},
518518
"outputs": [],
519519
"source": [
520520
"import numpy as np\n",
521521
"import pandas as pd\n",
522+
"\n",
522523
"from pytximport import tximport"
523524
]
524525
},
@@ -1813,14 +1814,14 @@
18131814
},
18141815
{
18151816
"cell_type": "code",
1816-
"execution_count": 21,
1817+
"execution_count": null,
18171818
"metadata": {},
18181819
"outputs": [],
18191820
"source": [
1821+
"import decoupler as dc\n",
18201822
"from pydeseq2.dds import DeseqDataSet\n",
18211823
"from pydeseq2.default_inference import DefaultInference\n",
1822-
"from pydeseq2.ds import DeseqStats\n",
1823-
"import decoupler as dc"
1824+
"from pydeseq2.ds import DeseqStats"
18241825
]
18251826
},
18261827
{

docs/source/installation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
:::{card}
44
:class-card: sd-bg-warning
55
:class-body: sd-bg-text-warning
6-
**pytximport** only supports Python versions greater than or equal to **3.9**.
6+
**pytximport** only supports Python versions greater than or equal to **3.10**.
77
:::
88

99
:::{card} Recommendation
@@ -56,7 +56,7 @@ Install `pytximport` from source:
5656
```bash
5757
git clone --depth 1 -b dev https://github.com/complextissue/pytximport.git
5858
cd pytximport
59-
pyenv local 3.9
59+
pyenv local 3.12
6060
make create-venv
6161
source .venv/source/activate
6262
make install-dev

docs/source/start.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55
[![Version](https://img.shields.io/pypi/v/pytximport)](https://pypi.org/project/pytximport/)
66
[![License](https://img.shields.io/pypi/l/pytximport)](https://github.com/complextissue/pytximport)
77
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/complextissue/pytximport/ci.yml)
8-
[![Documentation Status](https://readthedocs.org/projects/pytximport/badge/?version=latest)](https://pytximport.readthedocs.io/en/latest/?badge=latest)
8+
[![Documentation Status](https://readthedocs.org/projects/pytximport/badge/?version=latest)](https://pytximport.complextissue.com/en/latest/?badge=latest)
99
[![Codecov](https://codecov.io/gh/complextissue/pytximport/graph/badge.svg?token=M9JEHJVXYI)](https://codecov.io/gh/complextissue/pytximport)
1010
[![Install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat)](http://bioconda.github.io/recipes/pytximport/README.html)
1111
![Conda Downloads](https://img.shields.io/conda/d/bioconda/pytximport)
1212
![Pepy Total Downloads](https://img.shields.io/pepy/dt/pytximport?label=PyPi%7Cdownloads)
1313
[![Python Version Required](https://img.shields.io/pypi/pyversions/pytximport)](https://pypi.org/project/pytximport/)
14-
[![Code Style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
14+
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
1515
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
1616

1717
`pytximport` is a Python package for efficient (gene-)count estimation from transcript quantification files produced by pseudoalignment/quasi-mapping tools such as `salmon`, `kallisto`, `rsem` and others. `pytximport` is a port of the popular [tximport Bioconductor R package](https://bioconductor.org/packages/release/bioc/html/tximport.html).
1818

1919
## Manuscript & Documentation
2020

2121
The pytximport manuscript can be accessed at: [https://doi.org/10.1093/bioinformatics/btae700](https://doi.org/10.1093/bioinformatics/btae700).
22-
Detailled documentation is made available at: [https://pytximport.readthedocs.io](https://pytximport.readthedocs.io/en/latest/start.html).
22+
Detailled documentation is made available at: [https://pytximport.complextissue.com](https://pytximport.complextissue.com/en/latest/start.html).
2323

2424
## Installation
2525

@@ -129,7 +129,7 @@ To set up `pytximport` for development on your machine, we recommend to git clon
129129
```bash
130130
git clone --depth 1 -b dev https://github.com/complextissue/pytximport.git
131131
cd pytximport
132-
pyenv local 3.9
132+
pyenv local 3.12
133133
make create-venv
134134
source .venv/source/activate
135135
make install-dev

0 commit comments

Comments
 (0)