spatialdata-io 0.2.0__tar.gz → 0.3.0__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 (75) hide show
  1. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/.github/workflows/prepare_test_data.yaml +1 -1
  2. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/.github/workflows/release.yaml +2 -2
  3. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/.github/workflows/test.yaml +3 -3
  4. spatialdata_io-0.3.0/.pre-commit-config.yaml +43 -0
  5. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/.readthedocs.yaml +2 -3
  6. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/PKG-INFO +6 -2
  7. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/README.md +4 -0
  8. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/_version.py +2 -2
  9. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/docs/conf.py +1 -0
  10. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/docs/extensions/typed_returns.py +1 -1
  11. spatialdata_io-0.3.0/pyproject.toml +199 -0
  12. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/__main__.py +15 -16
  13. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/_constants/_constants.py +1 -1
  14. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/_constants/_enum.py +5 -3
  15. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/_docs.py +5 -3
  16. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/_utils.py +5 -4
  17. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/converters/generic_to_zarr.py +1 -2
  18. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/converters/legacy_anndata.py +15 -14
  19. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/_utils/_read_10x_h5.py +3 -4
  20. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/_utils/_utils.py +9 -5
  21. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/codex.py +5 -4
  22. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/cosmx.py +7 -5
  23. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/curio.py +2 -3
  24. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/dbit.py +17 -12
  25. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/generic.py +10 -7
  26. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/iss.py +5 -4
  27. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/macsima.py +5 -4
  28. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/mcmicro.py +8 -6
  29. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/merscope.py +14 -14
  30. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/seqfish.py +6 -6
  31. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/steinbock.py +14 -11
  32. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/stereoseq.py +6 -5
  33. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/visium.py +5 -4
  34. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/visium_hd.py +15 -15
  35. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/xenium.py +23 -16
  36. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/tests/_utils.py +1 -2
  37. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/tests/test_basic.py +1 -1
  38. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/tests/test_macsima.py +2 -2
  39. spatialdata_io-0.2.0/.flake8 +0 -62
  40. spatialdata_io-0.2.0/.pre-commit-config.yaml +0 -89
  41. spatialdata_io-0.2.0/pyproject.toml +0 -121
  42. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/.bumpversion.cfg +0 -0
  43. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/.codecov.yaml +0 -0
  44. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/.editorconfig +0 -0
  45. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/.github/codecov.yml +0 -0
  46. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/.github/release.yml +0 -0
  47. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/.gitignore +0 -0
  48. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/.mypy.ini +0 -0
  49. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/LICENSE +0 -0
  50. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/docs/Makefile +0 -0
  51. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/docs/_static/.gitkeep +0 -0
  52. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/docs/_templates/.gitkeep +0 -0
  53. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/docs/_templates/autosummary/class.rst +0 -0
  54. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/docs/api.md +0 -0
  55. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/docs/changelog.md +0 -0
  56. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/docs/cli.md +0 -0
  57. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/docs/contributing.md +0 -0
  58. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/docs/extensions/.gitkeep +0 -0
  59. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/docs/index.md +0 -0
  60. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/docs/make.bat +0 -0
  61. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/docs/references.bib +0 -0
  62. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/docs/references.md +0 -0
  63. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/__init__.py +0 -0
  64. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/_constants/__init__.py +0 -0
  65. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/converters/__init__.py +0 -0
  66. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/experimental/__init__.py +0 -0
  67. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/__init__.py +0 -0
  68. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/src/spatialdata_io/readers/_utils/__init__.py +0 -0
  69. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/tests/__init__.py +0 -0
  70. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/tests/conftest.py +0 -0
  71. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/tests/converters/__init__.py +0 -0
  72. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/tests/converters/test_legacy_anndata.py +0 -0
  73. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/tests/test_generic.py +0 -0
  74. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/tests/test_seqfish.py +0 -0
  75. {spatialdata_io-0.2.0 → spatialdata_io-0.3.0}/tests/test_xenium.py +0 -0
