diff --git a/.cruft.json b/.cruft.json new file mode 100644 index 00000000..f5d8cfc2 --- /dev/null +++ b/.cruft.json @@ -0,0 +1,33 @@ + +{ + "template": "https://github.com/scverse/cookiecutter-scverse", + "commit": "d383d94fadff9e4e6fdb59d77c68cb900d7cedec", + "checkout": "v0.6.0", + "context": { + "cookiecutter": { + "project_name": "scvi-tutorials", + "package_name": "scvi-tutorials", + "project_description": "This repository contains the source notebooks for the tutorials on the scvi-tools site", + "author_full_name": "Ori Kronfeld", + "author_email": "ori.kronfeld@weizmann.ac.il", + "github_user": "scverse", + "github_repo": "scvi-tutorials", + "license": "BSD 3-Clause License", + "ide_integration": true, + "_copy_without_render": [ + ], + "_exclude_on_template_update": [ + "LICENSE", + "README.md" + ], + "_render_devdocs": false, + "_jinja2_env_vars": { + "lstrip_blocks": true, + "trim_blocks": true + }, + "_template": "https://github.com/scverse/cookiecutter-scverse", + "_commit": "d383d94fadff9e4e6fdb59d77c68cb900d7cedec" + } + }, + "directory": null +} diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 1a9d7af2..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: "" -labels: bug -assignees: "" ---- - - - -[TEXT HERE] - - - -```python -# Your code here -``` - - - -```pytb -[Paste the error output produced by the above code here] -``` - -#### Versions: - - - -> VERSION - - diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..124c21a6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,71 @@ +name: Bug report +description: Report something that is broken or incorrect +#title: ... +type: Bug +labels: + - Triage 🩺 +#assignees: [] +body: + - type: checkboxes + id: terms + attributes: + label: Please make sure these conditions are met + # description: ... + options: + - label: I have checked that this issue has not already been reported. + required: true + - label: I have confirmed this bug exists on the latest version of scvi-tutorials and scvi-tools.. + required: true + - label: (optional) I have confirmed this bug exists on the main branch of scvi-tutorials and scvi-tools. + required: false + - type: markdown + attributes: + value: | + **Note**: Please read [this guide][] detailing how to provide the necessary information for us to reproduce your bug. + + [this guide]: https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports + - type: textarea + id: Report + attributes: + label: Report + description: | + Describe the bug you encountered, and what you were trying to do. Please use [github markdown][] features for readability. + + [github markdown]: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax + value: | + Code: + + ```python + + ``` + + Traceback: + + ```pytb + + ``` + validations: + required: true + - type: textarea + id: versions + attributes: + label: Versions + description: | + Which version of scvi-tutorials, scvi-tools and other related software you used. + + Please install `session-info2`, run the following command in a notebook, + click the “Copy as Markdown” button, + then paste the results into the text box below. + + ```python + In[1]: import scvi, session_info2; session_info2.session_info(dependencies=True) + ``` + + Alternatively, run this in a console: + + ```python + >>> import session_info2; print(session_info2.session_info(dependencies=True)._repr_mimebundle_()["text/markdown"]) + ``` + render: python + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index b7628704..5b62547f 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,4 +1,5 @@ +blank_issues_enabled: false contact_links: - - name: Usage question - url: https://discourse.scvi-tools.org/ - about: Please ask and answer non-development questions at https://discourse.scvi-tools.org/. + - name: Scverse Community Forum + url: https://discourse.scverse.org/ + about: If you have questions about “How to do X”, please ask them here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index fcd76a38..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: "" -labels: enhancement -assignees: "" ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 00000000..3cde65b1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,11 @@ +name: Feature request +description: Propose a new feature for scvi-tutorials and scvi-tools +type: Enhancement +body: + - type: textarea + id: description + attributes: + label: Description of feature + description: Please describe your suggestion for a new feature. It might help to describe a problem or use case, plus any alternatives that you have considered. + validations: + required: true diff --git a/.gitignore b/.gitignore index 912e7fc3..9540d99d 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,6 @@ __pycache__/ # IDEs /.idea/ -/.vscode/ # Jupyter .ipynb_checkpoints/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ada2e2cf..edda476d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,6 +6,16 @@ default_stages: - pre-push minimum_pre_commit_version: 2.16.0 repos: + - repo: https://github.com/biomejs/pre-commit + rev: v2.3.5 + hooks: + - id: biome-format + exclude: ^\.cruft\.json$ # inconsistent indentation with cruft - file never to be modified manually. + - repo: https://github.com/tox-dev/pyproject-fmt + rev: v2.11.1 + hooks: + - id: pyproject-fmt + - repo: https://github.com/pre-commit/mirrors-prettier rev: v4.0.0-alpha.8 hooks: @@ -52,6 +62,13 @@ repos: args: [--fix=lf] - id: trailing-whitespace - id: check-case-conflict + - id: check-added-large-files + - id: check-toml + - id: check-yaml + - id: check-merge-conflict + - id: detect-private-key + - id: no-commit-to-branch + args: ["--branch=main"] - repo: local hooks: diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..7e6e9460 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,18 @@ +{ + "recommendations": [ + // GitHub integration + "github.vscode-github-actions", + "github.vscode-pull-request-github", + // Language support + "ms-python.python", + "ms-python.vscode-pylance", + "ms-toolsai.jupyter", + "tamasfe.even-better-toml", + // Dependency management + "ninoseki.vscode-mogami", + // Linting and formatting + "editorconfig.editorconfig", + "charliermarsh.ruff", + "biomejs.biome", + ], +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..cd385f08 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,26 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Build Docs", + "type": "debugpy", + "request": "launch", + "module": "sphinx", + "args": ["-M", "html", ".", "_build"], + "cwd": "${workspaceFolder}/docs", + "console": "internalConsole", + "justMyCode": false, + }, + { + "name": "Python: Debug Test", + "type": "debugpy", + "request": "launch", + "program": "${file}", + "purpose": ["debug-test"], + "console": "internalConsole", + "justMyCode": false, + "env": { "PYTEST_ADDOPTS": "--color=yes" }, + "presentation": { "hidden": true }, + }, + ], +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..ad5223cc --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,27 @@ +{ + "[python][toml][json][jsonc]": { + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit", + "source.fixAll": "explicit", + }, + }, + "[python]": { + "editor.defaultFormatter": "charliermarsh.ruff", + }, + "[toml]": { + "editor.defaultFormatter": "tamasfe.even-better-toml", + }, + "[json][jsonc]": { + "editor.defaultFormatter": "biomejs.biome", + }, + "python.analysis.typeCheckingMode": "basic", + "python.testing.pytestEnabled": true, + "python.testing.pytestArgs": [ + "--color=yes", + "-vv", + "--strict-warnings", + //"-nauto", + ], + "python.terminal.activateEnvironment": true, +} diff --git a/biome.jsonc b/biome.jsonc new file mode 100644 index 00000000..60f4c36d --- /dev/null +++ b/biome.jsonc @@ -0,0 +1,18 @@ +{ + "$schema": "https://biomejs.dev/schemas/2.1.1/schema.json", + "formatter": { "useEditorconfig": true }, + "overrides": [ + { + "includes": ["./.vscode/*.json", "**/*.jsonc", "**/asv.conf.json"], + "json": { + "formatter": { + "trailingCommas": "all", + }, + "parser": { + "allowComments": true, + "allowTrailingCommas": true, + }, + }, + }, + ], +} diff --git a/pyproject.toml b/pyproject.toml index 12ae26f9..1fae7773 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,100 +1,90 @@ [tool.ruff] -line-length = 99 -indent-width = 4 target-version = "py312" +line-length = 99 +indent-width = 4 # Exclude a variety of commonly ignored directories. exclude = [ - ".bzr", - ".direnv", - ".eggs", - ".git", - ".git-rewrite", - ".hg", - ".mypy_cache", - ".nox", - ".pants.d", - ".pytype", - ".ruff_cache", - ".svn", - ".tox", - ".venv", - "__pypackages__", - "_build", - "buck-out", - "build", - "dist", - "node_modules", - "venv", + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".mypy_cache", + ".nox", + ".pants.d", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "venv", ] -[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 = [ - # 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", - # Don't need module level imports at top of cell for notebooks - "E402", - # Don't need docstrings for public classes for notebooks - "D101", - # Don't need docstrings for public methods for notebooks - "D102", - # Don't need docstrings for public functions for notebooks - "D103", -] - -[tool.ruff.lint.pydocstyle] -convention = "numpy" - -[tool.ruff.lint.per-file-ignores] -"docs/*" = ["I", "BLE001"] -"tests/*" = ["D"] -"*/__init__.py" = ["F401"] -"src/scvi/__init__.py" = ["I"] - -[tool.ruff.format] -# Like Black, use double quotes for strings. -quote-style = "double" - # Like Black, indent with spaces, rather than tabs. -indent-style = "space" - -# Like Black, respect magic trailing commas. -skip-magic-trailing-comma = false - +format.indent-style = "space" +# Like Black, use double quotes for strings. +format.quote-style = "double" # Like Black, automatically detect the appropriate line ending. -line-ending = "auto" +format.line-ending = "auto" +# Like Black, respect magic trailing commas. +format.skip-magic-trailing-comma = false +lint.select = [ + "B", # flake8-bugbear + "BLE", # flake8-blind-except + "C4", # flake8-comprehensions + "D", # pydocstyle + "E", # Error detected by Pycodestyle + "F", # Errors detected by Pyflakes + "I", # isort + "RUF100", # Report unused noqa directives + "TID", # flake8-tidy-imports + "UP", # pyupgrade + "W", # Warning detected by Pycodestyle +] +lint.ignore = [ + # Errors from function calls in argument defaults. These are fine when the result is immutable. + "B008", + # Missing docstring in public module + "D100", + # Don't need docstrings for public classes for notebooks + "D101", + # Don't need docstrings for public methods for notebooks + "D102", + # Don't need docstrings for public functions for notebooks + "D103", + # Missing docstring in public package + "D104", + # __magic__ methods are are often self-explanatory, allow missing docstrings + "D105", + # Missing docstring in __init__ + "D107", + ## 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", + # 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", + # Don't need module level imports at top of cell for notebooks + "E402", + # allow I, O, l as variable names -> I is the identity matrix + "E741", +] +lint.per-file-ignores."*/__init__.py" = [ "F401" ] +lint.per-file-ignores."docs/*" = [ "BLE001", "I" ] +lint.per-file-ignores."src/scvi/__init__.py" = [ "I" ] +lint.per-file-ignores."tests/*" = [ "D" ] +lint.pydocstyle.convention = "numpy" [tool.jupytext] formats = "ipynb,md" diff --git a/spatial/data/V1_Human_Heart/spatial/scalefactors_json.json b/spatial/data/V1_Human_Heart/spatial/scalefactors_json.json index 1c7bf536..750d8bb0 100644 --- a/spatial/data/V1_Human_Heart/spatial/scalefactors_json.json +++ b/spatial/data/V1_Human_Heart/spatial/scalefactors_json.json @@ -1 +1,6 @@ -{"spot_diameter_fullres": 89.4269181032894, "tissue_hires_scalef": 0.150015, "fiducial_diameter_fullres": 144.45886770531362, "tissue_lowres_scalef": 0.045004502} +{ + "spot_diameter_fullres": 89.4269181032894, + "tissue_hires_scalef": 0.150015, + "fiducial_diameter_fullres": 144.45886770531362, + "tissue_lowres_scalef": 0.045004502 +}