Skip to content

Commit 16232ec

Browse files
V 0.1.6 (#31)
* update version * Make tutorial notebooks external and update with latest cookiecutter changes (#28) * Make tutorial notebooks external * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update .readthedocs.yaml with the latest version on scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter * Realign pyproject.toml with scverse cookiecutter --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 84aaf5c commit 16232ec

16 files changed

+266
-3265
lines changed

.github/workflows/build.yaml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,24 @@ concurrency:
1010
group: ${{ github.workflow }}-${{ github.ref }}
1111
cancel-in-progress: true
1212

13+
defaults:
14+
run:
15+
# to fail on error in multiline statements (-e), in pipes (-o pipefail), and on unset variables (-u).
16+
shell: bash -euo pipefail {0}
17+
1318
jobs:
1419
package:
1520
runs-on: ubuntu-latest
1621
steps:
17-
- uses: actions/checkout@v3
18-
- name: Set up Python 3.10
19-
uses: actions/setup-python@v4
22+
- uses: actions/checkout@v4
23+
with:
24+
filter: blob:none
25+
fetch-depth: 0
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v5
2028
with:
21-
python-version: "3.10"
22-
cache: "pip"
23-
cache-dependency-path: "**/pyproject.toml"
24-
- name: Install build dependencies
25-
run: python -m pip install --upgrade pip wheel twine build
29+
cache-dependency-glob: pyproject.toml
2630
- name: Build package
27-
run: python -m build
31+
run: uv build
2832
- name: Check package
29-
run: twine check --strict dist/*.whl
33+
run: uvx twine check --strict dist/*.whl

.github/workflows/release.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ on:
44
release:
55
types: [published]
66

7+
defaults:
8+
run:
9+
# to fail on error in multiline statements (-e), in pipes (-o pipefail), and on unset variables (-u).
10+
shell: bash -euo pipefail {0}
11+
712
# Use "trusted publishing", see https://docs.pypi.org/trusted-publishers/
813
jobs:
914
release:
@@ -19,11 +24,11 @@ jobs:
1924
with:
2025
filter: blob:none
2126
fetch-depth: 0
22-
- uses: actions/setup-python@v4
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v5
2329
with:
24-
python-version: "3.x"
25-
cache: "pip"
26-
- run: pip install build
27-
- run: python -m build
30+
cache-dependency-glob: pyproject.toml
31+
- name: Build package
32+
run: uv build
2833
- name: Publish package distributions to PyPI
2934
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yaml

Lines changed: 70 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,56 +12,88 @@ concurrency:
1212
group: ${{ github.workflow }}-${{ github.ref }}
1313
cancel-in-progress: true
1414

15+
defaults:
16+
run:
17+
# to fail on error in multiline statements (-e), in pipes (-o pipefail), and on unset variables (-u).
18+
shell: bash -euo pipefail {0}
19+
1520
jobs:
21+
# Get the test environment from hatch as defined in pyproject.toml.
22+
# This ensures that the pyproject.toml is the single point of truth for test definitions and the same tests are
23+
# run locally and on continuous integration.
24+
# Check [[tool.hatch.envs.hatch-test.matrix]] in pyproject.toml and https://hatch.pypa.io/latest/environment/ for
25+
# more details.
26+
get-environments:
27+
runs-on: ubuntu-latest
28+
outputs:
29+
envs: ${{ steps.get-envs.outputs.envs }}
30+
steps:
31+
- uses: actions/checkout@v4
32+
with:
33+
filter: blob:none
34+
fetch-depth: 0
35+
- name: Install uv
36+
uses: astral-sh/setup-uv@v5
37+
- name: Get test environments
38+
id: get-envs
39+
run: |
40+
ENVS_JSON=$(uvx hatch env show --json | jq -c 'to_entries
41+
| map(
42+
select(.key | startswith("hatch-test"))
43+
| {
44+
name: .key,
45+
label: (if (.key | contains("pre")) then .key + " (PRE-RELEASE DEPENDENCIES)" else .key end),
46+
python: .value.python
47+
}
48+
)')
49+
echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT
50+
51+
# Run tests through hatch. Spawns a separate runner for each environment defined in the hatch matrix obtained above.
1652
test:
17-
runs-on: ${{ matrix.os }}
18-
defaults:
19-
run:
20-
shell: bash -e {0} # -e to fail on error
53+
needs: get-environments
2154

2255
strategy:
2356
fail-fast: false
2457
matrix:
25-
include:
26-
- os: ubuntu-latest
27-
python: "3.10"
28-
- os: ubuntu-latest
29-
python: "3.12"
30-
- os: ubuntu-latest
31-
python: "3.12"
32-
pip-flags: "--pre"
33-
name: PRE-RELEASE DEPENDENCIES
34-
35-
name: ${{ matrix.name }} Python ${{ matrix.python }}
58+
os: [ubuntu-latest]
59+
env: ${{ fromJSON(needs.get-environments.outputs.envs) }}
3660

37-
env:
38-
OS: ${{ matrix.os }}
39-
PYTHON: ${{ matrix.python }}
61+
name: ${{ matrix.env.label }}
62+
runs-on: ${{ matrix.os }}
4063

4164
steps:
42-
- uses: actions/checkout@v3
43-
- name: Set up Python ${{ matrix.python }}
44-
uses: actions/setup-python@v4
65+
- uses: actions/checkout@v4
4566
with:
46-
python-version: ${{ matrix.python }}
47-
cache: "pip"
48-
cache-dependency-path: "**/pyproject.toml"
49-
50-
- name: Install test dependencies
51-
run: |
52-
python -m pip install --upgrade pip wheel
53-
- name: Install dependencies
54-
run: |
55-
pip install ${{ matrix.pip-flags }} ".[dev,test]"
56-
- name: Test
67+
filter: blob:none
68+
fetch-depth: 0
69+
- name: Install uv
70+
uses: astral-sh/setup-uv@v5
71+
with:
72+
python-version: ${{ matrix.env.python }}
73+
cache-dependency-glob: pyproject.toml
74+
- name: create hatch environment
75+
run: uvx hatch env create ${{ matrix.env.name }}
76+
- name: run tests using hatch
5777
env:
5878
MPLBACKEND: agg
5979
PLATFORM: ${{ matrix.os }}
6080
DISPLAY: :42
61-
run: |
62-
coverage run -m pytest -v --color=yes
63-
- name: Report coverage
64-
run: |
65-
coverage report
81+
run: uvx hatch run ${{ matrix.env.name }}:run-cov
82+
- name: generate coverage report
83+
run: uvx hatch run ${{ matrix.env.name }}:coverage xml
6684
- name: Upload coverage
67-
uses: codecov/codecov-action@v3
85+
uses: codecov/codecov-action@v4
86+
87+
# Check that all tests defined above pass. This makes it easy to set a single "required" test in branch
88+
# protection instead of having to update it frequently. See https://github.com/re-actors/alls-green#why.
89+
check:
90+
name: Tests pass in all hatch environments
91+
if: always()
92+
needs:
93+
- get-environments
94+
- test
95+
runs-on: ubuntu-latest
96+
steps:
97+
- uses: re-actors/alls-green@release/v1
98+
with:
99+
jobs: ${{ toJSON(needs) }}

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "docs/tutorials/external"]
2+
path = docs/tutorials/external
3+
url = https://github.com/theislab/DRVI_tutorials.git

.readthedocs.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
# https://docs.readthedocs.io/en/stable/config-file/v2.html
22
version: 2
33
build:
4-
os: ubuntu-20.04
4+
os: ubuntu-24.04
55
tools:
66
python: "3.10"
7-
sphinx:
8-
configuration: docs/conf.py
9-
# disable this for more lenient docs builds
10-
fail_on_warning: false
11-
python:
12-
install:
13-
- method: pip
14-
path: .
15-
extra_requirements:
16-
- doc
7+
jobs:
8+
create_environment:
9+
- asdf plugin add uv
10+
- asdf install uv latest
11+
- asdf global uv latest
12+
build:
13+
html:
14+
- uvx hatch run docs:build
15+
- mv docs/_build $READTHEDOCS_OUTPUT
16+
17+
submodules:
18+
include: all

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Unsupervised Deep Disentangled Representation of Single-Cell Omics
2626
Please refer to the [documentation][link-docs]. In particular, the
2727

2828
- [Tutorials][link-tutorials], specially
29-
- [A demo](https://drvi.readthedocs.io/latest/notebooks/general_pipeline.html) of how to train DRVI and interpret the latent dimensions.
29+
- [A demo](https://drvi.readthedocs.io/latest/tutorials/external/general_pipeline.html) of how to train DRVI and interpret the latent dimensions.
3030
- [API documentation][link-api], specially
3131
- [DRVI Model](https://drvi.readthedocs.io/latest/api/generated/drvi.model.DRVI.html)
3232
- [DRVI utility functions (tools)](https://drvi.readthedocs.io/latest/api/tools.html)
@@ -95,6 +95,6 @@ Code, notebooks, and instructions to reproduce the results from the paper are av
9595
[issue-tracker]: https://github.com/theislab/drvi/issues
9696
[changelog]: https://drvi.readthedocs.io/latest/changelog.html
9797
[link-docs]: https://drvi.readthedocs.io
98-
[link-api]: https://drvi.readthedocs.io/latest/api/index.html
98+
[link-api]: https://drvi.readthedocs.io
9999
[link-tutorials]: https://drvi.readthedocs.io/latest/tutorials.html
100100
[link-pypi]: https://pypi.org/project/drvi-py

docs/api/index.md

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

docs/api/metrics.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Metrics
22

3+
We have implemented a user-friendly class for evaluation of disentanglement with respect to known discrete targets.
4+
5+
```{eval-rst}
6+
.. module:: drvi.utils.metrics
7+
.. currentmodule:: drvi.utils
8+
9+
.. autosummary::
10+
:nosignatures:
11+
:toctree: generated
12+
13+
metrics.DiscreteDisentanglementBenchmark
14+
```
15+
16+
The following functions represent the similarity functions used in benchmarking:
17+
318
```{eval-rst}
419
.. module:: drvi.utils.metrics
520
.. currentmodule:: drvi.utils
@@ -10,8 +25,19 @@
1025
1126
metrics.nn_alignment_score
1227
metrics.local_mutual_info_score
13-
metrics.global_dim_mutual_info_score
1428
metrics.spearman_correlataion_score
29+
```
30+
31+
The following functions represent the aggregation functions used in benchmarking:
32+
33+
```{eval-rst}
34+
.. module:: drvi.utils.metrics
35+
.. currentmodule:: drvi.utils
36+
37+
.. autosummary::
38+
:nosignatures:
39+
:toctree: generated
40+
1541
metrics.most_similar_averaging_score
1642
metrics.latent_matching_score
1743
metrics.most_similar_gap_score

docs/conf.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"sphinx.ext.napoleon",
5656
"sphinxcontrib.bibtex",
5757
"sphinx_autodoc_typehints",
58+
"sphinx_tabs.tabs",
5859
"sphinx.ext.mathjax",
5960
"IPython.sphinxext.ipython_console_highlighting",
6061
"sphinxext.opengraph",
@@ -91,9 +92,20 @@
9192
}
9293

9394
intersphinx_mapping = {
95+
# General
9496
"python": ("https://docs.python.org/3", None),
95-
"anndata": ("https://anndata.readthedocs.io/en/stable/", None),
97+
"matplotlib": ("https://matplotlib.org/stable/", None),
98+
# Numerical
9699
"numpy": ("https://numpy.org/doc/stable/", None),
100+
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
101+
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
102+
# Deep learning
103+
"torch": ("https://docs.pytorch.org/docs/main", None),
104+
"lightning": ("https://lightning.ai/docs/pytorch/stable/", None),
105+
# Special
106+
"anndata": ("https://anndata.readthedocs.io/en/stable/", None),
107+
"mudata": ("https://mudata.readthedocs.io/en/stable/", None),
108+
"scvi-tools": ("https://docs.scvi-tools.org/en/stable/", None),
97109
}
98110

99111
# List of patterns, relative to source directory, that match files and

docs/index.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,30 @@
33
```
44

55
```{toctree}
6+
:caption: 'API'
7+
:hidden: true
8+
:maxdepth: 1
9+
10+
api/model
11+
api/tools
12+
api/plotting
13+
api/metrics
14+
```
15+
16+
```{toctree}
17+
:caption: 'General'
618
:hidden: true
719
:maxdepth: 1
820
9-
api/index.md
1021
changelog.md
1122
contributing.md
1223
references.md
13-
tutorials.md
24+
```
25+
26+
```{toctree}
27+
:caption: 'Usage'
28+
:hidden: true
29+
:maxdepth: 1
30+
31+
tutorials/index.md
1432
```

0 commit comments

Comments
 (0)