Skip to content

Commit

Permalink
Automated template update from cookiecutter-scverse
Browse files Browse the repository at this point in the history
  • Loading branch information
grst authored Mar 14, 2023
1 parent df66a72 commit 41efa14
Show file tree
Hide file tree
Showing 10 changed files with 326 additions and 90 deletions.
42 changes: 21 additions & 21 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"template": "/~https://github.com/scverse/cookiecutter-scverse",
"commit": "7cc5403b05e299d7a4bb169c2bd8c27a2a7676f3",
"context": {
"cookiecutter": {
"project_name": "infercnvpy",
"package_name": "infercnvpy",
"project_description": "Infer copy number variation (CNV) from scRNA-seq data. Plays nicely with Scanpy. ",
"author_full_name": "Gregor Sturm",
"author_email": "mail@gregor-sturm.de",
"github_user": "grst",
"project_repo": "/~https://github.com/icbi-lab/infercnvpy",
"license": "BSD 3-Clause License",
"_copy_without_render": [
".github/workflows/**.yaml",
"docs/_templates/autosummary/**.rst"
],
"_template": "/~https://github.com/scverse/cookiecutter-scverse"
}
},
"directory": null,
"checkout": "v0.1.3"
"template": "/~https://github.com/scverse/cookiecutter-scverse",
"commit": "57f6267716826dad73baba46dc3c00fe7262c459",
"context": {
"cookiecutter": {
"project_name": "infercnvpy",
"package_name": "infercnvpy",
"project_description": "Infer copy number variation (CNV) from scRNA-seq data. Plays nicely with Scanpy. ",
"author_full_name": "Gregor Sturm",
"author_email": "mail@gregor-sturm.de",
"github_user": "grst",
"project_repo": "/~https://github.com/icbi-lab/infercnvpy",
"license": "BSD 3-Clause License",
"_copy_without_render": [
".github/workflows/**.yaml",
"docs/_templates/autosummary/**.rst"
],
"_template": "/~https://github.com/scverse/cookiecutter-scverse"
}
},
"directory": null,
"checkout": "v0.2.0"
}
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ body:
**Note**: Please read [this guide](https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports)
detailing how to provide the necessary information for us to reproduce your bug. In brief:
* Please provide exact steps how to reproduce the bug in a clean Python environment.
* In case it's not clear what's causing this bug, please provide the data or the data generation procecure.
* Sometimes it is not possible to share the data but usually it is possible to replicate problems on publicly
* In case it's not clear what's causing this bug, please provide the data or the data generation procedure.
* Sometimes it is not possible to share the data, but usually it is possible to replicate problems on publicly
available datasets or to share a subset of your data.
- type: textarea
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Temp files
.DS_Store
*~
buck-out/

# Compiled files
.venv/
__pycache__/
.mypy_cache/
.ruff_cache/

