Skip to content
This repository was archived by the owner on May 27, 2024. It is now read-only.

Commit 13a8f0e

Browse files
authored
Merge pull request #34 from scverse-bot/template-update-scverse-multi-condition-comparisions-v0.3.1
Update template to v0.3.1
2 parents ea89d04 + d597400 commit 13a8f0e

15 files changed

+126
-521
lines changed

.cruft.json

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"template": "https://github.com/scverse/cookiecutter-scverse",
3-
"commit": "30bbbdbd429bcd10099f7a6d9f3583e20b378b95",
4-
"checkout": null,
3+
"commit": "586b1652162ff7994b0070a034023d64289ae416",
4+
"checkout": "v0.3.1",
55
"context": {
66
"cookiecutter": {
77
"project_name": "multi-condition-comparisions",
@@ -13,9 +13,15 @@
1313
"project_repo": "https://github.com/scverse/multi-condition-comparisons",
1414
"license": "BSD 3-Clause License",
1515
"_copy_without_render": [
16-
".github/workflows/**.yaml",
16+
".github/workflows/build.yaml",
17+
".github/workflows/test.yaml",
1718
"docs/_templates/autosummary/**.rst"
1819
],
20+
"_render_devdocs": false,
21+
"_jinja2_env_vars": {
22+
"lstrip_blocks": true,
23+
"trim_blocks": true
24+
},
1925
"_template": "https://github.com/scverse/cookiecutter-scverse"
2026
}
2127
},

.github/workflows/release.yaml

+19-20
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
name: Release
22

33
on:
4-
push:
5-
tags:
6-
- "*.*.*"
4+
release:
5+
types: [published]
76

7+
# Use "trusted publishing", see https://docs.pypi.org/trusted-publishers/
88
jobs:
99
release:
10-
name: Release
10+
name: Upload release to PyPI
1111
runs-on: ubuntu-latest
12+
environment:
13+
name: pypi
14+
url: https://pypi.org/p/multi_condition_comparisions
15+
permissions:
16+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
1217
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v3
15-
16-
- name: Set up Python 3.10
17-
uses: actions/setup-python@v4
18+
- uses: actions/checkout@v4
1819
with:
19-
python-version: "3.10"
20-
21-
- name: Install hatch
22-
run: pip install hatch
23-
24-
- name: Build project for distribution
25-
run: hatch build
26-
27-
- name: Publish a Python distribution to PyPI
28-
uses: pypa/gh-action-pypi-publish@release/v1
20+
filter: blob:none
21+
fetch-depth: 0
22+
- uses: actions/setup-python@v4
2923
with:
30-
password: ${{ secrets.PYPI_API_TOKEN }}
24+
python-version: "3.x"
25+
cache: "pip"
26+
- run: pip install build
27+
- run: python -m build
28+
- name: Publish package distributions to PyPI
29+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yaml

+12-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
branches: [main]
66
pull_request:
77
branches: [main]
8+
schedule:
9+
- cron: "0 5 1,15 * *"
810

911
concurrency:
1012
group: ${{ github.workflow }}-${{ github.ref }}
@@ -24,8 +26,13 @@ jobs:
2426
- os: ubuntu-latest
2527
python: "3.10"
2628
- os: ubuntu-latest
27-
python: "3.10"
29+
python: "3.11"
30+
- os: ubuntu-latest
31+
python: "3.11"
2832
pip-flags: "--pre"
33+
name: PRE-RELEASE DEPENDENCIES
34+
35+
name: ${{ matrix.name }} Python ${{ matrix.python }}
2936

3037
env:
3138
OS: ${{ matrix.os }}
@@ -60,6 +67,9 @@ jobs:
6067
PLATFORM: ${{ matrix.os }}
6168
DISPLAY: :42
6269
run: |
63-
pytest -v --cov --color=yes
70+
coverage run -m pytest -v --color=yes
71+
- name: Report coverage
72+
run: |
73+
coverage report
6474
- name: Upload coverage
6575
uses: codecov/codecov-action@v3

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ __pycache__/
2626
# IDEs
2727
/.idea/
2828
/.vscode/
29+
*.code-workspace
2930

