diff --git a/.cruft.json b/.cruft.json index 8da5a75..69a03ef 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,7 +1,7 @@ { "template": "https://github.com/scverse/cookiecutter-scverse", - "commit": "c21b82bf134f3a0f13db7482d4fb04ca1f562d59", - "checkout": "main", + "commit": "87a407a65408d75a949c0b54b19fd287475a56f8", + "checkout": "v0.4.0", "context": { "cookiecutter": { "project_name": "scib-metrics", @@ -13,9 +13,15 @@ "project_repo": "https://github.com/yoseflab/scib-metrics", "license": "BSD 3-Clause License", "_copy_without_render": [ - ".github/workflows/**.yaml", + ".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" } }, 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/.github/workflows/test.yaml b/.github/workflows/test.yaml index 13267d1..2bfe232 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,53 +1,67 @@ name: Test on: - push: - branches: [main] - pull_request: - branches: [main] + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: "0 5 1,15 * *" concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: - test: - runs-on: ${{ matrix.os }} - defaults: - run: - shell: bash -e {0} # -e to fail on error - - strategy: - fail-fast: false - matrix: - python: ["3.8", "3.10"] - os: [ubuntu-latest] + test: + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash -e {0} # -e to fail on error + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + python: "3.10" + - os: ubuntu-latest + python: "3.12" + - os: ubuntu-latest + python: "3.12" + pip-flags: "--pre" + name: PRE-RELEASE DEPENDENCIES + + name: ${{ matrix.name }} Python ${{ matrix.python }} + + env: + OS: ${{ matrix.os }} + PYTHON: ${{ matrix.python }} + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + cache: "pip" + cache-dependency-path: "**/pyproject.toml" + + - name: Install test dependencies + run: | + python -m pip install --upgrade pip wheel + - name: Install dependencies + run: | + pip install ${{ matrix.pip-flags }} ".[dev,test]" + - name: Test env: - OS: ${{ matrix.os }} - PYTHON: ${{ matrix.python }} - - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - cache: "pip" - cache-dependency-path: "**/pyproject.toml" - - - name: Install test dependencies - run: | - python -m pip install --upgrade pip wheel - - name: Install dependencies - run: | - pip install ".[dev,test]" - - name: Test - env: - MPLBACKEND: agg - PLATFORM: ${{ matrix.os }} - DISPLAY: :42 - run: | - pytest -v --cov --color=yes - - name: Upload coverage - uses: codecov/codecov-action@v3 + MPLBACKEND: agg + PLATFORM: ${{ matrix.os }} + DISPLAY: :42 + run: | + coverage run -m pytest -v --color=yes + - name: Report coverage + run: | + coverage report + - name: Upload coverage + uses: codecov/codecov-action@v3 diff --git a/.gitignore.rej b/.gitignore.rej new file mode 100644 index 0000000..9d0a7e9 --- /dev/null +++ b/.gitignore.rej @@ -0,0 +1,9 @@ +diff a/.gitignore b/.gitignore (rejected hunks) +@@ -18,6 +18,7 @@ __pycache__/ + /.pytest_cache/ + /.cache/ + /data/ ++/node_modules/ + + # docs + /docs/generated/ diff --git a/.pre-commit-config.yaml.rej b/.pre-commit-config.yaml.rej new file mode 100644 index 0000000..4717a21 --- /dev/null +++ b/.pre-commit-config.yaml.rej @@ -0,0 +1,89 @@ +diff a/.pre-commit-config.yaml b/.pre-commit-config.yaml (rejected hunks) +@@ -1,50 +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.4.2" +- hooks: +- - id: black +- - repo: https://github.com/asottile/blacken-docs +- rev: 1.16.0 +- hooks: +- - id: blacken-docs +- - 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/charliermarsh/ruff-pre-commit +- rev: v0.4.4 +- hooks: +- - id: ruff +- args: [--fix, --exit-non-zero-on-fix] +- - repo: https://github.com/pre-commit/pre-commit-hooks +- rev: v4.6.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: 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.4.4 ++ 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.6.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/README.md.rej b/README.md.rej new file mode 100644 index 0000000..b300afc --- /dev/null +++ b/README.md.rej @@ -0,0 +1,19 @@ +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.10 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 scib-metrics: +@@ -33,7 +33,7 @@ pip install scib-metrics + 1. Install the latest development version: + + ```bash +-pip install git+https://github.com/adamgayoso/scib-metrics.git@main ++pip install git+https://github.com/yoseflab/scib-metrics.git@main + ``` + + ## Release notes 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/conf.py b/docs/conf.py index 05fe972..359d6c4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,5 @@ # Configuration file for the Sphinx documentation builder. -# + # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html @@ -61,6 +61,7 @@ "sphinx_autodoc_typehints", "sphinx.ext.mathjax", "IPython.sphinxext.ipython_console_highlighting", + "sphinxext.opengraph", *[p.stem for p in (HERE / "extensions").glob("*.py")], ] diff --git a/docs/conf.py.rej b/docs/conf.py.rej new file mode 100644 index 0000000..23ce07d --- /dev/null +++ b/docs/conf.py.rej @@ -0,0 +1,51 @@ +diff a/docs/conf.py b/docs/conf.py (rejected hunks) +@@ -36,10 +36,10 @@ needs_sphinx = "4.0" + + html_context = { + "display_github": True, # Integrate GitHub +- "github_user": "adamgayoso", # Username +- "github_repo": project_name, # Repo name +- "github_version": "main", # Version +- "conf_py_path": "/docs/", # Path in the checkout to the docs root ++ "github_user": "adamgayoso", ++ "github_repo": "https://github.com/yoseflab/scib-metrics", ++ "github_version": "main", ++ "conf_py_path": "/docs/", + } + + # -- General configuration --------------------------------------------------- +@@ -108,12 +109,15 @@ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "**.ipynb_checkpoints"] + # + 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" +@@ -123,18 +127,3 @@ nitpick_ignore = [ + # 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/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 100644 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 d57854e..62fa7a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,7 +88,7 @@ select = [ "RUF100", # Report unused noqa directives ] ignore = [ - # line too long -> we accept long comment lines; black gets rid of long code lines + # 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", @@ -102,7 +102,7 @@ ignore = [ "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 + # __magic__ methods are often self-explanatory, allow missing docstrings "D105", # first line should end with a period [Bug: doesn't work with single-line docstrings] "D400", @@ -156,5 +156,5 @@ skip = [ "docs/changelog.md", "docs/references.bib", "docs/references.md", - "docs/notebooks/example.ipynb" + "docs/notebooks/example.ipynb", ] diff --git a/pyproject.toml.rej b/pyproject.toml.rej new file mode 100644 index 0000000..e7149f9 --- /dev/null +++ b/pyproject.toml.rej @@ -0,0 +1,90 @@ +diff a/pyproject.toml b/pyproject.toml (rejected hunks) +@@ -7,7 +7,7 @@ name = "scib-metrics" + version = "0.0.1" + description = "Accelerated and Python-only scIB metrics" + readme = "README.md" +-requires-python = ">=3.8" ++requires-python = ">=3.10" + license = {file = "LICENSE"} + authors = [ + {name = "Adam Gayoso"}, +@@ -21,30 +21,31 @@ urls.Home-page = "https://github.com/yoseflab/scib-metrics" + 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>=1.0.0", +- "myst-nb", ++ "myst-nb>=1.1.0", + "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] +@@ -60,14 +61,15 @@ addopts = [ + "--import-mode=importlib", # allow using test files with same name + ] + +-[tool.black] +-line-length = 120 +-target-version = ["py38"] +- + [tool.ruff] +-src = ["src"] + line-length = 120 +-target-version = "py38" ++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 +@@ -109,17 +111,14 @@ ignore = [ + "D213", + ] + +-[tool.ruff.pydocstyle] ++[tool.ruff.lint.pydocstyle] + convention = "numpy" + +-[tool.ruff.per-file-ignores] ++[tool.ruff.lint.per-file-ignores] + "docs/*" = ["I"] + "tests/*" = ["D"] + "*/__init__.py" = ["F401"] + +-[tool.jupytext] +-formats = "ipynb,md" +- + [tool.cruft] + skip = [ + "tests",