# Distribution / packaging
/build/
Expand Down
81 changes: 81 additions & 0 deletions .pre-commit-config.yaml.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
diff a/.pre-commit-config.yaml b/.pre-commit-config.yaml (rejected hunks)
@@ -7,32 +7,28 @@ default_stages:
minimum_pre_commit_version: 2.16.0
repos:
- repo: /~https://github.com/psf/black
- rev: 23.1.0
+ rev: "23.1.0"
hooks:
- id: black
- - repo: /~https://github.com/pre-commit/mirrors-prettier
- rev: v3.0.0-alpha.6
- hooks:
- - id: prettier
- repo: /~https://github.com/asottile/blacken-docs
rev: 1.13.0
hooks:
- id: blacken-docs
- - repo: /~https://github.com/PyCQA/isort
- rev: 5.12.0
- hooks:
- - id: isort
- - repo: /~https://github.com/asottile/yesqa
- rev: v1.4.0
+ - repo: /~https://github.com/pre-commit/mirrors-prettier
+ rev: v3.0.0-alpha.6
hooks:
- - id: yesqa
- additional_dependencies:
- - flake8-tidy-imports
- - flake8-docstrings
- - flake8-rst-docstrings
- - flake8-comprehensions
- - flake8-bugbear
- - flake8-blind-except
+ - id: prettier
+ # Newer versions of node don't work on systems that have an older version of GLIBC
+ # (in particular Ubuntu 18.04 and Centos 7)
+ # EOL of Centos 7 is in 2024-06, we can probably get rid of this then.
+ # See /~https://github.com/scverse/cookiecutter-scverse/issues/143 and
+ # /~https://github.com/jupyterlab/jupyterlab/issues/12675
+ language_version: "17.9.1"
+ - repo: /~https://github.com/charliermarsh/ruff-pre-commit
+ rev: v0.0.255
+ hooks:
+ - id: ruff
+ args: [--fix, --exit-non-zero-on-fix]
- repo: /~https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
@@ -43,31 +39,6 @@ repos:
args: [--fix=lf]
- id: trailing-whitespace
- id: check-case-conflict
- - repo: /~https://github.com/myint/autoflake
- rev: v2.0.2
- hooks:
- - id: autoflake
- args:
- - --in-place
- - --remove-all-unused-imports
- - --remove-unused-variable
- - --ignore-init-module-imports
- - repo: /~https://github.com/PyCQA/flake8
- rev: 6.0.0
- hooks:
- - id: flake8
- additional_dependencies:
- - flake8-tidy-imports
- - flake8-docstrings
- - flake8-rst-docstrings
- - flake8-comprehensions
- - flake8-bugbear
- - flake8-blind-except
- - repo: /~https://github.com/asottile/pyupgrade
- rev: v3.3.1
- hooks:
- - id: pyupgrade
- args: [--py3-plus, --py38-plus, --keep-runtime-typing]
- repo: local
hooks:
- id: forbid-to-commit
6 changes: 0 additions & 6 deletions docs/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ Attributes

{% for item in attributes %}

{{ item }}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoattribute:: {{ [objname, item] | join(".") }}
{%- endfor %}

Expand All @@ -56,9 +53,6 @@ Methods
{% for item in methods %}
{%- if item != '__init__' %}

{{ item }}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automethod:: {{ [objname, item] | join(".") }}
{%- endif -%}
{%- endfor %}
Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
napoleon_include_init_with_doc = False
napoleon_use_rtype = True # having a separate entry generally helps readability
napoleon_use_param = True
myst_heading_anchors = 3 # create anchors for h1-h3
myst_heading_anchors = 6 # create anchors for h1-h6
myst_enable_extensions = [
"amsmath",
"colon_fence",
Expand Down Expand Up @@ -121,6 +121,7 @@
html_theme_options = {
"repository_url": repository_url,
"use_repository_button": True,
"path_to_docs": "docs/",
}

pygments_style = "default"
Expand Down
9 changes: 9 additions & 0 deletions docs/conf.py.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
diff a/docs/conf.py b/docs/conf.py (rejected hunks)
@@ -87,6 +87,7 @@ source_suffix = {
}

intersphinx_mapping = {
+ "python": ("https://docs.python.org/3", None),
"anndata": ("https://anndata.readthedocs.io/en/stable/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
}
17 changes: 10 additions & 7 deletions docs/extensions/typed_returns.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
# code from /~https://github.com/theislab/scanpy/blob/master/docs/extensions/typed_returns.py
# with some minor adjustment
from __future__ import annotations

import re
from collections.abc import Generator, Iterable

from sphinx.application import Sphinx
from sphinx.ext.napoleon import NumpyDocstring


def _process_return(lines):
def _process_return(lines: Iterable[str]) -> Generator[str, None, None]:
for line in lines:
m = re.fullmatch(r"(?P<param>\w+)\s+:\s+(?P<type>[\w.]+)", line)
if m:
# Once this is in scanpydoc, we can use the fancy hover stuff
if m := re.fullmatch(r"(?P<param>\w+)\s+:\s+(?P<type>[\w.]+)", line):
yield f'-{m["param"]} (:class:`~{m["type"]}`)'
else:
yield line


def _parse_returns_section(self, section):
lines_raw = list(_process_return(self._dedent(self._consume_to_next_section())))
lines = self._format_block(":returns: ", lines_raw)
def _parse_returns_section(self: NumpyDocstring, section: str) -> list[str]:
lines_raw = self._dedent(self._consume_to_next_section())
if lines_raw[0] == ":":
del lines_raw[0]
lines = self._format_block(":returns: ", list(_process_return(lines_raw)))
if lines and lines[-1]:
lines.append("")
return lines
Expand Down
Loading

0 comments on commit 41efa14

Please sign in to comment.