@@ -14,7 +14,7 @@ jobs:
14
14
  runs-on: ubuntu-latest
15
15
 
16
16
  steps:
17
- - uses: actions/checkout@v3
17
+ - uses: actions/checkout@v4
18
18
 
19
19
  - name: Download test datasets
20
20
  run: |
@@ -9,9 +9,9 @@ jobs:
9
9
  runs-on: ubuntu-latest
10
10
  if: startsWith(github.ref, 'refs/tags/v')
11
11
  steps:
12
- - uses: actions/checkout@v3
12
+ - uses: actions/checkout@v4
13
13
  - name: Set up Python 3.12
14
- uses: actions/setup-python@v4
14
+ uses: actions/setup-python@v5
15
15
  with:
16
16
  python-version: "3.12"
17
17
  cache: pip
@@ -26,9 +26,9 @@ jobs:
26
26
  PYTHON: ${{ matrix.python }}
27
27
 
28
28
  steps:
29
- - uses: actions/checkout@v2
29
+ - uses: actions/checkout@v4
30
30
  - name: Set up Python ${{ matrix.python }}
31
- uses: actions/setup-python@v4
31
+ uses: actions/setup-python@v5
32
32
  with:
33
33
  python-version: ${{ matrix.python }}
34
34
 
@@ -37,7 +37,7 @@ jobs:
37
37
  run: |
38
38
  echo "::set-output name=dir::$(pip cache dir)"
39
39
  - name: Restore pip cache
40
- uses: actions/cache@v3
40
+ uses: actions/cache@v4
41
41
  with:
42
42
  path: ${{ steps.pip-cache-dir.outputs.dir }}
43
43
  key: pip-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml') }}
@@ -0,0 +1,43 @@
1
+ fail_fast: false
2
+ default_language_version:
3
+ python: python3
4
+ default_stages:
5
+ - pre-commit
6
+ - pre-push
7
+ minimum_pre_commit_version: 2.16.0
8
+ repos:
9
+ - repo: https://github.com/rbubley/mirrors-prettier
10
+ rev: v3.6.2
11
+ hooks:
12
+ - id: prettier
13
+ - repo: https://github.com/astral-sh/ruff-pre-commit
14
+ rev: v0.12.8
15
+ hooks:
16
+ - id: ruff
17
+ args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes]
18
+ - id: ruff-format
19
+ - repo: https://github.com/pre-commit/mirrors-mypy
20
+ rev: v1.17.1
21
+ hooks:
22
+ - id: mypy
23
+ additional_dependencies: [numpy, types-PyYAML]
24
+ exclude: docs/
25
+ - repo: https://github.com/pre-commit/pre-commit-hooks
26
+ rev: v6.0.0
27
+ hooks:
28
+ - id: detect-private-key
29
+ - id: check-ast
30
+ - id: end-of-file-fixer
31
+ - id: mixed-line-ending
32
+ args: [--fix=lf]
33
+ - id: trailing-whitespace
34
+ - id: check-case-conflict
35
+ - repo: local
36
+ hooks:
37
+ - id: forbid-to-commit
38
+ name: Don't commit rej files
39
+ entry: |
40
+ Cannot commit .rej files. These indicate merge conflicts that arise during automated template updates.
41
+ Fix the merge conflicts manually and remove the .rej files.
42
+ language: fail
43
+ files: '.*\.rej$'
@@ -1,9 +1,8 @@
1
- # https://docs.readthedocs.io/en/stable/config-file/v2.html
2
1
  version: 2
3
2
  build:
4
- os: ubuntu-20.04
3
+ os: ubuntu-24.04
5
4
  tools:
6
- python: "3.10"
5
+ python: "3.12"
7
6
  sphinx:
8
7
  configuration: docs/conf.py
9
8
  fail_on_warning: true
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spatialdata-io
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: SpatialData IO for common techs
5
5
  Project-URL: Documentation, https://spatialdata-io.readthedocs.io/
