Skip to content

Commit e3d3f54

Browse files
BLD Build with uv, hatchling, updated CI/pre-commit and SPEC 0 compliant package versions (#416)
* Move to uv and newer dependencies and Python versions * Allow manually triggering the workflow * Fix version * Fix docs building * Fix ruff version * Fix mypy errors * Fix mypy errors * Fix mypy errors * Make main dependencies SPEC0 compliant * Fix numpy casting bug * Fix docstrings error * Update install instructions for contribution * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update requirements in docs * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Remove uv.lock * Fix mypy error by explicitly typing sum of booleans as int --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent fd61af3 commit e3d3f54

37 files changed

Lines changed: 332 additions & 326 deletions

.binder/postBuild

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ mv docs/build/html/jupyter_notebooks .
1414
shopt -s extglob
1515
rm -rf .[!.]*
1616
rm -rf !(jupyter_notebooks|docs)
17-
(cd docs && rm -rf !(src))
17+
(cd docs && rm -rf !(src))

.binder/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-r ../requirements.txt
1+
-r ../requirements.txt

.binder/runtime.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python-3.9
1+
python-3.9

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A clear and concise description of what the bug is.
1212
*NB:* for questions about pydeseq2 that are not related to a bug, please open a topic on the [scverse ecosystem Discourse forum](https://discourse.scverse.org/c/ecosystem/38).
1313

1414
**To Reproduce**
15-
Provide snippets of code and steps on how to reproduce the behavior.
15+
Provide snippets of code and steps on how to reproduce the behavior.
1616
Please also specify the version you are using.
1717

1818
**Expected behavior**

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ https://github.com/blog/1506-closing-issues-via-pull-requests
1414

1515

1616
#### What does your PR implement? Be specific.
17-

.github/workflows/pr_validation.yml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: pr-validation
22

33
# Controls when the workflow will run
44
on:
5+
workflow_dispatch:
56
push:
67
branches:
78
- '**'
@@ -18,31 +19,41 @@ jobs:
1819
matrix:
1920
include:
2021
- os: ubuntu-latest
21-
python: "3.10"
22+
python: "3.11"
2223
- os: ubuntu-latest
23-
python: "3.10"
24-
pip-flags: "--pre"
24+
python: "3.12"
2525
- os: ubuntu-latest
26-
python: "3.11"
26+
python: "3.13"
2727
- os: ubuntu-latest
28-
python: "3.11"
28+
python: "3.13"
2929
pip-flags: "--pre"
3030
steps:
3131
- uses: actions/checkout@v3
3232
- uses: actions/setup-python@v4
3333
with:
3434
python-version: ${{ matrix.python }}
35+
- name: Install the latest version of uv
36+
uses: astral-sh/setup-uv@v6
37+
with:
38+
version: "latest"
3539
- name: Install dependencies
3640
run: |
37-
python -m pip install --upgrade pip
38-
pip install -e ."[dev]"
39-
pip install -r docs/requirements.txt
41+
uv sync --extra doc --extra dev
42+
- name: Lint with ruff
43+
run: |
44+
uv run ruff check --fix --exit-non-zero-on-fix pydeseq2
45+
- name: Format with ruff
46+
run: |
47+
uv run ruff format --check pydeseq2
48+
- name: Type check with mypy
49+
run: |
50+
uv run mypy -p pydeseq2
4051
- name: Test with pytest
4152
run: |
42-
coverage run -m pytest
53+
uv run coverage run -m pytest
4354
- name: Generate code coverage report
4455
run: |
45-
coverage html
56+
uv run coverage html
4657
- name: Upload coverage artifacts
4758
uses: actions/upload-artifact@v4
4859
with:
@@ -51,5 +62,9 @@ jobs:
5162
retention-days: 20
5263
- name: Compile docs
5364
run: |
65+
uv pip freeze > requirements.txt
5466
cd docs
55-
make clean html
67+
uv run make clean html
68+
- name: Build package
69+
run: |
70+
uv build

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ coverage.xml
5050
*.py,cover
5151
.hypothesis/
5252
.pytest_cache/
53+
.ruff_cache/
5354

5455
# Translations
5556
*.mo
@@ -133,3 +134,12 @@ dmypy.json
133134

134135
# IDEs
135136
.vscode
137+
138+
# Docs files
139+
output_files/
140+
docs/source/auto_examples/
141+
docs/source/sg_execution_times.rst
142+
143+
# Requirement files
144+
uv.lock
145+
requirements.txt

.pre-commit-config.yaml

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
1+
fail_fast: false
2+
default_language_version:
3+
python: python3
4+
default_stages:
5+
- pre-commit
6+
- pre-push
7+
minimum_pre_commit_version: 2.16.0
18
repos:
2-
- repo: https://github.com/psf/black-pre-commit-mirror
3-
rev: 25.9.0
4-
hooks:
5-
- id: black
6-
additional_dependencies: ['click==8.0.4']
7-
args: # arguments to configure black
8-
- --line-length=89
9-
- repo: https://github.com/astral-sh/ruff-pre-commit
10-
rev: v0.14.0
11-
hooks:
12-
- id: ruff
13-
args: [ --fix, --exit-non-zero-on-fix]
9+
- repo: https://github.com/pre-commit/pre-commit-hooks
10+
rev: v6.0.0
11+
hooks:
12+
- id: detect-private-key
13+
- id: check-ast
14+
- id: end-of-file-fixer
15+
- id: mixed-line-ending
16+
args: [--fix=lf]
17+
- id: check-added-large-files
18+
stages: [pre-commit]
19+
args: ["--maxkb=50000"]
20+
- id: trailing-whitespace
21+
- id: check-case-conflict
22+
- repo: https://github.com/astral-sh/ruff-pre-commit
23+
rev: v0.14.0
24+
hooks:
25+
- id: ruff-check
26+
types_or: [python, pyi, jupyter]
27+
args: [--fix, --exit-non-zero-on-fix]
28+
- id: ruff-format
29+
types_or: [python, pyi, jupyter]
1430
- repo: https://github.com/pre-commit/mirrors-mypy
1531
rev: v1.18.2
1632
hooks:
1733
- id: mypy
18-
exclude: ^(tests/|docs/source/conf.py)
34+
pass_filenames: false
35+
args: [-p, pydeseq2, --ignore-missing-imports]

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ Code of Conduct
1111
---------------
1212

1313
`PyDeseq2` follows the code of conduct defined by
14-
the Python Software Foundation: https://www.python.org/psf/codeofconduct/.
14+
the Python Software Foundation: https://www.python.org/psf/codeofconduct/.

README.md

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
[![condaDownloads](https://img.shields.io/conda/dn/bioconda/pydeseq2?logo=Anaconda)](https://anaconda.org/bioconda/pydeseq2)
77
[![license](https://img.shields.io/pypi/l/pydeseq2)](LICENSE)
88

9-
PyDESeq2 is a python implementation of the [DESeq2](https://bioconductor.org/packages/release/bioc/html/DESeq2.html)
9+
PyDESeq2 is a python implementation of the [DESeq2](https://bioconductor.org/packages/release/bioc/html/DESeq2.html)
1010
method [1] for differential expression analysis (DEA) with bulk RNA-seq data, originally in R.
1111
It aims to facilitate DEA experiments for python users.
1212

13-
As PyDESeq2 is a re-implementation of [DESeq2](https://bioconductor.org/packages/release/bioc/html/DESeq2.html) from
13+
As PyDESeq2 is a re-implementation of [DESeq2](https://bioconductor.org/packages/release/bioc/html/DESeq2.html) from
1414
scratch, you may experience some differences in terms of retrieved values or available features.
1515

16-
Currently, available features broadly correspond to the default settings of DESeq2 (v1.34.0) for single-factor and
16+
Currently, available features broadly correspond to the default settings of DESeq2 (v1.34.0) for single-factor and
1717
multi-factor analysis (with categorical or continuous factors) using Wald tests.
1818
We plan to implement more in the future.
1919
In case there is a feature you would particularly like to be implemented, feel free to open an issue.
@@ -40,17 +40,25 @@ In case there is a feature you would particularly like to be implemented, feel f
4040

4141
`PyDESeq2` can be installed from PyPI using `pip`:
4242

43-
`pip install pydeseq2`
43+
```bash
44+
pip install pydeseq2
45+
```
4446

4547
We recommend installing within a conda environment:
4648

47-
```
49+
```bash
4850
conda create -n pydeseq2
4951
conda activate pydeseq2
5052
conda install pip
5153
pip install pydeseq2
5254
```
5355

56+
You can also add it to your projects through `uv`:
57+
58+
```bash
59+
uv add pydeseq2
60+
```
61+
5462
### Bioconda
5563

5664
`PyDESeq2` can also be installed from Bioconda with `conda`:
@@ -61,16 +69,20 @@ If you're interested in contributing or want access to the development version,
6169

6270
### Requirements
6371

64-
The list of package version requirements is available in `setup.py`.
72+
The list of package version requirements is available in `pyproject.toml`.
6573

6674
For reference, the code is being tested in a github workflow (CI) with python
67-
3.10 to 3.11 and the following package versions:
75+
3.11 to 3.13 and the latest versions of the following packages:
76+
6877
```
69-
- anndata 0.8.0
70-
- numpy 1.23.0
71-
- pandas 1.4.3
72-
- scikit-learn 1.1.1
73-
- scipy 1.11.0
78+
- anndata
79+
- formulaic
80+
- numpy
81+
- pandas
82+
- scikit-learn
83+
- scipy
84+
- formulaic-contrasts
85+
- matplotlib
7486
```
7587

7688
Please don't hesitate to open an issue in case you encounter any issue due to possible deprecations.
@@ -84,7 +96,7 @@ contains downloadable examples on how to use PyDESeq2.
8496

8597
### Documentation
8698

87-
The documentation is hosted [here on ReadTheDocs](https://pydeseq2.readthedocs.io/en/latest/).
99+
The documentation is hosted [here on ReadTheDocs](https://pydeseq2.readthedocs.io/en/latest/).
88100
If you want to have the latest version of the documentation, you can build it from source.
89101
Please go to the dedicated [README.md](https://github.com/owkin/PyDESeq2/blob/main/docs/README.md) for information on how to do so.
90102

@@ -105,12 +117,12 @@ documentation to see how you can contribute to PyDESeq2.
105117

106118
`git clone https://github.com/owkin/PyDESeq2.git`
107119

108-
### 2 - Create a conda environment
120+
### 2 - Create a uv environment
109121

110-
Run `conda create -n pydeseq2 python=3.10` (or higher python version) to create the `pydeseq2` environment and then activate it:
111-
`conda activate pydeseq2`.
122+
Run `uv venv --python 3.13` (or higher python version) to create the `pydeseq2` environment and then activate it:
123+
`source .venv/bin/activate`.
112124

113-
`cd` to the root of the repo and run `pip install -e ."[dev]"` to install in developer mode.
125+
`cd` to the root of the repo and run `uv sync --extra dev --extra doc` to install in developer mode.
114126

115127
Then, run `pre-commit install`.
116128

@@ -145,4 +157,3 @@ PyDESeq2 is a living project and any contributions are welcome! Feel free to ope
145157
## License
146158

147159
PyDESeq2 is released under an [MIT license](https://github.com/owkin/PyDESeq2/blob/main/LICENSE).
148-

0 commit comments

Comments
 (0)