rectanglepy 0.0.39__tar.gz → 0.0.43__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/.bumpversion.cfg +1 -1
  2. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/.github/workflows/build.yaml +2 -0
  3. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/.github/workflows/release.yaml +4 -3
  4. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/PKG-INFO +2 -2
  5. rectanglepy-0.0.43/docs/Makefile +20 -0
  6. rectanglepy-0.0.43/docs/_static/.gitkeep +0 -0
  7. rectanglepy-0.0.43/docs/_templates/.gitkeep +0 -0
  8. rectanglepy-0.0.43/docs/_templates/autosummary/class.rst +61 -0
  9. rectanglepy-0.0.43/docs/api.md +15 -0
  10. rectanglepy-0.0.43/docs/changelog.md +3 -0
  11. rectanglepy-0.0.43/docs/conf.py +140 -0
  12. rectanglepy-0.0.43/docs/contributing.md +197 -0
  13. rectanglepy-0.0.43/docs/extensions/typed_returns.py +32 -0
  14. rectanglepy-0.0.43/docs/index.md +16 -0
  15. rectanglepy-0.0.43/docs/make.bat +35 -0
  16. rectanglepy-0.0.43/docs/notebooks/example.ipynb +351 -0
  17. rectanglepy-0.0.43/docs/references.bib +17 -0
  18. rectanglepy-0.0.43/docs/references.md +5 -0
  19. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/pyproject.toml +1 -1
  20. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/src/rectanglepy/rectangle.py +1 -1
  21. rectanglepy-0.0.39/tests/run2.py +0 -800
  22. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/.cruft.json +0 -0
  23. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/.editorconfig +0 -0
  24. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  25. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  26. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  27. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  28. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/.github/workflows/test.yaml +0 -0
  29. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/.gitignore +0 -0
  30. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/.pre-commit-config.yaml +0 -0
  31. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/.readthedocs.yaml +0 -0
  32. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/CHANGELOG.md +0 -0
  33. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/LICENSE +0 -0
  34. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/README.md +0 -0
  35. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/src/rectanglepy/__init__.py +0 -0
  36. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/src/rectanglepy/data/hao1_annotations_small.csv +0 -0
  37. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/src/rectanglepy/data/hao1_counts_small.csv +0 -0
  38. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/src/rectanglepy/data/small_fino_bulks.csv +0 -0
  39. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/src/rectanglepy/pp/__init__.py +0 -0
  40. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/src/rectanglepy/pp/create_signature.py +0 -0
  41. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/src/rectanglepy/pp/rectangle_signature.py +0 -0
  42. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/src/rectanglepy/tl/__init__.py +0 -0
  43. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/src/rectanglepy/tl/deconvolution.py +0 -0
  44. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/tests/data/TIL10_signature.txt +0 -0
  45. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/tests/data/bulk_small.csv +0 -0
  46. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/tests/data/cell_annotations_small.txt +0 -0
  47. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/tests/data/quanTIseq_SimRNAseq_mixture_smaller.csv +0 -0
  48. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/tests/data/quanTIseq_SimRNAseq_read_fractions_small.txt +0 -0
  49. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/tests/data/sc_object_small.csv +0 -0
  50. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/tests/data/signature_hao1.csv +0 -0
  51. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/tests/test_pp.py +0 -0
  52. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/tests/test_rectangle.py +0 -0
  53. {rectanglepy-0.0.39 → rectanglepy-0.0.43}/tests/test_tl.py +0 -0
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 0.0.39
2
+ current_version = 0.0.43
3
3
  tag = True
4
4
  commit = True
5
5
 
@@ -59,6 +59,8 @@ jobs:
59
59
  uses: actions/setup-python@v2
60
60
  with:
61
61
  python-version: "3.10"
62
+ - name: Install twine
63
+ run: pip install twine
62
64
  - name: Install build dependencies
63
65
  run: python -m pip install --upgrade pip wheel twine build
64
66
  - name: Build package
@@ -76,10 +76,11 @@ jobs:
76
76
  - name: Install hatch
77
77
  run: pip install hatch
78
78
 
