From af6e5fdadebb1242ab0ce7763a057e37fa312833 Mon Sep 17 00:00:00 2001 From: scverse-bot Date: Thu, 22 Feb 2024 18:45:04 +0000 Subject: [PATCH] Update template to v0.3.1 --- .bumpversion.cfg | 8 -- .codecov.yaml | 22 ++--- .cruft.json | 48 +++++----- .editorconfig | 6 ++ .flake8 | 57 ------------ .gitignore | 4 + .pre-commit-config.yaml.rej | 124 ++++++++++++++++++++++++++ .readthedocs.yaml.rej | 29 ++++++ README.md.rej | 10 +++ docs/_static/css/custom.css | 4 + docs/_templates/autosummary/class.rst | 6 -- docs/conf.py | 27 +++--- docs/conf.py.rej | 9 ++ docs/contributing.md | 81 +++++------------ docs/extensions/typed_returns.py | 17 ++-- docs/index.md.rej | 9 ++ docs/make.bat | 35 -------- pyproject.toml | 84 +++++++++++------ pyproject.toml.rej | 54 +++++++++++ 19 files changed, 385 insertions(+), 249 deletions(-) delete mode 100644 .bumpversion.cfg delete mode 100644 .flake8 create mode 100644 .pre-commit-config.yaml.rej create mode 100644 .readthedocs.yaml.rej create mode 100644 README.md.rej create mode 100644 docs/_static/css/custom.css create mode 100644 docs/conf.py.rej create mode 100644 docs/index.md.rej delete mode 100755 docs/make.bat create mode 100644 pyproject.toml.rej diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index fdba9e4..0000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[bumpversion] -current_version = 0.0.1 -tag = True -commit = True - -[bumpversion:file:./pyproject.toml] -search = version = "{current_version}" -replace = version = "{new_version}" diff --git a/.codecov.yaml b/.codecov.yaml index 829e56c..d0c0e29 100644 --- a/.codecov.yaml +++ b/.codecov.yaml @@ -1,17 +1,17 @@ # Based on pydata/xarray codecov: - require_ci_to_pass: no + require_ci_to_pass: no coverage: - status: - project: - default: - # Require 1% coverage, i.e., always succeed - target: 1 - patch: false - changes: false + status: + project: + default: + # Require 1% coverage, i.e., always succeed + target: 1 + patch: false + changes: false comment: - layout: diff, flags, files - behavior: once - require_base: no + layout: diff, flags, files + behavior: once + require_base: no diff --git a/.cruft.json b/.cruft.json index 6fe78e5..f29af39 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,23 +1,29 @@ { - "template": "https://github.com/scverse/cookiecutter-scverse", - "commit": "7b86b3572123c7777e012adcf6fff0c7217ba7a0", - "checkout": null, - "context": { - "cookiecutter": { - "project_name": "eschr", - "package_name": "eschr", - "project_description": "A hyperparameter-randomized ensemble approach for robust clustering across diverse datasets", - "author_full_name": "Sarah Goggin", - "author_email": "sg4dm@virginia.edu", - "github_user": "zunderlab", - "project_repo": "https://github.com/zunderlab/eschr", - "license": "MIT License", - "_copy_without_render": [ - ".github/workflows/**.yaml", - "docs/_templates/autosummary/**.rst" - ], - "_template": "https://github.com/scverse/cookiecutter-scverse" - } - }, - "directory": null + "template": "https://github.com/scverse/cookiecutter-scverse", + "commit": "586b1652162ff7994b0070a034023d64289ae416", + "checkout": "v0.3.1", + "context": { + "cookiecutter": { + "project_name": "eschr", + "package_name": "eschr", + "project_description": "A hyperparameter-randomized ensemble approach for robust clustering across diverse datasets", + "author_full_name": "Sarah Goggin", + "author_email": "sg4dm@virginia.edu", + "github_user": "zunderlab", + "project_repo": "https://github.com/zunderlab/eschr", + "license": "MIT License", + "_copy_without_render": [ + ".github/workflows/build.yaml", + ".github/workflows/test.yaml", + "docs/_templates/autosummary/**.rst" + ], + "_render_devdocs": false, + "_jinja2_env_vars": { + "lstrip_blocks": true, + "trim_blocks": true + }, + "_template": "https://github.com/scverse/cookiecutter-scverse" + } + }, + "directory": null } diff --git a/.editorconfig b/.editorconfig index 2fe0ce0..050f911 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,5 +8,11 @@ charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true +[*.{yml,yaml}] +indent_size = 2 + +[.cruft.json] +indent_size = 2 + [Makefile] indent_style = tab diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 10cfc5a..0000000 --- a/.flake8 +++ /dev/null @@ -1,57 +0,0 @@ -# Can't yet be moved to the pyproject.toml due to https://github.com/PyCQA/flake8/issues/234 -[flake8] -max-line-length = 120 -ignore = - # line break before a binary operator -> black does not adhere to PEP8 - W503 - # line break occured after a binary operator -> black does not adhere to PEP8 - W504 - # line too long -> we accept long comment lines; black gets rid of long code lines - E501 - # whitespace before : -> black does not adhere to PEP8 - E203 - # line break before binary operator -> black does not adhere to PEP8 - W503 - # missing whitespace after ,', ';', or ':' -> black does not adhere to PEP8 - E231 - # continuation line over-indented for hanging indent -> black does not adhere to PEP8 - E126 - # too many leading '#' for block comment -> this is fine for indicating sections - E262 - # Do not assign a lambda expression, use a def -> lambda expression assignments are convenient - E731 - # allow I, O, l as variable names -> I is the identity matrix - E741 - # Missing docstring in public package - D104 - # Missing docstring in public module - D100 - # Missing docstring in __init__ - D107 - # Errors from function calls in argument defaults. These are fine when the result is immutable. - B008 - # Missing docstring in magic method - D105 - # format string does contain unindexed parameters - P101 - # first line should end with a period [Bug: doesn't work with single-line docstrings] - D400 - # First line should be in imperative mood; try rephrasing - D401 -exclude = .git,__pycache__,build,docs/_build,dist -per-file-ignores = - tests/*: D - */__init__.py: F401 -rst-roles = - class, - func, - ref, - cite:p, - cite:t, -rst-directives = - envvar, - exception, -rst-substitutions = - version, -extend-ignore = - RST307, diff --git a/.gitignore b/.gitignore index 7bb0bd5..dcdc618 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,13 @@ # Temp files .DS_Store *~ +buck-out/ # Compiled files +.venv/ __pycache__/ +.mypy_cache/ +.ruff_cache/ # Distribution / packaging /build/ diff --git a/.pre-commit-config.yaml.rej b/.pre-commit-config.yaml.rej new file mode 100644 index 0000000..90e8b92 --- /dev/null +++ b/.pre-commit-config.yaml.rej @@ -0,0 +1,124 @@ +diff a/.pre-commit-config.yaml b/.pre-commit-config.yaml (rejected hunks) +@@ -1,85 +1,42 @@ + fail_fast: false + default_language_version: +- python: python3 ++ python: python3 + default_stages: +- - commit +- - push ++ - commit ++ - push + minimum_pre_commit_version: 2.16.0 + repos: +- - repo: https://github.com/psf/black +- rev: 24.2.0 +- hooks: +- - id: black +- - repo: https://github.com/pre-commit/mirrors-prettier +- rev: v4.0.0-alpha.8 +- hooks: +- - 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/asottile/blacken-docs +- rev: 1.16.0 +- hooks: +- - id: blacken-docs +- - repo: https://github.com/PyCQA/isort +- rev: 5.13.2 +- hooks: +- - id: isort +- - repo: https://github.com/asottile/yesqa +- rev: v1.5.0 +- hooks: +- - id: yesqa +- additional_dependencies: +- - flake8-tidy-imports +- - flake8-docstrings +- - flake8-rst-docstrings +- - flake8-comprehensions +- - flake8-bugbear +- - flake8-blind-except +- - repo: https://github.com/pre-commit/pre-commit-hooks +- rev: v4.5.0 +- hooks: +- - id: detect-private-key +- - id: check-ast +- - id: end-of-file-fixer +- - id: mixed-line-ending +- args: [--fix=lf] +- - id: trailing-whitespace +- - id: check-case-conflict +- - repo: https://github.com/myint/autoflake +- rev: v2.3.0 +- hooks: +- - id: autoflake +- args: +- - --in-place +- - --remove-all-unused-imports +- - --remove-unused-variable +- - --ignore-init-module-imports +- - repo: https://github.com/PyCQA/flake8 +- rev: 7.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.15.1 +- hooks: +- - id: pyupgrade +- args: [--py3-plus, --py38-plus, --keep-runtime-typing] +- - repo: local +- hooks: +- - id: forbid-to-commit +- name: Don't commit rej files +- entry: | +- Cannot commit .rej files. These indicate merge conflicts that arise during automated template updates. +- Fix the merge conflicts manually and remove the .rej files. +- language: fail +- files: '.*\.rej$' ++ - repo: https://github.com/pre-commit/mirrors-prettier ++ rev: v4.0.0-alpha.8 ++ hooks: ++ - id: prettier ++ - repo: https://github.com/astral-sh/ruff-pre-commit ++ rev: v0.2.2 ++ hooks: ++ - id: ruff ++ types_or: [python, pyi, jupyter] ++ args: [--fix, --exit-non-zero-on-fix] ++ - id: ruff-format ++ types_or: [python, pyi, jupyter] ++ - repo: https://github.com/pre-commit/pre-commit-hooks ++ rev: v4.5.0 ++ hooks: ++ - id: detect-private-key ++ - id: check-ast ++ - id: end-of-file-fixer ++ - id: mixed-line-ending ++ args: [--fix=lf] ++ - id: trailing-whitespace ++ - id: check-case-conflict ++ # Check that there are no merge conflicts (could be generated by template sync) ++ - id: check-merge-conflict ++ args: [--assume-in-merge] ++ - repo: local ++ hooks: ++ - id: forbid-to-commit ++ name: Don't commit rej files ++ entry: | ++ Cannot commit .rej files. These indicate merge conflicts that arise during automated template updates. ++ Fix the merge conflicts manually and remove the .rej files. ++ language: fail ++ files: '.*\.rej$' diff --git a/.readthedocs.yaml.rej b/.readthedocs.yaml.rej new file mode 100644 index 0000000..6e4581a --- /dev/null +++ b/.readthedocs.yaml.rej @@ -0,0 +1,29 @@ +diff a/.readthedocs.yaml b/.readthedocs.yaml (rejected hunks) +@@ -1,16 +1,16 @@ + # https://docs.readthedocs.io/en/stable/config-file/v2.html + version: 2 + build: +- os: ubuntu-20.04 +- tools: +- python: "3.10" ++ os: ubuntu-20.04 ++ tools: ++ python: "3.10" + sphinx: +- configuration: docs/conf.py +- # disable this for more lenient docs builds +- fail_on_warning: true ++ configuration: docs/conf.py ++ # disable this for more lenient docs builds ++ fail_on_warning: true + python: +- install: +- - method: pip +- path: . +- extra_requirements: +- - doc ++ install: ++ - method: pip ++ path: . ++ extra_requirements: ++ - doc diff --git a/README.md.rej b/README.md.rej new file mode 100644 index 0000000..a6b11f1 --- /dev/null +++ b/README.md.rej @@ -0,0 +1,10 @@ +diff a/README.md b/README.md (rejected hunks) +@@ -17,7 +17,7 @@ Please refer to the [documentation][link-docs]. In particular, the + + ## Installation + +-You need to have Python 3.8 or newer installed on your system. If you don't have ++You need to have Python 3.9 or newer installed on your system. If you don't have + Python installed, we recommend installing [Mambaforge](https://github.com/conda-forge/miniforge#mambaforge). + + There are several alternative options to install eschr: diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css new file mode 100644 index 0000000..b8c8d47 --- /dev/null +++ b/docs/_static/css/custom.css @@ -0,0 +1,4 @@ +/* Reduce the font size in data frames - See https://github.com/scverse/cookiecutter-scverse/issues/193 */ +div.cell_output table.dataframe { + font-size: 0.8em; +} diff --git a/docs/_templates/autosummary/class.rst b/docs/_templates/autosummary/class.rst index 17dc123..e4665df 100755 --- a/docs/_templates/autosummary/class.rst +++ b/docs/_templates/autosummary/class.rst @@ -39,9 +39,6 @@ Attributes {% for item in attributes %} -{{ item }} -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - .. autoattribute:: {{ [objname, item] | join(".") }} {%- endfor %} @@ -56,9 +53,6 @@ Methods {% for item in methods %} {%- if item != '__init__' %} -{{ item }} -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - .. automethod:: {{ [objname, item] | join(".") }} {%- endif -%} {%- endfor %} diff --git a/docs/conf.py b/docs/conf.py index a2ab7e9..2b47b1a 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -16,12 +16,15 @@ # -- Project information ----------------------------------------------------- +# NOTE: If you installed your project in editable mode, this might be stale. +# If this is the case, reinstall it to refresh the metadata info = metadata("eschr") project_name = info["Name"] author = info["Author"] copyright = f"{datetime.now():%Y}, {author}." version = info["Version"] -repository_url = f"https://github.com/zunderlab/{project_name}" +urls = dict(pu.split(", ") for pu in info.get_all("Project-URL")) +repository_url = urls["Source"] # The full version, including alpha/beta/rc tags release = info["Version"] @@ -54,6 +57,7 @@ "sphinx_autodoc_typehints", "sphinx.ext.mathjax", "IPython.sphinxext.ipython_console_highlighting", + "sphinxext.opengraph", *[p.stem for p in (HERE / "extensions").glob("*.py")], ] @@ -65,7 +69,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", @@ -108,11 +112,15 @@ # html_theme = "sphinx_book_theme" html_static_path = ["_static"] +html_css_files = ["css/custom.css"] + html_title = project_name html_theme_options = { "repository_url": repository_url, "use_repository_button": True, + "path_to_docs": "docs/", + "navigation_with_keys": False, } pygments_style = "default" @@ -122,18 +130,3 @@ # you can add an exception to this list. # ("py:class", "igraph.Graph"), ] - - -def setup(app): - """App setup hook.""" - app.add_config_value( - "recommonmark_config", - { - "auto_toc_tree_section": "Contents", - "enable_auto_toc_tree": True, - "enable_math": True, - "enable_inline_math": False, - "enable_eval_rst": True, - }, - True, - ) diff --git a/docs/conf.py.rej b/docs/conf.py.rej new file mode 100644 index 0000000..fdbe484 --- /dev/null +++ b/docs/conf.py.rej @@ -0,0 +1,9 @@ +diff a/docs/conf.py b/docs/conf.py (rejected hunks) +@@ -87,6 +91,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), + } diff --git a/docs/contributing.md b/docs/contributing.md index 33f05e1..07e419d 100755 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -1,6 +1,6 @@ # Contributing guide -Scanpy provides extensive [developer documentation][scanpy developer guide], most of which applies to this repo, too. +Scanpy provides extensive [developer documentation][scanpy developer guide], most of which applies to this project, too. This document will not reproduce the entire content from there. Instead, it aims at summarizing the most important information to get you started on contributing. @@ -19,9 +19,8 @@ pip install -e ".[dev,test,doc]" ## Code-style -This template uses [pre-commit][] to enforce consistent code-styles. On every commit, pre-commit checks will either -automatically fix issues with the code, or raise an error message. See [pre-commit checks](template_usage.md#pre-commit-checks) for -a full list of checks enabled for this repository. +This package uses [pre-commit][] to enforce consistent code-styles. +On every commit, pre-commit checks will either automatically fix issues with the code, or raise an error message. To enable pre-commit locally, simply run @@ -43,10 +42,10 @@ git pull --rebase to integrate the changes into yours. While the [pre-commit.ci][] is useful, we strongly encourage installing and running pre-commit locally first to understand its usage. -Finally, most editors have an _autoformat on save_ feature. Consider enabling this option for [black][black-editors] +Finally, most editors have an _autoformat on save_ feature. Consider enabling this option for [ruff][ruff-editors] and [prettier][prettier-editors]. -[black-editors]: https://black.readthedocs.io/en/stable/integrations/editors.html +[ruff-editors]: https://docs.astral.sh/ruff/integrations/ [prettier-editors]: https://prettier.io/docs/en/editors.html ## Writing tests @@ -65,7 +64,17 @@ command line by executing pytest ``` -in the root of the repository. Continuous integration will automatically run the tests on all pull requests. +in the root of the repository. + +### Continuous integration + +Continuous integration will automatically run the tests on all pull requests and test +against the minimum and maximum supported Python version. + +Additionally, there's a CI job that tests against pre-releases of all dependencies +(if there are any). The purpose of this check is to detect incompatibilities +of new package versions early on and gives you time to fix the issue or reach +out to the developers of the dependency before the package is released to a wider audience. [scanpy-test-docs]: https://scanpy.readthedocs.io/en/latest/dev/testing.html#writing-tests @@ -73,7 +82,7 @@ in the root of the repository. Continuous integration will automatically run the ### Updating the version number -Before making a release, you need to update the version number. Please adhere to [Semantic Versioning][semver], in brief +Before making a release, you need to update the version number in the `pyproject.toml` file. Please adhere to [Semantic Versioning][semver], in brief > Given a version number MAJOR.MINOR.PATCH, increment the: > @@ -83,56 +92,8 @@ Before making a release, you need to update the version number. Please adhere to > > Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format. -We use [bump2version][] to automatically update the version number in all places and automatically create a git tag. -Run one of the following commands in the root of the repository - -```bash -bump2version patch -bump2version minor -bump2version major -``` - -Once you are done, run - -``` -git push --tags -``` - -to publish the created tag on GitHub. - -[bump2version]: https://github.com/c4urself/bump2version - -### Building and publishing the package on PyPI - -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 - -```bash -python -m build -``` - -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. - -Before uploading them to [PyPI][] you can check that your _distribution_ is valid by running: - -```bash -twine check dist/* -``` - -and finally publishing it with: - -```bash -twine upload dist/* -``` - -Provide your username and password when requested and then go check out your package on [PyPI][]! - -For more information, follow the [Python packaging tutorial][]. - -It is possible to automate this with GitHub actions, see also [this feature request][pypi-feature-request] -in the cookiecutter-scverse template. - -[python packaging tutorial]: https://packaging.python.org/en/latest/tutorials/packaging-projects/#generating-distribution-archives -[pypi-feature-request]: https://github.com/scverse/cookiecutter-scverse/issues/88 +Once you are done, commit and push your changes and navigate to the "Releases" page of this project on GitHub. +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. ## Writing documentation @@ -142,6 +103,7 @@ Please write documentation for new or changed features and use-cases. This proje - [Numpy-style docstrings][numpydoc] (through the [napoloen][numpydoc-napoleon] extension). - Jupyter notebooks as tutorials through [myst-nb][] (See [Tutorials with myst-nb](#tutorials-with-myst-nb-and-jupyter-notebooks)) - [Sphinx autodoc typehints][], to automatically reference annotated input and output types +- Citations (like {cite:p}`Virshup_2023`) can be included with [sphinxcontrib-bibtex](https://sphinxcontrib-bibtex.readthedocs.io/) See the [scanpy developer docs](https://scanpy.readthedocs.io/en/latest/dev/documentation.html) for more information on how to write documentation. @@ -150,7 +112,7 @@ on how to write documentation. The documentation is set-up to render jupyter notebooks stored in the `docs/notebooks` directory using [myst-nb][]. Currently, only notebooks in `.ipynb` format are supported that will be included with both their input and output cells. -It is your reponsibility to update and re-run the notebook whenever necessary. +It is your responsibility to update and re-run the notebook whenever necessary. If you are interested in automatically running notebooks as part of the continuous integration, please check out [this feature request](https://github.com/scverse/cookiecutter-scverse/issues/40) in the `cookiecutter-scverse` @@ -195,3 +157,4 @@ open _build/html/index.html [numpydoc]: https://numpydoc.readthedocs.io/en/latest/format.html [sphinx autodoc typehints]: https://github.com/tox-dev/sphinx-autodoc-typehints [pypi]: https://pypi.org/ +[managing GitHub releases]: https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository diff --git a/docs/extensions/typed_returns.py b/docs/extensions/typed_returns.py index 9447813..1135204 100755 --- a/docs/extensions/typed_returns.py +++ b/docs/extensions/typed_returns.py @@ -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\w+)\s+:\s+(?P[\w.]+)", line) - if m: - # Once this is in scanpydoc, we can use the fancy hover stuff + if m := re.fullmatch(r"(?P\w+)\s+:\s+(?P[\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 diff --git a/docs/index.md.rej b/docs/index.md.rej new file mode 100644 index 0000000..14a8d31 --- /dev/null +++ b/docs/index.md.rej @@ -0,0 +1,9 @@ +diff a/docs/index.md b/docs/index.md (rejected hunks) +@@ -8,7 +8,6 @@ + + api.md + changelog.md +-template_usage.md + contributing.md + references.md + diff --git a/docs/make.bat b/docs/make.bat deleted file mode 100755 index 954237b..0000000 --- a/docs/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=. -set BUILDDIR=_build - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.https://www.sphinx-doc.org/ - exit /b 1 -) - -if "%1" == "" goto help - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - -:end -popd diff --git a/pyproject.toml b/pyproject.toml index b604df1..9757a62 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,35 +74,63 @@ addopts = [ "--import-mode=importlib", # allow using test files with same name ] -[tool.isort] -include_trailing_comma = true -multi_line_output = 3 -profile = "black" -skip_glob = ["docs/*"] - -[tool.black] +[tool.ruff] line-length = 120 -target-version = ['py38'] -include = '\.pyi?$' -exclude = ''' -( - /( - \.eggs - | \.git - | \.hg - | \.mypy_cache - | \.tox - | \.venv - | _build - | buck-out - | build - | dist - )/ -) -''' +src = ["src"] +extend-include = ["*.ipynb"] + +[tool.ruff.format] +docstring-code-format = true + +[tool.ruff.lint] +select = [ + "F", # Errors detected by Pyflakes + "E", # Error detected by Pycodestyle + "W", # Warning detected by Pycodestyle + "I", # isort + "D", # pydocstyle + "B", # flake8-bugbear + "TID", # flake8-tidy-imports + "C4", # flake8-comprehensions + "BLE", # flake8-blind-except + "UP", # pyupgrade + "RUF100", # Report unused noqa directives +] +ignore = [ + # line too long -> we accept long comment lines; formatter gets rid of long code lines + "E501", + # Do not assign a lambda expression, use a def -> lambda expression assignments are convenient + "E731", + # allow I, O, l as variable names -> I is the identity matrix + "E741", + # Missing docstring in public package + "D104", + # Missing docstring in public module + "D100", + # Missing docstring in __init__ + "D107", + # Errors from function calls in argument defaults. These are fine when the result is immutable. + "B008", + # __magic__ methods are are often self-explanatory, allow missing docstrings + "D105", + # first line should end with a period [Bug: doesn't work with single-line docstrings] + "D400", + # First line should be in imperative mood; try rephrasing + "D401", + ## Disable one in each pair of mutually incompatible rules + # We don’t want a blank line before a class docstring + "D203", + # We want docstrings to start immediately after the opening triple quote + "D213", +] + +[tool.ruff.lint.pydocstyle] +convention = "numpy" -[tool.jupytext] -formats = "ipynb,md" +[tool.ruff.lint.per-file-ignores] +"docs/*" = ["I"] +"tests/*" = ["D"] +"*/__init__.py" = ["F401"] [tool.cruft] skip = [ @@ -113,7 +141,7 @@ skip = [ "docs/changelog.md", "docs/references.bib", "docs/references.md", - "docs/notebooks/example.ipynb" + "docs/notebooks/example.ipynb", ] [tool.ruff] diff --git a/pyproject.toml.rej b/pyproject.toml.rej new file mode 100644 index 0000000..080ed35 --- /dev/null +++ b/pyproject.toml.rej @@ -0,0 +1,54 @@ +diff a/pyproject.toml b/pyproject.toml (rejected hunks) +@@ -2,13 +2,12 @@ + build-backend = "hatchling.build" + requires = ["hatchling"] + +- + [project] + name = "eschr" + version = "0.0.1" + description = "A hyperparameter-randomized ensemble approach for robust clustering across diverse datasets" + readme = "README.md" +-requires-python = ">=3.8" ++requires-python = ">=3.9" + license = {file = "LICENSE"} + authors = [ + {name = "Sarah Goggin"}, +@@ -22,30 +21,31 @@ urls.Home-page = "https://github.com/zunderlab/eschr" + dependencies = [ + "anndata", + # for debug logging (referenced from the issue template) +- "session-info" ++ "session-info", + ] + + [project.optional-dependencies] + dev = [ +- # CLI for bumping the version number +- "bump2version", + "pre-commit", +- "twine>=4.0.2" ++ "twine>=4.0.2", + ] + doc = [ ++ "docutils>=0.8,!=0.18.*,!=0.19.*", + "sphinx>=4", +- "sphinx-book-theme>=0.3.3", ++ "sphinx-book-theme>=1.0.0", + "myst-nb", + "sphinxcontrib-bibtex>=1.0.0", + "sphinx-autodoc-typehints", ++ "sphinxext-opengraph", + # For notebooks + "ipykernel", + "ipython", + "sphinx-copybutton", ++ "pandas", + ] + test = [ + "pytest", +- "pytest-cov", ++ "coverage", + ] + + [tool.coverage.run]