6
6
  Project-URL: Source, https://github.com/scverse/spatialdata-io
@@ -66,7 +66,7 @@ Requires-Dist: sphinx-design; extra == 'doc'
66
66
  Requires-Dist: sphinx>=4.5; extra == 'doc'
67
67
  Requires-Dist: sphinxcontrib-bibtex>=1.0.0; extra == 'doc'
68
68
  Provides-Extra: pre
69
- Requires-Dist: spatialdata>=0.1.0-pre0; extra == 'pre'
69
+ Requires-Dist: spatialdata>=0.4.0rc0; extra == 'pre'
70
70
  Provides-Extra: test
71
71
  Requires-Dist: pytest; extra == 'test'
72
72
  Requires-Dist: pytest-cov; extra == 'test'
@@ -79,10 +79,14 @@ Description-Content-Type: text/markdown
79
79
  [![Tests][badge-tests]][link-tests]
80
80
  [![Documentation][badge-docs]][link-docs]
81
81
  [![DOI](https://zenodo.org/badge/544045123.svg)](https://zenodo.org/badge/latestdoi/544045123)
82
+ [![Documentation][badge-pypi]][link-pypi]
83
+ [![Anaconda-Server Badge](https://anaconda.org/conda-forge/spatialdata-io/badges/version.svg)](https://anaconda.org/conda-forge/spatialdata-io)
82
84
 
83
85
  [badge-tests]: https://github.com/scverse/spatialdata-io/actions/workflows/test.yaml/badge.svg
84
86
  [link-tests]: https://github.com/scverse/spatialdata-io/actions/workflows/test.yaml
85
87
  [badge-docs]: https://img.shields.io/readthedocs/spatialdata-io
88
+ [badge-pypi]: https://badge.fury.io/py/spatialdata-io.svg
89
+ [link-pypi]: https://pypi.org/project/spatialdata-io/
86
90
 
87
91
  This package contains reader functions to load common spatial omics formats into SpatialData. Currently, we provide support for:
88
92
 
@@ -5,10 +5,14 @@
5
5
  [![Tests][badge-tests]][link-tests]
6
6
  [![Documentation][badge-docs]][link-docs]
7
7
  [![DOI](https://zenodo.org/badge/544045123.svg)](https://zenodo.org/badge/latestdoi/544045123)
8
+ [![Documentation][badge-pypi]][link-pypi]
9
+ [![Anaconda-Server Badge](https://anaconda.org/conda-forge/spatialdata-io/badges/version.svg)](https://anaconda.org/conda-forge/spatialdata-io)
8
10
 
9
11
  [badge-tests]: https://github.com/scverse/spatialdata-io/actions/workflows/test.yaml/badge.svg
10
12
  [link-tests]: https://github.com/scverse/spatialdata-io/actions/workflows/test.yaml
11
13
  [badge-docs]: https://img.shields.io/readthedocs/spatialdata-io
14
+ [badge-pypi]: https://badge.fury.io/py/spatialdata-io.svg
15
+ [link-pypi]: https://pypi.org/project/spatialdata-io/
12
16
 
13
17
  This package contains reader functions to load common spatial omics formats into SpatialData. Currently, we provide support for:
14
18
 
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.2.0'
21
- __version_tuple__ = version_tuple = (0, 2, 0)
20
+ __version__ = version = '0.3.0'
21
+ __version_tuple__ = version_tuple = (0, 3, 0)
@@ -9,6 +9,7 @@ import sys
9
9
  from datetime import datetime
10
10
  from importlib.metadata import metadata
11
11
  from pathlib import Path
12
+
12
13
  import spatialdata_io.experimental
13
14
 
14
15
  _ = spatialdata_io.experimental
@@ -11,7 +11,7 @@ def _process_return(lines):
11
11
  m = re.fullmatch(r"(?P<param>\w+)\s+:\s+(?P<type>[\w.]+)", line)
12
12
  if m:
13
13
  # Once this is in scanpydoc, we can use the fancy hover stuff
14
- yield f'-{m["param"]} (:class:`~{m["type"]}`)'
14
+ yield f"-{m['param']} (:class:`~{m['type']}`)"
15
15
  else:
16
16
  yield line
17
17
 
@@ -0,0 +1,199 @@
1
+ [build-system]
2
+ build-backend = "hatchling.build"
3
+ requires = ["hatchling", "hatch-vcs"]
4
+
5
+
6
+ [project]
7
+ name = "spatialdata-io"
8
+ dynamic= [
9
+ "version" # allow version to be set by git tags
10
+ ]
11
+ description = "SpatialData IO for common techs"
12
+ readme = "README.md"
13
+ requires-python = ">=3.10"
14
+ license = {file = "LICENSE"}
15
+ authors = [
16
+ {name = "scverse"},
17
+ ]
18
+ maintainers = [
19
+ {name = "scverse", email = "scverse@scverse.scverse"},
20
+ ]
21
+ urls.Documentation = "https://spatialdata-io.readthedocs.io/"
22
+ urls.Source = "https://github.com/scverse/spatialdata-io"
23
+ urls.Home-page = "https://github.com/scverse/spatialdata-io"
24
+ dependencies = [
25
+ "anndata",
26
+ "click",
27
+ "numpy",
28
+ "scanpy",
29
+ "spatialdata>=0.2.6",
30
+ "scikit-image",
31
+ "h5py",
32
+ "joblib",
33
+ "imagecodecs",
34
+ "dask-image",
35
+ "pyarrow",
36
+ "readfcs",
37
+ "tifffile>=2023.8.12",
38
+ "ome-types",
39
+ ]
40
+
41
+ [project.optional-dependencies]
42
+ dev = [
43
+ # CLI for bumping the version number
44
+ "bump2version",
45
+ "pre-commit"
46
+ ]
47
+ doc = [
48
+ "sphinx>=4.5",
49
+ "sphinx-book-theme>=1.0.0",
50
+ "myst-nb",
51
+ "sphinxcontrib-bibtex>=1.0.0",
52
+ "sphinx-autodoc-typehints",
53
+ "sphinx-design",
54
+ "sphinx-click",
55
+ # For notebooks
56
+ "ipython>=8.6.0",
57
+ "sphinx-copybutton",
58
+ ]
59
+ test = [
60
+ "pytest",
61
+ "pytest-cov",
62
+ ]
63
+ # this will be used by readthedocs and will make pip also look for pre-releases, generally installing the latest available version
64
+ # update: readthedocs doens't seem to try to install pre-releases even if when trying to install the pre optional-dependency. For
65
+ # the moment, if needed, let's add the latest pre-release explicitly here.
66
+ pre = [
67
+ "spatialdata>=0.4.0rc0"
68
+ ]
69
+
70
+ [tool.coverage.run]
71
+ source = ["spatialdata_io"]
72
+ omit = [
73
+ "**/test_*.py",
74
+ ]
75
+
76
+ [tool.pytest.ini_options]
77
+ testpaths = ["tests"]
78
+ xfail_strict = true
79
+ addopts = [
80
+ "--import-mode=importlib", # allow using test files with same name
81
+ ]
82
+
83
+ [tool.ruff]
84
+ line-length = 120
85
+ exclude = [
86
+ ".git",
87
+ ".tox",
88
+ "__pycache__",
89
+ "build",
90
+ "docs/_build",
91
+ "dist",
92
+ "setup.py",
93
+ ]
94
+ lint.select = [
95
+ "F", # Errors detected by Pyflakes
96
+ "E", # Error detected by Pycodestyle
97
+ "W", # Warning detected by Pycodestyle
98
+ "I", # isort
99
+ "D", # pydocstyle
100
+ "B", # flake8-bugbear
101
+ "TID", # flake8-tidy-imports
102
+ "C4", # flake8-comprehensions
103
+ "BLE", # flake8-blind-except
104
+ "UP", # pyupgrade
105
+ "RUF100", # Report unused noqa directives
106
+ "TCH", # Typing imports
107
+ "NPY", # Numpy specific rules
108
+ # "PTH", # Use pathlib
109
+ # "S" # Security
110
+ ]
111
+ lint.ignore = [
112
+ # Do not catch blind exception: `Exception`
113
+ "BLE001",
114
+ # Errors from function calls in argument defaults. These are fine when the result is immutable.
115
+ "B008",
116
+ # line too long -> we accept long comment lines; black gets rid of long code lines
117
+ "E501",
118
+ # Do not assign a lambda expression, use a def -> lambda expression assignments are convenient
119
+ "E731",
120
+ # allow I, O, l as variable names -> I is the identity matrix
121
+ "E741",
122
+ # Missing docstring in public module
123
+ "D100",
124
+ # undocumented-public-class
125
+ "D101",
126
+ # Missing docstring in public method
127
+ "D102",
128
+ # Missing docstring in public function
129
+ "D103",
130
+ # Missing docstring in public package
131
+ "D104",
132
+ # __magic__ methods are are often self-explanatory, allow missing docstrings
133
+ "D105",
134
+ # Missing docstring in public nested class
135
+ "D106",
136
+ # Missing docstring in __init__
137
+ "D107",
138
+ ## Disable one in each pair of mutually incompatible rules
139
+ # We don’t want a blank line before a class docstring
140
+ "D203",
141
+ # 1 blank line required after class docstring
142
+ "D204",
143
+ # first line should end with a period [Bug: doesn't work with single-line docstrings]
144
+ # We want docstrings to start immediately after the opening triple quote
145
+ "D213",
146
+ # Section underline is over-indented ("{name}")
147
+ "D215",
148
+ # First line should be in imperative mood; try rephrasing
149
+ "D401",
150
+ # First word of the first line should be capitalized: {} -> {}
151
+ "D403",
152
+ # First word of the docstring should not be "This"
153
+ "D404",
154
+ # Section name should end with a newline ("{name}")
155
+ "D406",
156
+ # Missing dashed underline after section ("{name}")
157
+ "D407",
158
+ # Section underline should be in the line following the section's name ("{name}")
159
+ "D408",
160
+ # Section underline should match the length of its name ("{name}")
161
+ "D409",
162
+ # No blank lines allowed between a section header and its content ("{name}")
163
+ "D412",
164
+ # Missing blank line after last section ("{name}")
165
+ "D413",
166
+ # Missing argument description in the docstring
167
+ "D417",
168
+ # camcelcase imported as lowercase
169
+ "N813",
170
+ # module import not at top level of file
171
+ "E402",
172
+ # open()` should be replaced by `Path.open()
173
+ "PTH123",
174
+ # subprocess` call: check for execution of untrusted input - https://github.com/PyCQA/bandit/issues/333
175
+ "S603",
176
+ # Starting a process with a partial executable path
177
+ "S607",
178
+ # Prefer absolute imports over relative imports from parent modules
179
+ "TID252",
180
+ # Standard pseudo-random generators are not suitable for cryptographic purposes
181
+ "S311",
182
+ # Unused imports
183
+ "F401",
184
+ ]
185
+
186
+ [tool.jupytext]
187
+ formats = "ipynb,md"
188
+
189
+ [tool.hatch.metadata]
190
+ allow-direct-references = true
191
+
192
+ [tool.hatch.build.targets.wheel]
193
+ packages = ['src/spatialdata_io']
194
+
195
+ [tool.hatch.version]
196
+ source = "vcs"
197
+
198
+ [tool.hatch.build.hooks.vcs]
199
+ version-file = "_version.py"
@@ -29,8 +29,7 @@ for func in _experimental_readers_technologies + _experimental_readers_file_type
29
29
 
30
30
  @click.group()
31
31
  def cli() -> None:
32
- """
33
- Convert standard technology data formats to SpatialData object.
32
+ """Convert standard technology data formats to SpatialData object.
34
33
 
35
34
  Usage:
36
35
 
@@ -66,7 +65,7 @@ def _input_output_click_options(func: Callable[..., None]) -> Callable[..., None
66
65
  help="Whether the .fcs file is provided if False a .csv file is expected. [default: True]",
67
66
  )
68
67
  def codex_wrapper(input: str, output: str, fcs: bool = True) -> None:
69
- """Codex conversion to SpatialData"""
68
+ """Codex conversion to SpatialData."""
70
69
  sdata = codex(input, fcs=fcs) # type: ignore[name-defined] # noqa: F821
71
70
  sdata.write(output)
72
71
 
@@ -76,7 +75,7 @@ def codex_wrapper(input: str, output: str, fcs: bool = True) -> None:
76
75
  @click.option("--dataset-id", type=str, default=None, help="Name of the dataset [default: None]")
77
76
  @click.option("--transcripts", type=bool, default=True, help="Whether to load transcript information. [default: True]")
78
77
  def cosmx_wrapper(input: str, output: str, dataset_id: str | None = None, transcripts: bool = True) -> None:
79
- """Cosmic conversion to SpatialData"""
78
+ """Cosmic conversion to SpatialData."""
80
79
  sdata = cosmx(input, dataset_id=dataset_id, transcripts=transcripts) # type: ignore[name-defined] # noqa: F821
81
80
  sdata.write(output)
82
81
 
@@ -84,7 +83,7 @@ def cosmx_wrapper(input: str, output: str, dataset_id: str | None = None, transc
84
83
  @cli.command(name="curio")
85
84
  @_input_output_click_options
86
85
  def curio_wrapper(input: str, output: str) -> None:
87
- """Curio conversion to SpatialData"""
86
+ """Curio conversion to SpatialData."""
88
87
  sdata = curio(input) # type: ignore[name-defined] # noqa: F821
89
88
  sdata.write(output)
90
89
 
@@ -117,7 +116,7 @@ def dbit_wrapper(
117
116
  border: bool = True,
118
117
  border_scale: float = 1,
119
118
  ) -> None:
120
- """Conversion of DBit-seq to SpatialData"""
119
+ """Conversion of DBit-seq to SpatialData."""
121
120
  sdata = dbit( # type: ignore[name-defined] # noqa: F821
122
121
  input,
123
122
  anndata_path=anndata_path,
@@ -174,7 +173,7 @@ def iss_wrapper(
174
173
  multiscale_image: bool = True,
175
174
  multiscale_labels: bool = True,
176
175
  ) -> None:
177
- """ISS conversion to SpatialData"""
176
+ """ISS conversion to SpatialData."""
178
177
  sdata = iss( # type: ignore[name-defined] # noqa: F821
179
178
  input,
180
179
  raw_relative_path,
@@ -194,7 +193,7 @@ def iss_wrapper(
194
193
  )
195
194
  @click.option("--output", "-o", type=click.Path(), help="Path to the output.zarr file.", required=True)
196
195
  def mcmicro_wrapper(input: str, output: str) -> None:
197
- """Conversion of MCMicro to SpatialData"""
196
+ """Conversion of MCMicro to SpatialData."""
198
197
  sdata = mcmicro(input) # type: ignore[name-defined] # noqa: F821
199
198
  sdata.write(output)
200
199
 
@@ -233,7 +232,7 @@ def merscope_wrapper(
233
232
  cells_table: bool = True,
234
233
  mosaic_images: bool = True,
235
234
  ) -> None:
236
- """Merscope conversion to SpatialData"""
235
+ """Merscope conversion to SpatialData."""
237
236
  sdata = merscope( # type: ignore[name-defined] # noqa: F821
238
237
  input,
239
238
  vpt_outputs=vpt_outputs,
@@ -273,7 +272,7 @@ def seqfish_wrapper(
273
272
  cells_as_circles: bool = False,
274
273
  rois: list[int] | None = None,
275
274
  ) -> None:
276
- """Seqfish conversion to SpatialData"""
275
+ """Seqfish conversion to SpatialData."""
277
276
  rois = list(rois) if rois else None
278
277
  sdata = seqfish( # type: ignore[name-defined] # noqa: F821
279
278
  input,
@@ -296,7 +295,7 @@ def seqfish_wrapper(
296
295
  help="What kind of labels to use. [default: 'deepcell']",
297
296
  )
298
297
  def steinbock_wrapper(input: str, output: str, labels_kind: Literal["deepcell", "ilastik"] = "deepcell") -> None:
299
- """Steinbock conversion to SpatialData"""
298
+ """Steinbock conversion to SpatialData."""
300
299
  sdata = steinbock(input, labels_kind=labels_kind) # type: ignore[name-defined] # noqa: F821
301
300
  sdata.write(output)
302
301
 
@@ -320,7 +319,7 @@ def stereoseq_wrapper(
320
319
  read_square_bin: bool = True,
321
320
  optional_tif: bool = False,
322
321
  ) -> None:
323
- """Stereoseq conversion to SpatialData"""
322
+ """Stereoseq conversion to SpatialData."""
324
323
  sdata = stereoseq(input, dataset_id=dataset_id, read_square_bin=read_square_bin, optional_tif=optional_tif) # type: ignore[name-defined] # noqa: F821
325
324
  sdata.write(output)
326
325
 
@@ -361,7 +360,7 @@ def visium_wrapper(
361
360
  tissue_positions_file: str | Path | None = None,
362
361
  scalefactors_file: str | Path | None = None,
363
362
  ) -> None:
364
- """Visium conversion to SpatialData"""
363
+ """Visium conversion to SpatialData."""
365
364
  sdata = visium( # type: ignore[name-defined] # noqa: F821
366
365
  input,
367
366
  dataset_id=dataset_id,
@@ -424,7 +423,7 @@ def visium_hd_wrapper(
424
423
  load_all_images: bool = False,
425
424
  annotate_table_by_labels: bool = False,
426
425
  ) -> None:
427
- """Visium HD conversion to SpatialData"""
426
+ """Visium HD conversion to SpatialData."""
428
427
  sdata = visium_hd( # type: ignore[name-defined] # noqa: F821
429
428
  path=input,
430
429
  dataset_id=dataset_id,
@@ -483,7 +482,7 @@ def xenium_wrapper(
483
482
  cells_table: bool = True,
484
483
  n_jobs: int = 1,
485
484
  ) -> None:
486
- """Xenium conversion to SpatialData"""
485
+ """Xenium conversion to SpatialData."""
487
486
  sdata = xenium( # type: ignore[name-defined] # noqa: F821
488
487
  input,
489
488
  cells_boundaries=cells_boundaries,
@@ -637,7 +636,7 @@ def read_generic_wrapper(
637
636
  data_axes: str | None = None,
638
637
  coordinate_system: str | None = None,
639
638
  ) -> None:
640
- """Read generic data to SpatialData"""
639
+ """Read generic data to SpatialData."""
641
640
  if data_axes is not None and "".join(sorted(data_axes)) not in ["cxy", "cxyz"]:
642
641
  raise ValueError("data_axes must be a permutation of 'cyx' or 'czyx'.")
643
642
  generic_to_zarr(input=input, output=output, name=name, data_axes=data_axes, coordinate_system=coordinate_system)
@@ -301,7 +301,7 @@ class McmicroKeys(ModeEnum):
301
301
 
302
302
  @unique
303
303
  class MerscopeKeys(ModeEnum):
304
- """Keys for *MERSCOPE* data (Vizgen plateform)"""
304
+ """Keys for *MERSCOPE* data (Vizgen plateform)."""
305
305
 
306
306
  # files and directories
307
307
  IMAGES_DIR = "images"
@@ -42,7 +42,7 @@ def _pretty_raise_enum(cls: type["ErrorFormatterABC"], func: Callable[..., Any])
42
42
  class ABCEnumMeta(EnumMeta, ABCMeta):
43
43
  def __call__(cls, *args: Any, **kwargs: Any) -> Any:
44
44
  if getattr(cls, "__error_format__", None) is None:
45
- raise TypeError(f"Can't instantiate class `{cls.__name__}` " f"without `__error_format__` class attribute.")
45
+ raise TypeError(f"Can't instantiate class `{cls.__name__}` without `__error_format__` class attribute.")
46
46
  return super().__call__(*args, **kwargs)
47
47
 
48
48
  def __new__(cls, clsname: str, superclasses: tuple[type], attributedict: dict[str, Any]) -> "ABCEnumMeta":
@@ -51,7 +51,7 @@ class ABCEnumMeta(EnumMeta, ABCMeta):
51
51
  return res
52
52
 
53
53
 
54
- class ErrorFormatterABC(ABC):
54
+ class ErrorFormatterABC(ABC): # noqa
55
55
  """Mixin class that formats invalid value when constructing an enum."""
56
56
 
57
57
  __error_format__ = "Invalid option `{0}` for `{1}`. Valid options are: `{2}`."
@@ -59,7 +59,9 @@ class ErrorFormatterABC(ABC):
59
59
  @classmethod
60
60
  def _format(cls, value: Enum) -> str:
61
61
  return cls.__error_format__.format(
62
- value, cls.__name__, [m.value for m in cls.__members__.values()] # type: ignore[attr-defined]
62
+ value,
63
+ cls.__name__,
64
+ [m.value for m in cls.__members__.values()], # type: ignore[attr-defined]
63
65
  )
64
66
 
65
67
 
@@ -1,11 +1,13 @@
1
1
  from __future__ import annotations
2
2
 
3
- from collections.abc import Callable
4
3
  from textwrap import dedent
5
- from typing import Any
4
+ from typing import TYPE_CHECKING, Any
6
5
 
6
+ if TYPE_CHECKING:
7
+ from collections.abc import Callable
7
8
 
8
- def inject_docs(**kwargs: Any) -> Callable[..., Any]: # noqa: D103
9
+
10
+ def inject_docs(**kwargs: Any) -> Callable[..., Any]:
9
11
  # taken from scanpy
10
12
  def decorator(obj: Any) -> Any:
11
13
  obj.__doc__ = dedent(obj.__doc__).format(**kwargs)
@@ -2,8 +2,10 @@ from __future__ import annotations
2
2
 
3
3
  import functools
4
4
  import warnings
5
- from collections.abc import Callable
6
- from typing import Any, TypeVar
5
+ from typing import TYPE_CHECKING, Any, TypeVar
6
+
7
+ if TYPE_CHECKING:
8
+ from collections.abc import Callable
7
9
 
8
10
  RT = TypeVar("RT")
9
11
 
@@ -11,8 +13,7 @@ RT = TypeVar("RT")
11
13
  # these two functions should be removed and imported from spatialdata._utils once the multi_table branch, which
12
14
  # introduces them, is merged
13
15
  def deprecation_alias(**aliases: str) -> Callable[[Callable[..., RT]], Callable[..., RT]]:
14
- """
15
- Decorate a function to warn user of use of arguments set for deprecation.
16
+ """Decorate a function to warn user of use of arguments set for deprecation.
16
17
 
17
18
  Parameters
18
19
  ----------
@@ -21,8 +21,7 @@ def generic_to_zarr(
21
21
  data_axes: str | None = None,
22
22
  coordinate_system: str | None = None,
23
23
  ) -> None:
24
- """
25
- Read generic data from an input file and save it as a SpatialData zarr store.
24
+ """Read generic data from an input file and save it as a SpatialData zarr store.
26
25
 
27
26
  Parameters
28
27
  ----------