79
+ - name: Install twine
80
+ run: pip install twine
81
+
79
82
  - name: Build project for distribution
80
83
  run: hatch build
81
84
 
82
85
  - name: Publish a Python distribution to PyPI
83
- uses: pypa/gh-action-pypi-publish@release/v1
84
- with:
85
- password: ${{ secrets.PYPI_API_TOKEN }}
86
+ run: twine upload dist/* -u __token__ -p ${{ secrets.PYPI_API_TOKEN }}
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: rectanglepy
3
- Version: 0.0.39
3
+ Version: 0.0.43
4
4
  Summary: A very interesting piece of code
5
5
  Project-URL: Documentation, https://rectanglepy.readthedocs.io/
6
6
  Project-URL: Source, https://github.com/bernheder/Rectangle
@@ -0,0 +1,20 @@
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line, and also
5
+ # from the environment for the first two.
6
+ SPHINXOPTS ?=
7
+ SPHINXBUILD ?= sphinx-build
8
+ SOURCEDIR = .
9
+ BUILDDIR = _build
10
+
11
+ # Put it first so that "make" without argument is like "make help".
12
+ help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+ .PHONY: help Makefile
16
+
17
+ # Catch-all target: route all unknown targets to Sphinx using the new
18
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+ %: Makefile
20
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
File without changes
File without changes
@@ -0,0 +1,61 @@
1
+ {{ fullname | escape | underline}}
2
+
3
+ .. currentmodule:: {{ module }}
4
+
5
+ .. add toctree option to make autodoc generate the pages
6
+
7
+ .. autoclass:: {{ objname }}
8
+
9
+ {% block attributes %}
10
+ {% if attributes %}
11
+ Attributes table
12
+ ~~~~~~~~~~~~~~~~~~
13
+
14
+ .. autosummary::
15
+ {% for item in attributes %}
16
+ ~{{ fullname }}.{{ item }}
17
+ {%- endfor %}
18
+ {% endif %}
19
+ {% endblock %}
20
+
21
+ {% block methods %}
22
+ {% if methods %}
23
+ Methods table
24
+ ~~~~~~~~~~~~~
25
+
26
+ .. autosummary::
27
+ {% for item in methods %}
28
+ {%- if item != '__init__' %}
29
+ ~{{ fullname }}.{{ item }}
30
+ {%- endif -%}
31
+ {%- endfor %}
32
+ {% endif %}
33
+ {% endblock %}
34
+
35
+ {% block attributes_documentation %}
36
+ {% if attributes %}
37
+ Attributes
38
+ ~~~~~~~~~~~
39
+
40
+ {% for item in attributes %}
41
+
42
+ .. autoattribute:: {{ [objname, item] | join(".") }}
43
+ {%- endfor %}
44
+
45
+ {% endif %}
46
+ {% endblock %}
47
+
48
+ {% block methods_documentation %}
49
+ {% if methods %}
50
+ Methods
51
+ ~~~~~~~
52
+
53
+ {% for item in methods %}
54
+ {%- if item != '__init__' %}
55
+
56
+ .. automethod:: {{ [objname, item] | join(".") }}
57
+ {%- endif -%}
58
+ {%- endfor %}
59
+
60
+ {% endif %}
61
+ {% endblock %}
@@ -0,0 +1,15 @@
1
+ # API
2
+
3
+ ## Rectangle
4
+
5
+ ```{eval-rst}
6
+ .. currentmodule:: rectanglepy
7
+
8
+ .. autosummary::
9
+ :toctree: generated
10
+
11
+ rectangle
12
+ pp.build_rectangle_signatures
13
+ pp.RectangleSignatureResult
14
+ tl.deconvolution
15
+ ```
@@ -0,0 +1,3 @@
1
+ ```{include} ../CHANGELOG.md
2
+
3
+ ```
@@ -0,0 +1,140 @@
1
+ # Configuration file for the Sphinx documentation builder.
2
+ #
3
+ # This file only contains a selection of the most common options. For a full
4
+ # list see the documentation:
5
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
6
+
7
+ # -- Path setup --------------------------------------------------------------
8
+ import sys
9
+ from datetime import datetime
10
+ from importlib.metadata import metadata
11
+ from pathlib import Path
12
+
13
+ HERE = Path(__file__).parent
14
+ sys.path.insert(0, str(HERE / "extensions"))
15
+
16
+
17
+ # -- Project information -----------------------------------------------------
18
+
19
+ info = metadata("rectanglepy")
20
+ project_name = info["Name"]
21
+ author = info["Author"]
22
+ copyright = f"{datetime.now():%Y}, {author}."
23
+ version = info["Version"]
24
+ repository_url = f"https://github.com/bernheder/{project_name}"
25
+
26
+ # The full version, including alpha/beta/rc tags
27
+ release = info["Version"]
28
+
29
+ bibtex_bibfiles = ["references.bib"]
30
+ templates_path = ["_templates"]
31
+ nitpicky = True # Warn about broken links
32
+ needs_sphinx = "4.0"
33
+
34
+ html_context = {
35
+ "display_github": True, # Integrate GitHub
36
+ "github_user": "bernheder", # Username
37
+ "github_repo": project_name, # Repo name
38
+ "github_version": "main", # Version
39
+ "conf_py_path": "/docs/", # Path in the checkout to the docs root
40
+ }
41
+
42
+ # -- General configuration ---------------------------------------------------
43
+
44
+ # Add any Sphinx extension module names here, as strings.
45
+ # They can be extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
46
+ extensions = [
47
+ "myst_nb",
48
+ "sphinx_copybutton",
49
+ "sphinx.ext.autodoc",
50
+ "sphinx.ext.intersphinx",
51
+ "sphinx.ext.autosummary",
52
+ "sphinx.ext.napoleon",
53
+ "sphinxcontrib.bibtex",
54
+ "sphinx_autodoc_typehints",
55
+ "sphinx.ext.mathjax",
56
+ "IPython.sphinxext.ipython_console_highlighting",
57
+ *[p.stem for p in (HERE / "extensions").glob("*.py")],
58
+ ]
59
+
60
+ autosummary_generate = True
61
+ autodoc_member_order = "groupwise"
62
+ default_role = "literal"
63
+ napoleon_google_docstring = False
64
+ napoleon_numpy_docstring = True
65
+ napoleon_include_init_with_doc = False
66
+ napoleon_use_rtype = True # having a separate entry generally helps readability
67
+ napoleon_use_param = True
68
+ myst_heading_anchors = 6 # create anchors for h1-h6
69
+ myst_enable_extensions = [
70
+ "amsmath",
71
+ "colon_fence",
72
+ "deflist",
73
+ "dollarmath",
74
+ "html_image",
75
+ "html_admonition",
76
+ ]
77
+ myst_url_schemes = ("http", "https", "mailto")
78
+ nb_output_stderr = "remove"
79
+ nb_execution_mode = "off"
80
+ nb_merge_streams = True
81
+ typehints_defaults = "braces"
82
+
83
+ source_suffix = {
84
+ ".rst": "restructuredtext",
85
+ ".ipynb": "myst-nb",
86
+ ".myst": "myst-nb",
87
+ }
88
+
89
+ intersphinx_mapping = {
90
+ "pandas": ("https://pandas.pydata.org/docs/", None),
91
+ "python": ("https://docs.python.org/3", None),
92
+ "anndata": ("https://anndata.readthedocs.io/en/stable/", None),
93
+ "numpy": ("https://numpy.org/doc/stable/", None),
94
+ }
95
+
96
+ # List of patterns, relative to source directory, that match files and
97
+ # directories to ignore when looking for source files.
98
+ # This pattern also affects html_static_path and html_extra_path.
99
+ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "**.ipynb_checkpoints"]
100
+
101
+
102
+ # -- Options for HTML output -------------------------------------------------
103
+
104
+ # The theme to use for HTML and HTML Help pages. See the documentation for
105
+ # a list of builtin themes.
106
+ #
107
+ html_theme = "sphinx_book_theme"
108
+ html_static_path = ["_static"]
109
+ html_title = project_name
110
+
111
+ html_theme_options = {
112
+ "repository_url": repository_url,
113
+ "use_repository_button": True,
114
+ "path_to_docs": "docs/",
115
+ }
116
+
117
+ pygments_style = "emacs"
118
+
119
+ nitpick_ignore = [
120
+ # If building the documentation fails because of a missing link that is outside your control,
121
+ # you can add an exception to this list.
122
+ # ("py:class", "igraph.Graph"),
123
+ ]
124
+
125
+ print("Pygments style:", pygments_style)
126
+
127
+
128
+ def setup(app):
129
+ """App setup hook."""
130
+ app.add_config_value(
131
+ "recommonmark_config",
132
+ {
133
+ "auto_toc_tree_section": "Contents",
134
+ "enable_auto_toc_tree": True,
135
+ "enable_math": True,
136
+ "enable_inline_math": False,
137
+ "enable_eval_rst": True,
138
+ },
139
+ True,
140
+ )
@@ -0,0 +1,197 @@
1
+ # Contributing guide
2
+
3
+ Scanpy provides extensive [developer documentation][scanpy developer guide], most of which applies to this repo, too.
4
+ This document will not reproduce the entire content from there. Instead, it aims at summarizing the most important
5
+ information to get you started on contributing.
6
+
7
+ We assume that you are already familiar with git and with making pull requests on GitHub. If not, please refer
8
+ to the [scanpy developer guide][].
9
+
10
+ ## Installing dev dependencies
11
+
12
+ In addition to the packages needed to _use_ this package, you need additional python packages to _run tests_ and _build
13
+ the documentation_. It's easy to install them using `pip`:
14
+
15
+ ```bash
16
+ cd Rectangle
17
+ pip install -e ".[dev,test,doc]"
18
+ ```
19
+
20
+ ## Code-style
21
+
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.
25
+
26
+ To enable pre-commit locally, simply run
27
+
28
+ ```bash
29
+ pre-commit install
30
+ ```
31
+
32
+ in the root of the repository. Pre-commit will automatically download all dependencies when it is run for the first time.
33
+
34
+ Alternatively, you can rely on the [pre-commit.ci][] service enabled on GitHub. If you didn't run `pre-commit` before
35
+ pushing changes to GitHub it will automatically commit fixes to your pull request, or show an error message.
36
+
37
+ If pre-commit.ci added a commit on a branch you still have been working on locally, simply use
38
+
39
+ ```bash
40
+ git pull --rebase
41
+ ```
42
+
43
+ to integrate the changes into yours.
44
+ While the [pre-commit.ci][] is useful, we strongly encourage installing and running pre-commit locally first to understand its usage.
45
+
46
+ Finally, most editors have an _autoformat on save_ feature. Consider enabling this option for [black][black-editors]
47
+ and [prettier][prettier-editors].
48
+
49
+ [black-editors]: https://black.readthedocs.io/en/stable/integrations/editors.html
50
+ [prettier-editors]: https://prettier.io/docs/en/editors.html
51
+
52
+ ## Writing tests
53
+
54
+ ```{note}
55
+ Remember to first install the package with `pip install '-e[dev,test]'`
56
+ ```
57
+
58
+ This package uses the [pytest][] for automated testing. Please [write tests][scanpy-test-docs] for every function added
59
+ to the package.
60
+
61
+ Most IDEs integrate with pytest and provide a GUI to run tests. Alternatively, you can run all tests from the
62
+ command line by executing
63
+
64
+ ```bash
65
+ pytest
66
+ ```
67
+
68
+ in the root of the repository. Continuous integration will automatically run the tests on all pull requests.
69
+
70
+ [scanpy-test-docs]: https://scanpy.readthedocs.io/en/latest/dev/testing.html#writing-tests
71
+
72
+ ## Publishing a release
73
+
74
+ ### Updating the version number
75
+
76
+ Before making a release, you need to update the version number. Please adhere to [Semantic Versioning][semver], in brief
77
+
78
+ > Given a version number MAJOR.MINOR.PATCH, increment the:
79
+ >
80
+ > 1. MAJOR version when you make incompatible API changes,
81
+ > 2. MINOR version when you add functionality in a backwards compatible manner, and
82
+ > 3. PATCH version when you make backwards compatible bug fixes.
83
+ >
84
+ > Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
85
+
86
+ We use [bump2version][] to automatically update the version number in all places and automatically create a git tag.
87
+ Run one of the following commands in the root of the repository
88
+
89
+ ```bash
90
+ bump2version patch
91
+ bump2version minor
92
+ bump2version major
93
+ ```
94
+
95
+ Once you are done, run
96
+
97
+ ```
98
+ git push --tags
99
+ ```
100
+
101
+ to publish the created tag on GitHub.
102
+
103
+ [bump2version]: https://github.com/c4urself/bump2version
104
+
105
+ ### Building and publishing the package on PyPI
106
+
107
+ 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
108
+
109
+ ```bash
110
+ python -m build
111
+ ```
112
+
113
+ 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.
114
+
115
+ Before uploading them to [PyPI][] you can check that your _distribution_ is valid by running:
116
+
117
+ ```bash
118
+ twine check dist/*
119
+ ```
120
+
121
+ and finally publishing it with:
122
+
123
+ ```bash
124
+ twine upload dist/*
125
+ ```
126
+
127
+ Provide your username and password when requested and then go check out your package on [PyPI][]!
128
+
129
+ For more information, follow the [Python packaging tutorial][].
130
+
131
+ It is possible to automate this with GitHub actions, see also [this feature request][pypi-feature-request]
132
+ in the cookiecutter-scverse template.
133
+
134
+ [python packaging tutorial]: https://packaging.python.org/en/latest/tutorials/packaging-projects/#generating-distribution-archives
135
+ [pypi-feature-request]: https://github.com/scverse/cookiecutter-scverse/issues/88
136
+
137
+ ## Writing documentation
138
+
139
+ Please write documentation for new or changed features and use-cases. This project uses [sphinx][] with the following features:
140
+
141
+ - the [myst][] extension allows to write documentation in markdown/Markedly Structured Text
142
+ - [Numpy-style docstrings][numpydoc] (through the [napoloen][numpydoc-napoleon] extension).
143
+ - Jupyter notebooks as tutorials through [myst-nb][] (See [Tutorials with myst-nb](#tutorials-with-myst-nb-and-jupyter-notebooks))
144
+ - [Sphinx autodoc typehints][], to automatically reference annotated input and output types
145
+
146
+ See the [scanpy developer docs](https://scanpy.readthedocs.io/en/latest/dev/documentation.html) for more information
147
+ on how to write documentation.
148
+
149
+ ### Tutorials with myst-nb and jupyter notebooks
150
+
151
+ The documentation is set-up to render jupyter notebooks stored in the `docs/notebooks` directory using [myst-nb][].
152
+ Currently, only notebooks in `.ipynb` format are supported that will be included with both their input and output cells.
153
+ It is your reponsibility to update and re-run the notebook whenever necessary.
154
+
155
+ If you are interested in automatically running notebooks as part of the continuous integration, please check
156
+ out [this feature request](https://github.com/scverse/cookiecutter-scverse/issues/40) in the `cookiecutter-scverse`
157
+ repository.
158
+
159
+ #### Hints
160
+
161
+ - If you refer to objects from other packages, please add an entry to `intersphinx_mapping` in `docs/conf.py`. Only
162
+ if you do so can sphinx automatically create a link to the external documentation.
163
+ - If building the documentation fails because of a missing link that is outside your control, you can add an entry to
164
+ the `nitpick_ignore` list in `docs/conf.py`
165
+
166
+ #### Building the docs locally
167
+
168
+ ```bash
169
+ cd docs
170
+ make html
171
+ open _build/html/index.html
172
+ ```
173
+
174
+ <!-- Links -->
175
+
176
+ [scanpy developer guide]: https://scanpy.readthedocs.io/en/latest/dev/index.html
177
+ [cookiecutter-scverse-instance]: https://cookiecutter-scverse-instance.readthedocs.io/en/latest/template_usage.html
178
+ [github quickstart guide]: https://docs.github.com/en/get-started/quickstart/create-a-repo?tool=webui
179
+ [codecov]: https://about.codecov.io/sign-up/
180
+ [codecov docs]: https://docs.codecov.com/docs
181
+ [codecov bot]: https://docs.codecov.com/docs/team-bot
182
+ [codecov app]: https://github.com/apps/codecov
183
+ [pre-commit.ci]: https://pre-commit.ci/
184
+ [readthedocs.org]: https://readthedocs.org/
185
+ [myst-nb]: https://myst-nb.readthedocs.io/en/latest/
186
+ [jupytext]: https://jupytext.readthedocs.io/en/latest/
187
+ [pre-commit]: https://pre-commit.com/
188
+ [anndata]: https://github.com/scverse/anndata
189
+ [mudata]: https://github.com/scverse/mudata
190
+ [pytest]: https://docs.pytest.org/
191
+ [semver]: https://semver.org/
192
+ [sphinx]: https://www.sphinx-doc.org/en/master/
193
+ [myst]: https://myst-parser.readthedocs.io/en/latest/intro.html
194
+ [numpydoc-napoleon]: https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html
195
+ [numpydoc]: https://numpydoc.readthedocs.io/en/latest/format.html
196
+ [sphinx autodoc typehints]: https://github.com/tox-dev/sphinx-autodoc-typehints
197
+ [pypi]: https://pypi.org/
@@ -0,0 +1,32 @@
1
+ # code from https://github.com/theislab/scanpy/blob/master/docs/extensions/typed_returns.py
2
+ # with some minor adjustment
3
+ from __future__ import annotations
4
+
5
+ import re
6
+ from collections.abc import Generator, Iterable
7
+
8
+ from sphinx.application import Sphinx
9
+ from sphinx.ext.napoleon import NumpyDocstring
10
+
11
+
12
+ def _process_return(lines: Iterable[str]) -> Generator[str, None, None]:
13
+ for line in lines:
14
+ if m := re.fullmatch(r"(?P<param>\w+)\s+:\s+(?P<type>[\w.]+)", line):
15
+ yield f'-{m["param"]} (:class:`~{m["type"]}`)'
16
+ else:
17
+ yield line
18
+
19
+
20
+ def _parse_returns_section(self: NumpyDocstring, section: str) -> list[str]:
21
+ lines_raw = self._dedent(self._consume_to_next_section())
22
+ if lines_raw[0] == ":":
23
+ del lines_raw[0]
24
+ lines = self._format_block(":returns: ", list(_process_return(lines_raw)))
25
+ if lines and lines[-1]:
26
+ lines.append("")
27
+ return lines
28
+
29
+
30
+ def setup(app: Sphinx):
31
+ """Set app."""
32
+ NumpyDocstring._parse_returns_section = _parse_returns_section
@@ -0,0 +1,16 @@
1
+ ```{include} ../README.md
2
+
3
+ ```
4
+
5
+ ```{toctree}
6
+ :hidden: true
7
+ :maxdepth: 1
8
+
9
+ api.md
10
+ notebooks/example
11
+ changelog.md
12
+ contributing.md
13
+ references.md
14
+
15
+
16
+ ```
@@ -0,0 +1,35 @@
1
+ @ECHO OFF
2
+
3
+ pushd %~dp0
4
+
5
+ REM Command file for Sphinx documentation
6
+
7
+ if "%SPHINXBUILD%" == "" (
8
+ set SPHINXBUILD=sphinx-build
9
+ )
10
+ set SOURCEDIR=.
11
+ set BUILDDIR=_build
12
+
13
+ %SPHINXBUILD% >NUL 2>NUL
14
+ if errorlevel 9009 (
15
+ echo.
16
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17
+ echo.installed, then set the SPHINXBUILD environment variable to point
18
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
19
+ echo.may add the Sphinx directory to PATH.
20
+ echo.
21
+ echo.If you don't have Sphinx installed, grab it from
22
+ echo.https://www.sphinx-doc.org/
23
+ exit /b 1
24
+ )
25
+
26
+ if "%1" == "" goto help
27
+
28
+ %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29
+ goto end
30
+
31
+ :help
32
+ %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33
+
34
+ :end
35
+ popd