napari-memmap-tiff 1.0.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.
@@ -0,0 +1,91 @@
1
+ # This workflows will upload a Python Package using Twine when a release is created
2
+ # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3
+
4
+ name: tests
5
+
6
+ on:
7
+ push:
8
+ branches:
9
+ - main
10
+ - npe2
11
+ tags:
12
+ - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
13
+ pull_request:
14
+ branches:
15
+ - main
16
+ - npe2
17
+ workflow_dispatch:
18
+
19
+ jobs:
20
+ test:
21
+ name: ${{ matrix.platform }} py${{ matrix.python-version }}
22
+ runs-on: ${{ matrix.platform }}
23
+ timeout-minutes: 30
24
+ strategy:
25
+ matrix:
26
+ platform: [ubuntu-latest, windows-latest, macos-latest]
27
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
28
+
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+
32
+ - name: Set up Python ${{ matrix.python-version }}
33
+ uses: actions/setup-python@v5
34
+ with:
35
+ python-version: ${{ matrix.python-version }}
36
+
37
+ # these libraries enable testing on Qt on linux
38
+ - uses: tlambert03/setup-qt-libs@v1
39
+
40
+ # strategy borrowed from vispy for installing opengl libs on windows
41
+ - name: Install Windows OpenGL
42
+ if: runner.os == 'Windows'
43
+ run: |
44
+ git clone --depth 1 https://github.com/pyvista/gl-ci-helpers.git
45
+ powershell gl-ci-helpers/appveyor/install_opengl.ps1
46
+
47
+ # note: if you need dependencies from conda, considering using
48
+ # setup-miniconda: https://github.com/conda-incubator/setup-miniconda
49
+ # and
50
+ # tox-conda: https://github.com/tox-dev/tox-conda
51
+ - name: Install dependencies
52
+ run: |
53
+ python -m pip install --upgrade pip
54
+ python -m pip install setuptools tox tox-gh-actions
55
+
56
+ # this runs the platform-specific tests declared in tox.ini
57
+ - name: Test with tox
58
+ uses: aganders3/headless-gui@v2
59
+ with:
60
+ run: python -m tox
61
+ env:
62
+ PLATFORM: ${{ matrix.platform }}
63
+
64
+ - name: Coverage
65
+ uses: codecov/codecov-action@v3
66
+
67
+ deploy:
68
+ # this will run when you have tagged a commit, starting with "v*"
69
+ # and requires that you have put your twine API key in your
70
+ # github secrets (see readme for details)
71
+ needs: [test]
72
+ runs-on: ubuntu-latest
73
+ if: contains(github.ref, 'tags')
74
+ steps:
75
+ - uses: actions/checkout@v4
76
+ - name: Set up Python
77
+ uses: actions/setup-python@v5
78
+ with:
79
+ python-version: "3.x"
80
+ - name: Install dependencies
81
+ run: |
82
+ python -m pip install --upgrade pip
83
+ pip install -U setuptools setuptools_scm wheel twine build
84
+ - name: Build and publish
85
+ env:
86
+ TWINE_USERNAME: __token__
87
+ TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
88
+ run: |
89
+ git tag
90
+ python -m build .
91
+ twine upload dist/*
@@ -0,0 +1,84 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ env/
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ *.egg-info/
24
+ .installed.cfg
25
+ *.egg
26
+
27
+ # PyInstaller
28
+ # Usually these files are written by a python script from a template
29
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
30
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .coverage
41
+ .coverage.*
42
+ .cache
43
+ nosetests.xml
44
+ coverage.xml
45
+ *,cover
46
+ .hypothesis/
47
+ .napari_cache
48
+
49
+ # Translations
50
+ *.mo
51
+ *.pot
52
+
53
+ # Django stuff:
54
+ *.log
55
+ local_settings.py
56
+
57
+ # Flask instance folder
58
+ instance/
59
+
60
+ # Sphinx documentation
61
+ docs/_build/
62
+
63
+ # MkDocs documentation
64
+ /site/
65
+
66
+ # PyBuilder
67
+ target/
68
+
69
+ # Pycharm and VSCode
70
+ .idea/
71
+ venv/
72
+ .vscode/
73
+
74
+ # IPython Notebook
75
+ .ipynb_checkpoints
76
+
77
+ # pyenv
78
+ .python-version
79
+
80
+ # OS
81
+ .DS_Store
82
+
83
+ # written by setuptools_scm
84
+ **/_version.py
@@ -0,0 +1,7 @@
1
+ When installed and enabled in the options, it adds an option that when enabled
2
+ will make napari load tiffs via memory mapping instead of fully into RAM.
3
+
4
+ That is, `.tif` and `.tiff` files will be loaded into memory using memory
5
+ mapping, which loads the data directly from disk instead of loading the file
6
+ at once into RAM. This is beneficial for large files that may not fit into
7
+ available RAM.
@@ -0,0 +1,9 @@
1
+ # You may use this file to customize how your plugin page appears
2
+ # on the napari hub: https://www.napari-hub.org/
3
+ # See their wiki for details https://github.com/chanzuckerberg/napari-hub/wiki
4
+
5
+ # Please note that this file should only be used IN ADDITION to entering
6
+ # metadata fields (such as summary, description, authors, and various URLS)
7
+ # in your standard python package metadata (e.g. setup.cfg, setup.py, or
8
+ # pyproject.toml), when you would like those fields to be displayed
9
+ # differently on the hub than in the napari application.
@@ -0,0 +1,27 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: check-docstring-first
6
+ - id: end-of-file-fixer
7
+ - id: trailing-whitespace
8
+ exclude: ^\.napari-hub/.*
9
+ - id: check-yaml # checks for correct yaml syntax for github actions ex.
10
+ - repo: https://github.com/astral-sh/ruff-pre-commit
11
+ rev: v0.11.13
12
+ hooks:
13
+ - id: ruff
14
+ - repo: https://github.com/psf/black
15
+ rev: 25.1.0
16
+ hooks:
17
+ - id: black
18
+ - repo: https://github.com/tlambert03/napari-plugin-checks
19
+ rev: v0.3.0
20
+ hooks:
21
+ - id: napari-plugin-checks
22
+ # https://mypy.readthedocs.io/en/stable/
23
+ # you may wish to add this as well!
24
+ # - repo: https://github.com/pre-commit/mirrors-mypy
25
+ # rev: v1.9.0
26
+ # hooks:
27
+ # - id: mypy
@@ -0,0 +1,22 @@
1
+
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2025 Matthew Einhorn
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
@@ -0,0 +1,5 @@
1
+ include LICENSE
2
+ include README.md
3
+
4
+ recursive-exclude * __pycache__
5
+ recursive-exclude * *.py[co]
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.4
2
+ Name: napari-memmap-tiff
3
+ Version: 1.0.0
4
+ Summary: When installed and enabled in the options, it adds an option that when enabled will make napari load tiffs via memory mapping instead of fully into RAM.
5
+ Author: Matthew Einhorn
6
+ Author-email: matt@einhorn.dev
7
+ License:
8
+ The MIT License (MIT)
9
+
10
+ Copyright (c) 2025 Matthew Einhorn
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in
20
+ all copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28
+ THE SOFTWARE.
29
+
30
+ Project-URL: Bug Tracker, https://github.com/matham/napari-memmap-tiff/issues
31
+ Project-URL: Documentation, https://github.com/matham/napari-memmap-tiff#README.md
32
+ Project-URL: Source Code, https://github.com/matham/napari-memmap-tiff
33
+ Project-URL: User Support, https://github.com/matham/napari-memmap-tiff/issues
34
+ Classifier: Development Status :: 2 - Pre-Alpha
35
+ Classifier: Framework :: napari
36
+ Classifier: Intended Audience :: Developers
37
+ Classifier: License :: OSI Approved :: MIT License
38
+ Classifier: Operating System :: OS Independent
39
+ Classifier: Programming Language :: Python
40
+ Classifier: Programming Language :: Python :: 3
41
+ Classifier: Programming Language :: Python :: 3 :: Only
42
+ Classifier: Programming Language :: Python :: 3.10
43
+ Classifier: Programming Language :: Python :: 3.11
44
+ Classifier: Programming Language :: Python :: 3.12
45
+ Classifier: Programming Language :: Python :: 3.13
46
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
47
+ Requires-Python: >=3.10
48
+ Description-Content-Type: text/markdown
49
+ License-File: LICENSE
50
+ Requires-Dist: numpy
51
+ Requires-Dist: magicgui
52
+ Requires-Dist: qtpy
53
+ Requires-Dist: scikit-image
54
+ Requires-Dist: tifffile
55
+ Provides-Extra: testing
56
+ Requires-Dist: tox; extra == "testing"
57
+ Requires-Dist: pytest; extra == "testing"
58
+ Requires-Dist: pytest-cov; extra == "testing"
59
+ Requires-Dist: pytest-qt; extra == "testing"
60
+ Requires-Dist: napari; extra == "testing"
61
+ Requires-Dist: pyqt5; extra == "testing"
62
+ Dynamic: license-file
63
+
64
+ # napari-memmap-tiff
65
+
66
+ [![License MIT](https://img.shields.io/pypi/l/napari-memmap-tiff.svg?color=green)](https://github.com/matham/napari-memmap-tiff/raw/main/LICENSE)
67
+ [![PyPI](https://img.shields.io/pypi/v/napari-memmap-tiff.svg?color=green)](https://pypi.org/project/napari-memmap-tiff)
68
+ [![Python Version](https://img.shields.io/pypi/pyversions/napari-memmap-tiff.svg?color=green)](https://python.org)
69
+ [![tests](https://github.com/matham/napari-memmap-tiff/workflows/tests/badge.svg)](https://github.com/matham/napari-memmap-tiff/actions)
70
+ [![codecov](https://codecov.io/gh/matham/napari-memmap-tiff/branch/main/graph/badge.svg)](https://codecov.io/gh/matham/napari-memmap-tiff)
71
+ [![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari-memmap-tiff)](https://napari-hub.org/plugins/napari-memmap-tiff)
72
+ [![npe2](https://img.shields.io/badge/plugin-npe2-blue?link=https://napari.org/stable/plugins/index.html)](https://napari.org/stable/plugins/index.html)
73
+ [![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json)](https://github.com/copier-org/copier)
74
+
75
+ When installed and enabled in the options, it adds an option that when enabled
76
+ will make napari load tiffs via memory mapping instead of fully into RAM.
77
+
78
+ That is, `.tif` and `.tiff` files will be loaded into memory using memory
79
+ mapping, which loads the data directly from disk instead of loading the file
80
+ at once into RAM. This is beneficial for large files that may not fit into
81
+ available RAM.
82
+
83
+ ----------------------------------
84
+
85
+ This [napari] plugin was generated with [copier] using the [napari-plugin-template].
86
+
87
+ <!--
88
+ Don't miss the full getting started guide to set up your new package:
89
+ https://github.com/napari/napari-plugin-template#getting-started
90
+
91
+ and review the napari docs for plugin developers:
92
+ https://napari.org/stable/plugins/index.html
93
+ -->
94
+
95
+ ## Installation
96
+
97
+ You can install `napari-memmap-tiff` via [pip]:
98
+
99
+ pip install napari-memmap-tiff
100
+
101
+
102
+
103
+ To install latest development version :
104
+
105
+ pip install git+https://github.com/matham/napari-memmap-tiff.git
106
+
107
+
108
+ ## Contributing
109
+
110
+ Contributions are very welcome. Tests can be run with [tox], please ensure
111
+ the coverage at least stays the same before you submit a pull request.
112
+
113
+ ## License
114
+
115
+ Distributed under the terms of the [MIT] license,
116
+ "napari-memmap-tiff" is free and open source software
117
+
118
+ ## Issues
119
+
120
+ If you encounter any problems, please [file an issue] along with a detailed description.
121
+
122
+ [napari]: https://github.com/napari/napari
123
+ [copier]: https://copier.readthedocs.io/en/stable/
124
+ [@napari]: https://github.com/napari
125
+ [MIT]: http://opensource.org/licenses/MIT
126
+ [BSD-3]: http://opensource.org/licenses/BSD-3-Clause
127
+ [GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt
128
+ [GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt
129
+ [Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0
130
+ [Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt
131
+ [napari-plugin-template]: https://github.com/napari/napari-plugin-template
132
+
133
+ [file an issue]: https://github.com/matham/napari-memmap-tiff/issues
134
+
135
+ [napari]: https://github.com/napari/napari
136
+ [tox]: https://tox.readthedocs.io/en/latest/
137
+ [pip]: https://pypi.org/project/pip/
138
+ [PyPI]: https://pypi.org/
@@ -0,0 +1,75 @@
1
+ # napari-memmap-tiff
2
+
3
+ [![License MIT](https://img.shields.io/pypi/l/napari-memmap-tiff.svg?color=green)](https://github.com/matham/napari-memmap-tiff/raw/main/LICENSE)
4
+ [![PyPI](https://img.shields.io/pypi/v/napari-memmap-tiff.svg?color=green)](https://pypi.org/project/napari-memmap-tiff)
5
+ [![Python Version](https://img.shields.io/pypi/pyversions/napari-memmap-tiff.svg?color=green)](https://python.org)
6
+ [![tests](https://github.com/matham/napari-memmap-tiff/workflows/tests/badge.svg)](https://github.com/matham/napari-memmap-tiff/actions)
7
+ [![codecov](https://codecov.io/gh/matham/napari-memmap-tiff/branch/main/graph/badge.svg)](https://codecov.io/gh/matham/napari-memmap-tiff)
8
+ [![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari-memmap-tiff)](https://napari-hub.org/plugins/napari-memmap-tiff)
9
+ [![npe2](https://img.shields.io/badge/plugin-npe2-blue?link=https://napari.org/stable/plugins/index.html)](https://napari.org/stable/plugins/index.html)
10
+ [![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json)](https://github.com/copier-org/copier)
11
+
12
+ When installed and enabled in the options, it adds an option that when enabled
13
+ will make napari load tiffs via memory mapping instead of fully into RAM.
14
+
15
+ That is, `.tif` and `.tiff` files will be loaded into memory using memory
16
+ mapping, which loads the data directly from disk instead of loading the file
17
+ at once into RAM. This is beneficial for large files that may not fit into
18
+ available RAM.
19
+
20
+ ----------------------------------
21
+
22
+ This [napari] plugin was generated with [copier] using the [napari-plugin-template].
23
+
24
+ <!--
25
+ Don't miss the full getting started guide to set up your new package:
26
+ https://github.com/napari/napari-plugin-template#getting-started
27
+
28
+ and review the napari docs for plugin developers:
29
+ https://napari.org/stable/plugins/index.html
30
+ -->
31
+
32
+ ## Installation
33
+
34
+ You can install `napari-memmap-tiff` via [pip]:
35
+
36
+ pip install napari-memmap-tiff
37
+
38
+
39
+
40
+ To install latest development version :
41
+
42
+ pip install git+https://github.com/matham/napari-memmap-tiff.git
43
+
44
+
45
+ ## Contributing
46
+
47
+ Contributions are very welcome. Tests can be run with [tox], please ensure
48
+ the coverage at least stays the same before you submit a pull request.
49
+
50
+ ## License
51
+
52
+ Distributed under the terms of the [MIT] license,
53
+ "napari-memmap-tiff" is free and open source software
54
+
55
+ ## Issues
56
+
57
+ If you encounter any problems, please [file an issue] along with a detailed description.
58
+
59
+ [napari]: https://github.com/napari/napari
60
+ [copier]: https://copier.readthedocs.io/en/stable/
61
+ [@napari]: https://github.com/napari
62
+ [MIT]: http://opensource.org/licenses/MIT
63
+ [BSD-3]: http://opensource.org/licenses/BSD-3-Clause
64
+ [GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt
65
+ [GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt
66
+ [Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0
67
+ [Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt
68
+ [napari-plugin-template]: https://github.com/napari/napari-plugin-template
69
+
70
+ [file an issue]: https://github.com/matham/napari-memmap-tiff/issues
71
+
72
+ [napari]: https://github.com/napari/napari
73
+ [tox]: https://tox.readthedocs.io/en/latest/
74
+ [pip]: https://pypi.org/project/pip/
75
+ [PyPI]: https://pypi.org/
@@ -0,0 +1,121 @@
1
+ [project]
2
+ name = "napari-memmap-tiff"
3
+ dynamic = ["version"]
4
+ description = "When installed and enabled in the options, it adds an option that when enabled will make napari load tiffs via memory mapping instead of fully into RAM."
5
+ readme = "README.md"
6
+ license = {file = "LICENSE"}
7
+ authors = [
8
+ {name = "Matthew Einhorn"},
9
+ {email = "matt@einhorn.dev"},
10
+ ]
11
+ classifiers = [
12
+ "Development Status :: 2 - Pre-Alpha",
13
+ "Framework :: napari",
14
+ "Intended Audience :: Developers",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Operating System :: OS Independent",
17
+ "Programming Language :: Python",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3 :: Only",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Topic :: Scientific/Engineering :: Image Processing",
25
+ ]
26
+ requires-python = ">=3.10"
27
+ dependencies = [
28
+ "numpy",
29
+ "magicgui",
30
+ "qtpy",
31
+ "scikit-image",
32
+ "tifffile",
33
+ ]
34
+
35
+ [project.optional-dependencies]
36
+ testing = [
37
+ "tox",
38
+ "pytest", # https://docs.pytest.org/en/latest/contents.html
39
+ "pytest-cov", # https://pytest-cov.readthedocs.io/en/latest/
40
+ "pytest-qt", # https://pytest-qt.readthedocs.io/en/latest/
41
+ "napari",
42
+ "pyqt5",
43
+ ]
44
+
45
+ [project.entry-points."napari.manifest"]
46
+ napari-memmap-tiff = "napari_memmap_tiff:napari.yaml"
47
+
48
+ [project.urls]
49
+ "Bug Tracker" = "https://github.com/matham/napari-memmap-tiff/issues"
50
+ "Documentation" = "https://github.com/matham/napari-memmap-tiff#README.md"
51
+ "Source Code" = "https://github.com/matham/napari-memmap-tiff"
52
+ "User Support" = "https://github.com/matham/napari-memmap-tiff/issues"
53
+
54
+ [build-system]
55
+ requires = ["setuptools>=42.0.0", "wheel", "setuptools_scm"]
56
+ build-backend = "setuptools.build_meta"
57
+
58
+ [tool.setuptools]
59
+ include-package-data = true
60
+
61
+ [tool.setuptools.packages.find]
62
+ where = ["src"]
63
+
64
+ [tool.setuptools.package-data]
65
+ "*" = ["*.yaml"]
66
+
67
+
68
+ [tool.setuptools_scm]
69
+ write_to = "src/napari_memmap_tiff/_version.py"
70
+ fallback_version = "0.0.1+nogit"
71
+
72
+
73
+ [tool.black]
74
+ line-length = 79
75
+ target-version = ['py310', 'py311', 'py312', 'py313']
76
+
77
+ [tool.ruff]
78
+ line-length = 79
79
+ lint.select = [
80
+ "E", "F", "W", #flake8
81
+ "UP", # pyupgrade
82
+ "I", # isort
83
+ "BLE", # flake8-blind-exception
84
+ "B", # flake8-bugbear
85
+ "A", # flake8-builtins
86
+ "C4", # flake8-comprehensions
87
+ "ISC", # flake8-implicit-str-concat
88
+ "G", # flake8-logging-format
89
+ "PIE", # flake8-pie
90
+ "SIM", # flake8-simplify
91
+ ]
92
+ lint.ignore = [
93
+ "E501", # line too long. let black handle this
94
+ "UP006", "UP007", # type annotation. As using magicgui require runtime type annotation then we disable this.
95
+ "SIM117", # flake8-simplify - some of merged with statements are not looking great with black, reanble after drop python 3.9
96
+ ]
97
+
98
+ exclude = [
99
+ ".bzr",
100
+ ".direnv",
101
+ ".eggs",
102
+ ".git",
103
+ ".mypy_cache",
104
+ ".pants.d",
105
+ ".ruff_cache",
106
+ ".svn",
107
+ ".tox",
108
+ ".venv",
109
+ "__pypackages__",
110
+ "_build",
111
+ "buck-out",
112
+ "build",
113
+ "dist",
114
+ "node_modules",
115
+ "venv",
116
+ "*vendored*",
117
+ "*_vendor*",
118
+ ]
119
+
120
+ target-version = "py310"
121
+ fix = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,7 @@
1
+ try:
2
+ from ._version import version as __version__
3
+ except ImportError:
4
+ __version__ = "unknown"
5
+ from ._widget import memmap_config_widget
6
+
7
+ __all__ = ("memmap_config_widget",)
@@ -0,0 +1,12 @@
1
+ from napari_memmap_tiff._widget import memmap_config_widget
2
+
3
+
4
+ def test_memmap_config_widget():
5
+ from imageio.config.plugins import known_plugins
6
+
7
+ widget = memmap_config_widget()
8
+
9
+ widget(True)
10
+ assert "tifffile_memmap" in known_plugins
11
+ widget(False)
12
+ assert "tifffile_memmap" not in known_plugins
@@ -0,0 +1,21 @@
1
+ # file generated by setuptools-scm
2
+ # don't change, don't track in version control
3
+
4
+ __all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
5
+
6
+ TYPE_CHECKING = False
7
+ if TYPE_CHECKING:
8
+ from typing import Tuple
9
+ from typing import Union
10
+
11
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
12
+ else:
13
+ VERSION_TUPLE = object
14
+
15
+ version: str
16
+ __version__: str
17
+ __version_tuple__: VERSION_TUPLE
18
+ version_tuple: VERSION_TUPLE
19
+
20
+ __version__ = version = '1.0.0'
21
+ __version_tuple__ = version_tuple = (1, 0, 0)
@@ -0,0 +1,56 @@
1
+ from typing import TYPE_CHECKING
2
+
3
+ import numpy as np
4
+ from imageio.config.extensions import extension_list
5
+ from imageio.config.plugins import PluginConfig, known_plugins
6
+ from imageio.plugins.tifffile_v3 import TifffilePlugin
7
+ from magicgui import magic_factory
8
+
9
+ if TYPE_CHECKING:
10
+ pass
11
+
12
+
13
+ class MemmapTifffilePlugin(TifffilePlugin):
14
+
15
+ def read(self, *args, **kwargs) -> np.ndarray:
16
+ return super().read(*args, **kwargs, out="memmap")
17
+
18
+
19
+ @magic_factory(auto_call=True, persist=False)
20
+ def memmap_config_widget(
21
+ enable_memory_map: bool,
22
+ ) -> None:
23
+ """
24
+ Sets whether to use memory mapping.
25
+
26
+ :param enable_memory_map: If enabled, tiff or tif files will be loaded as
27
+ memory mapped data directly from disk, instead of loading it fully into
28
+ memory at once.
29
+ """
30
+ if enable_memory_map:
31
+ if "tifffile_memmap" in known_plugins:
32
+ return
33
+
34
+ known_plugins["tifffile_memmap"] = PluginConfig(
35
+ name="tifffile_memmap",
36
+ class_name="MemmapTifffilePlugin",
37
+ module_name="napari_memmap_tiff._widget",
38
+ is_legacy=False,
39
+ )
40
+ for ext in extension_list:
41
+ if (
42
+ ext.extension in (".tif", ".tiff")
43
+ and "tifffile_memmap" not in ext.priority
44
+ ):
45
+ ext.priority.insert(0, "tifffile_memmap")
46
+ else:
47
+ if "tifffile_memmap" not in known_plugins:
48
+ return
49
+
50
+ del known_plugins["tifffile_memmap"]
51
+ for ext in extension_list:
52
+ if (
53
+ ext.extension in (".tif", ".tiff")
54
+ and "tifffile_memmap" in ext.priority
55
+ ):
56
+ ext.priority.remove("tifffile_memmap")
@@ -0,0 +1,14 @@
1
+ name: napari-memmap-tiff
2
+ display_name: Loading tiffs using memory map
3
+ # use 'hidden' to remove plugin from napari hub search results
4
+ visibility: public
5
+ # see https://napari.org/stable/plugins/technical_references/manifest.html#fields for valid categories
6
+ categories: ["Annotation", "Segmentation", "Acquisition"]
7
+ contributions:
8
+ commands:
9
+ - id: napari-memmap-tiff.make_function_widget
10
+ python_name: napari_memmap_tiff:memmap_config_widget
11
+ title: Make memmap config widget
12
+ widgets:
13
+ - command: napari-memmap-tiff.make_function_widget
14
+ display_name: Enable / disable memory mapping tiffs
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.4
2
+ Name: napari-memmap-tiff
3
+ Version: 1.0.0
4
+ Summary: When installed and enabled in the options, it adds an option that when enabled will make napari load tiffs via memory mapping instead of fully into RAM.
5
+ Author: Matthew Einhorn
6
+ Author-email: matt@einhorn.dev
7
+ License:
8
+ The MIT License (MIT)
9
+
10
+ Copyright (c) 2025 Matthew Einhorn
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in
20
+ all copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28
+ THE SOFTWARE.
29
+
30
+ Project-URL: Bug Tracker, https://github.com/matham/napari-memmap-tiff/issues
31
+ Project-URL: Documentation, https://github.com/matham/napari-memmap-tiff#README.md
32
+ Project-URL: Source Code, https://github.com/matham/napari-memmap-tiff
33
+ Project-URL: User Support, https://github.com/matham/napari-memmap-tiff/issues
34
+ Classifier: Development Status :: 2 - Pre-Alpha
35
+ Classifier: Framework :: napari
36
+ Classifier: Intended Audience :: Developers
37
+ Classifier: License :: OSI Approved :: MIT License
38
+ Classifier: Operating System :: OS Independent
39
+ Classifier: Programming Language :: Python
40
+ Classifier: Programming Language :: Python :: 3
41
+ Classifier: Programming Language :: Python :: 3 :: Only
42
+ Classifier: Programming Language :: Python :: 3.10
43
+ Classifier: Programming Language :: Python :: 3.11
44
+ Classifier: Programming Language :: Python :: 3.12
45
+ Classifier: Programming Language :: Python :: 3.13
46
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
47
+ Requires-Python: >=3.10
48
+ Description-Content-Type: text/markdown
49
+ License-File: LICENSE
50
+ Requires-Dist: numpy
51
+ Requires-Dist: magicgui
52
+ Requires-Dist: qtpy
53
+ Requires-Dist: scikit-image
54
+ Requires-Dist: tifffile
55
+ Provides-Extra: testing
56
+ Requires-Dist: tox; extra == "testing"
57
+ Requires-Dist: pytest; extra == "testing"
58
+ Requires-Dist: pytest-cov; extra == "testing"
59
+ Requires-Dist: pytest-qt; extra == "testing"
60
+ Requires-Dist: napari; extra == "testing"
61
+ Requires-Dist: pyqt5; extra == "testing"
62
+ Dynamic: license-file
63
+
64
+ # napari-memmap-tiff
65
+
66
+ [![License MIT](https://img.shields.io/pypi/l/napari-memmap-tiff.svg?color=green)](https://github.com/matham/napari-memmap-tiff/raw/main/LICENSE)
67
+ [![PyPI](https://img.shields.io/pypi/v/napari-memmap-tiff.svg?color=green)](https://pypi.org/project/napari-memmap-tiff)
68
+ [![Python Version](https://img.shields.io/pypi/pyversions/napari-memmap-tiff.svg?color=green)](https://python.org)
69
+ [![tests](https://github.com/matham/napari-memmap-tiff/workflows/tests/badge.svg)](https://github.com/matham/napari-memmap-tiff/actions)
70
+ [![codecov](https://codecov.io/gh/matham/napari-memmap-tiff/branch/main/graph/badge.svg)](https://codecov.io/gh/matham/napari-memmap-tiff)
71
+ [![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari-memmap-tiff)](https://napari-hub.org/plugins/napari-memmap-tiff)
72
+ [![npe2](https://img.shields.io/badge/plugin-npe2-blue?link=https://napari.org/stable/plugins/index.html)](https://napari.org/stable/plugins/index.html)
73
+ [![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json)](https://github.com/copier-org/copier)
74
+
75
+ When installed and enabled in the options, it adds an option that when enabled
76
+ will make napari load tiffs via memory mapping instead of fully into RAM.
77
+
78
+ That is, `.tif` and `.tiff` files will be loaded into memory using memory
79
+ mapping, which loads the data directly from disk instead of loading the file
80
+ at once into RAM. This is beneficial for large files that may not fit into
81
+ available RAM.
82
+
83
+ ----------------------------------
84
+
85
+ This [napari] plugin was generated with [copier] using the [napari-plugin-template].
86
+
87
+ <!--
88
+ Don't miss the full getting started guide to set up your new package:
89
+ https://github.com/napari/napari-plugin-template#getting-started
90
+
91
+ and review the napari docs for plugin developers:
92
+ https://napari.org/stable/plugins/index.html
93
+ -->
94
+
95
+ ## Installation
96
+
97
+ You can install `napari-memmap-tiff` via [pip]:
98
+
99
+ pip install napari-memmap-tiff
100
+
101
+
102
+
103
+ To install latest development version :
104
+
105
+ pip install git+https://github.com/matham/napari-memmap-tiff.git
106
+
107
+
108
+ ## Contributing
109
+
110
+ Contributions are very welcome. Tests can be run with [tox], please ensure
111
+ the coverage at least stays the same before you submit a pull request.
112
+
113
+ ## License
114
+
115
+ Distributed under the terms of the [MIT] license,
116
+ "napari-memmap-tiff" is free and open source software
117
+
118
+ ## Issues
119
+
120
+ If you encounter any problems, please [file an issue] along with a detailed description.
121
+
122
+ [napari]: https://github.com/napari/napari
123
+ [copier]: https://copier.readthedocs.io/en/stable/
124
+ [@napari]: https://github.com/napari
125
+ [MIT]: http://opensource.org/licenses/MIT
126
+ [BSD-3]: http://opensource.org/licenses/BSD-3-Clause
127
+ [GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt
128
+ [GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt
129
+ [Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0
130
+ [Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt
131
+ [napari-plugin-template]: https://github.com/napari/napari-plugin-template
132
+
133
+ [file an issue]: https://github.com/matham/napari-memmap-tiff/issues
134
+
135
+ [napari]: https://github.com/napari/napari
136
+ [tox]: https://tox.readthedocs.io/en/latest/
137
+ [pip]: https://pypi.org/project/pip/
138
+ [PyPI]: https://pypi.org/
@@ -0,0 +1,22 @@
1
+ .gitignore
2
+ .pre-commit-config.yaml
3
+ LICENSE
4
+ MANIFEST.in
5
+ README.md
6
+ pyproject.toml
7
+ tox.ini
8
+ .github/workflows/test_and_deploy.yml
9
+ .napari-hub/DESCRIPTION.md
10
+ .napari-hub/config.yml
11
+ src/napari_memmap_tiff/__init__.py
12
+ src/napari_memmap_tiff/_version.py
13
+ src/napari_memmap_tiff/_widget.py
14
+ src/napari_memmap_tiff/napari.yaml
15
+ src/napari_memmap_tiff.egg-info/PKG-INFO
16
+ src/napari_memmap_tiff.egg-info/SOURCES.txt
17
+ src/napari_memmap_tiff.egg-info/dependency_links.txt
18
+ src/napari_memmap_tiff.egg-info/entry_points.txt
19
+ src/napari_memmap_tiff.egg-info/requires.txt
20
+ src/napari_memmap_tiff.egg-info/top_level.txt
21
+ src/napari_memmap_tiff/_tests/__init__.py
22
+ src/napari_memmap_tiff/_tests/test_widget.py
@@ -0,0 +1,2 @@
1
+ [napari.manifest]
2
+ napari-memmap-tiff = napari_memmap_tiff:napari.yaml
@@ -0,0 +1,13 @@
1
+ numpy
2
+ magicgui
3
+ qtpy
4
+ scikit-image
5
+ tifffile
6
+
7
+ [testing]
8
+ tox
9
+ pytest
10
+ pytest-cov
11
+ pytest-qt
12
+ napari
13
+ pyqt5
@@ -0,0 +1 @@
1
+ napari_memmap_tiff
@@ -0,0 +1,33 @@
1
+ # For more information about tox, see https://tox.readthedocs.io/en/latest/
2
+ [tox]
3
+ envlist = py{310,311,312,313}-{linux,macos,windows}
4
+ isolated_build=true
5
+
6
+ [gh-actions]
7
+ python =
8
+ 3.10: py310
9
+ 3.11: py311
10
+ 3.12: py312
11
+ 3.13: py313
12
+
13
+ [gh-actions:env]
14
+ PLATFORM =
15
+ ubuntu-latest: linux
16
+ macos-latest: macos
17
+ windows-latest: windows
18
+
19
+ [testenv]
20
+ platform =
21
+ macos: darwin
22
+ linux: linux
23
+ windows: win32
24
+ passenv =
25
+ CI
26
+ GITHUB_ACTIONS
27
+ DISPLAY
28
+ XAUTHORITY
29
+ NUMPY_EXPERIMENTAL_ARRAY_FUNCTION
30
+ PYVISTA_OFF_SCREEN
31
+ extras =
32
+ testing
33
+ commands = pytest -v --color=yes --cov=napari_memmap_tiff --cov-report=xml