3031
/node_modules

.pre-commit-config.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ repos:
1515
hooks:
1616
- id: ruff
1717
args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes]
18+
types_or: [python, pyi, jupyter]
1819
- id: ruff-format
20+
types_or: [python, pyi, jupyter]
1921
- repo: https://github.com/pre-commit/pre-commit-hooks
2022
rev: v4.5.0
2123
hooks:
@@ -26,6 +28,8 @@ repos:
2628
args: [--fix=lf]
2729
- id: trailing-whitespace
2830
- id: check-case-conflict
31+
- id: check-merge-conflict
32+
args: [--assume-in-merge]
2933
- repo: https://github.com/pre-commit/mirrors-mypy
3034
rev: v1.8.0
3135
hooks:

docs/_static/css/custom.css

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* Reduce the font size in data frames - See https://github.com/scverse/cookiecutter-scverse/issues/193 */
2+
div.cell_output table.dataframe {
3+
font-size: 0.8em;
4+
}

docs/conf.py

+6-14
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@
107107
#
108108
html_theme = "sphinx_book_theme"
109109
html_static_path = ["_static"]
110+
html_css_files = ["css/custom.css"]
111+
110112
html_title = project_name
111113

112114
html_theme_options = {
@@ -118,17 +120,7 @@
118120

119121
pygments_style = "default"
120122

121-
122-
def setup(app):
123-
"""App setup hook."""
124-
app.add_config_value(
125-
"recommonmark_config",
126-
{
127-
"auto_toc_tree_section": "Contents",
128-
"enable_auto_toc_tree": True,
129-
"enable_math": True,
130-
"enable_inline_math": False,
131-
"enable_eval_rst": True,
132-
},
133-
True,
134-
)
123+
nitpick_ignore: list[tuple[str, str]] = [
124+
# you can add an exception to this list.
125+
# ("py:class", "igraph.Graph"),
126+
]

docs/contributing.md

+19-56
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing guide
22

3-
Scanpy provides extensive [developer documentation][scanpy developer guide], most of which applies to this repo, too.
3+
Scanpy provides extensive [developer documentation][scanpy developer guide], most of which applies to this project, too.
44
This document will not reproduce the entire content from there. Instead, it aims at summarizing the most important
55
information to get you started on contributing.
66

@@ -19,9 +19,8 @@ pip install -e ".[dev,test,doc]"
1919

2020
## Code-style
2121

22-
This template uses [pre-commit][] to enforce consistent code-styles. On every commit, pre-commit checks will either
23-
automatically fix issues with the code, or raise an error message. See [pre-commit checks](template_usage.md#pre-commit-checks) for
24-
a full list of checks enabled for this repository.
22+
This package uses [pre-commit][] to enforce consistent code-styles.
23+
On every commit, pre-commit checks will either automatically fix issues with the code, or raise an error message.
2524

2625
To enable pre-commit locally, simply run
2726

@@ -43,10 +42,10 @@ git pull --rebase
4342
to integrate the changes into yours.
4443
While the [pre-commit.ci][] is useful, we strongly encourage installing and running pre-commit locally first to understand its usage.
4544

46-
Finally, most editors have an _autoformat on save_ feature. Consider enabling this option for [black][black-editors]
45+
Finally, most editors have an _autoformat on save_ feature. Consider enabling this option for [ruff][ruff-editors]
4746
and [prettier][prettier-editors].
4847

49-
[black-editors]: https://black.readthedocs.io/en/stable/integrations/editors.html
48+
[ruff-editors]: https://docs.astral.sh/ruff/integrations/
5049
[prettier-editors]: https://prettier.io/docs/en/editors.html
5150

5251
## Writing tests
@@ -65,7 +64,17 @@ command line by executing
6564
pytest
6665
```
6766

68-
in the root of the repository. Continuous integration will automatically run the tests on all pull requests.
67+
in the root of the repository.
68+
69+
### Continuous integration
70+
71+
Continuous integration will automatically run the tests on all pull requests and test
72+
against the minimum and maximum supported Python version.
73+
74+
Additionally, there's a CI job that tests against pre-releases of all dependencies
75+
(if there are any). The purpose of this check is to detect incompatibilities
76+
of new package versions early on and gives you time to fix the issue or reach
77+
out to the developers of the dependency before the package is released to a wider audience.
6978

7079
[scanpy-test-docs]: https://scanpy.readthedocs.io/en/latest/dev/testing.html#writing-tests
7180

@@ -83,55 +92,8 @@ Before making a release, you need to update the version number in the `pyproject
8392
>
8493
> Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
8594
86-
Once you are done, run
87-
88-
```
89-
git push --tags
90-
```
91-
92-
to publish the created tag on GitHub. Alternatively, it is possible to create a tag through the Github web interface. For more information, see [managing Github releases][]. This will automatically trigger a Github workflow that creates a release on PyPI.
93-
94-
### The release Github workflow
95-
96-
#### Behind the scenes
97-
98-
This section explains how releases can be created manually purely for educational purposes. Experienced developers may skip this section.
99-
Python packages are not distributed as source code, but as _distributions_. The most common distribution format is the so-called _wheel_. To build a _wheel_, run
100-
101-
```bash
102-
python -m build
103-
```
104-
105-
This command creates a _source archive_ and a _wheel_, which are required for publishing your package to [PyPI][]. These files are created directly in the root of the repository.
106-
107-
Before uploading them to [PyPI][] you can check that your _distribution_ is valid by running:
108-
109-
```bash
110-
twine check dist/*
111-
```
112-
113-
and finally publishing it with:
114-
115-
```bash
116-
twine upload dist/*
117-
```
118-
119-
Provide your username and password when requested and then go check out your package on [PyPI][]!
120-
121-
For more information, follow the [Python packaging tutorial][].
122-
123-
#### Configuring the Github workflow
124-
125-
Tags adhering to `"*.*.*"` that are pushed to the `main` branch will trigger the release Github workflow that automatically builds and uploads the Python package to [PyPI][].
126-
For this to work, the `PYPI_API_TOKEN` Github secret needs to be set to the value of the [PyPI][] token.
127-
See [Creating PyPI tokens][] for instructions on how to create a [PyPI][] token.
128-
Finally, set your `PYPI_API_TOKEN` Github secret equal to the value of the just created [PyPI][] token by following [creating Github secrets][].
129-
130-
[creating github secrets]: https://docs.github.com/en/actions/security-guides/encrypted-secrets
131-
[creating pypi tokens]: https://pypi.org/help/#apitoken
132-
[managing github releases]: https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
133-
[python packaging tutorial]: https://packaging.python.org/en/latest/tutorials/packaging-projects/#generating-distribution-archives
134-
[pypi-feature-request]: https://github.com/scverse/cookiecutter-scverse/issues/88
95+
Once you are done, commit and push your changes and navigate to the "Releases" page of this project on GitHub.
96+
Specify `vX.X.X` as a tag name and create a release. For more information, see [managing GitHub releases][]. This will automatically create a git tag and trigger a Github workflow that creates a release on PyPI.
13597

13698
## Writing documentation
13799

@@ -195,3 +157,4 @@ open _build/html/index.html
195157
[numpydoc]: https://numpydoc.readthedocs.io/en/latest/format.html
196158
[sphinx autodoc typehints]: https://github.com/tox-dev/sphinx-autodoc-typehints
197159
[pypi]: https://pypi.org/
160+
[managing GitHub releases]: https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository

docs/index.md

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
99
api.md
1010
changelog.md
11-
template_usage.md
1211
contributing.md
1312
references.md
1413

docs/notebooks/breast_cancer.ipynb

+23-17
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"%autoreload 2\n",
2828
"from multi_condition_comparisions.tl.de import StatsmodelsDE\n",
2929
"\n",
30-
"import scanpy as sc\n",
31-
"import decoupler as dc"
30+
"import decoupler as dc\n",
31+
"import scanpy as sc"
3232
]
3333
},
3434
{
@@ -44,11 +44,11 @@
4444
"metadata": {},
4545
"outputs": [],
4646
"source": [
47-
"#import cellxgene_census\n",
48-
"#cellxgene_census.download_source_h5ad('cd74e95e-6583-4875-a0ba-f2eae5a1e5a6.h5ad',\n",
49-
" #to_path=\"breast_cancer.h5ad\")\n",
47+
"import cellxgene_census\n",
5048
"\n",
51-
"#adata = sc.read_h5ad('./cd74e95e-6583-4875-a0ba-f2eae5a1e5a6.h5ad')"
49+
"cellxgene_census.download_source_h5ad(\"cd74e95e-6583-4875-a0ba-f2eae5a1e5a6.h5ad\", to_path=\"breast_cancer.h5ad\")\n",
50+
"\n",
51+
"adata = sc.read_h5ad(\"./cd74e95e-6583-4875-a0ba-f2eae5a1e5a6.h5ad\")"
5252
]
5353
},
5454
{
@@ -57,8 +57,8 @@
5757
"metadata": {},
5858
"outputs": [],
5959
"source": [
60-
"adata.layers['counts'] = adata.raw.X\n",
61-
"adata.layers['normalised_counts'] = adata.X\n"
60+
"adata.layers[\"counts\"] = adata.raw.X\n",
61+
"adata.layers[\"normalised_counts\"] = adata.X"
6262
]
6363
},
6464
{
@@ -116,13 +116,14 @@
116116
}
117117
],
118118
"source": [
119-
"pbulk = dc.get_pseudobulk(adata,\n",
120-
" sample_col='donor_id',\n",
121-
" groups_col='cell_type',\n",
122-
" layer='normalised_counts',\n",
123-
" mode='sum',\n",
124-
" min_cells=10,\n",
125-
" min_counts=1000,\n",
119+
"pbulk = dc.get_pseudobulk(\n",
120+
" adata,\n",
121+
" sample_col=\"donor_id\",\n",
122+
" groups_col=\"cell_type\",\n",
123+
" layer=\"normalised_counts\",\n",
124+
" mode=\"sum\",\n",
125+
" min_cells=10,\n",
126+
" min_counts=1000,\n",
126127
")\n",
127128
"\n",
128129
"pbulk"
@@ -713,8 +714,13 @@
713714
}
714715
],
715716
"source": [
716-
"mod.test_contrasts({\"T cells\": mod.cond(disease=\"breast cancer\", cell_type=\"T cell\") - mod.cond(disease=\"normal\", cell_type=\"T cell\")},\n",
717-
" {\"fibroblasts\": mod.cond(disease=\"breast cancer\", cell_type=\"fibroblast\") - mod.cond(disease=\"normal\", cell_type=\"fibroblast\")})"
717+
"mod.test_contrasts(\n",
718+
" {\"T cells\": mod.cond(disease=\"breast cancer\", cell_type=\"T cell\") - mod.cond(disease=\"normal\", cell_type=\"T cell\")},\n",
719+
" {\n",
720+
" \"fibroblasts\": mod.cond(disease=\"breast cancer\", cell_type=\"fibroblast\")\n",
721+
" - mod.cond(disease=\"normal\", cell_type=\"fibroblast\")\n",
722+
" },\n",
723+
")"
718724
]
719725
}
720726
],

0 commit comments

Comments
 (0)