tileupscale 0.6.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 (92) hide show
  1. tileupscale-0.6.0/LICENSE +21 -0
  2. tileupscale-0.6.0/NOTICE +6 -0
  3. tileupscale-0.6.0/PKG-INFO +172 -0
  4. tileupscale-0.6.0/README.md +101 -0
  5. tileupscale-0.6.0/pyproject.toml +103 -0
  6. tileupscale-0.6.0/setup.cfg +4 -0
  7. tileupscale-0.6.0/tests/test_about.py +72 -0
  8. tileupscale-0.6.0/tests/test_algorithms.py +235 -0
  9. tileupscale-0.6.0/tests/test_api.py +523 -0
  10. tileupscale-0.6.0/tests/test_api_queue_gpu_bench.py +131 -0
  11. tileupscale-0.6.0/tests/test_cancel.py +32 -0
  12. tileupscale-0.6.0/tests/test_checkpoint_quality.py +64 -0
  13. tileupscale-0.6.0/tests/test_cli.py +96 -0
  14. tileupscale-0.6.0/tests/test_compare_zip_api.py +159 -0
  15. tileupscale-0.6.0/tests/test_crop.py +92 -0
  16. tileupscale-0.6.0/tests/test_deep_review_fixes.py +163 -0
  17. tileupscale-0.6.0/tests/test_estimates.py +123 -0
  18. tileupscale-0.6.0/tests/test_filters.py +61 -0
  19. tileupscale-0.6.0/tests/test_help_security.py +61 -0
  20. tileupscale-0.6.0/tests/test_io.py +219 -0
  21. tileupscale-0.6.0/tests/test_locales.py +103 -0
  22. tileupscale-0.6.0/tests/test_mcp.py +32 -0
  23. tileupscale-0.6.0/tests/test_models_registry.py +61 -0
  24. tileupscale-0.6.0/tests/test_naming.py +56 -0
  25. tileupscale-0.6.0/tests/test_onnx_backend.py +90 -0
  26. tileupscale-0.6.0/tests/test_output_path.py +69 -0
  27. tileupscale-0.6.0/tests/test_passes.py +22 -0
  28. tileupscale-0.6.0/tests/test_pause.py +44 -0
  29. tileupscale-0.6.0/tests/test_pipeline_mmap.py +49 -0
  30. tileupscale-0.6.0/tests/test_resume_checkpoint_api.py +250 -0
  31. tileupscale-0.6.0/tests/test_run_server_thread.py +25 -0
  32. tileupscale-0.6.0/tests/test_schema.py +43 -0
  33. tileupscale-0.6.0/tests/test_seamless_wh.py +119 -0
  34. tileupscale-0.6.0/tests/test_security_models.py +62 -0
  35. tileupscale-0.6.0/tests/test_slim_import.py +42 -0
  36. tileupscale-0.6.0/tests/test_speed_stats.py +114 -0
  37. tileupscale-0.6.0/tests/test_spill_cancel.py +79 -0
  38. tileupscale-0.6.0/tests/test_strip_checkpoint.py +159 -0
  39. tileupscale-0.6.0/tests/test_strip_vs_full.py +56 -0
  40. tileupscale-0.6.0/tests/test_suggest_presets.py +55 -0
  41. tileupscale-0.6.0/tests/test_tiling.py +67 -0
  42. tileupscale-0.6.0/tileupscale.egg-info/PKG-INFO +172 -0
  43. tileupscale-0.6.0/tileupscale.egg-info/SOURCES.txt +90 -0
  44. tileupscale-0.6.0/tileupscale.egg-info/dependency_links.txt +1 -0
  45. tileupscale-0.6.0/tileupscale.egg-info/entry_points.txt +2 -0
  46. tileupscale-0.6.0/tileupscale.egg-info/requires.txt +53 -0
  47. tileupscale-0.6.0/tileupscale.egg-info/top_level.txt +1 -0
  48. tileupscale-0.6.0/upscale/__init__.py +30 -0
  49. tileupscale-0.6.0/upscale/__main__.py +3 -0
  50. tileupscale-0.6.0/upscale/about.py +170 -0
  51. tileupscale-0.6.0/upscale/algorithms/__init__.py +166 -0
  52. tileupscale-0.6.0/upscale/algorithms/classical.py +82 -0
  53. tileupscale-0.6.0/upscale/algorithms/plugins/__init__.py +52 -0
  54. tileupscale-0.6.0/upscale/algorithms/plugins/texture_residual.py +117 -0
  55. tileupscale-0.6.0/upscale/algorithms/plugins/vectorize_scale.py +450 -0
  56. tileupscale-0.6.0/upscale/alpha_policy.py +140 -0
  57. tileupscale-0.6.0/upscale/api/__init__.py +19 -0
  58. tileupscale-0.6.0/upscale/api/compare_routes.py +256 -0
  59. tileupscale-0.6.0/upscale/api/deps.py +18 -0
  60. tileupscale-0.6.0/upscale/api/jobs.py +535 -0
  61. tileupscale-0.6.0/upscale/api/media_routes.py +257 -0
  62. tileupscale-0.6.0/upscale/api/models_routes.py +107 -0
  63. tileupscale-0.6.0/upscale/api/system_routes.py +210 -0
  64. tileupscale-0.6.0/upscale/backends/__init__.py +27 -0
  65. tileupscale-0.6.0/upscale/backends/onnx_rt.py +291 -0
  66. tileupscale-0.6.0/upscale/benchmark.py +96 -0
  67. tileupscale-0.6.0/upscale/checkpoint.py +259 -0
  68. tileupscale-0.6.0/upscale/cli.py +634 -0
  69. tileupscale-0.6.0/upscale/compare.py +204 -0
  70. tileupscale-0.6.0/upscale/config.py +56 -0
  71. tileupscale-0.6.0/upscale/engine.py +321 -0
  72. tileupscale-0.6.0/upscale/estimates.py +338 -0
  73. tileupscale-0.6.0/upscale/filters.py +180 -0
  74. tileupscale-0.6.0/upscale/help_content.py +95 -0
  75. tileupscale-0.6.0/upscale/infer_util.py +22 -0
  76. tileupscale-0.6.0/upscale/io_utils.py +622 -0
  77. tileupscale-0.6.0/upscale/job_prep.py +318 -0
  78. tileupscale-0.6.0/upscale/mcp_server.py +287 -0
  79. tileupscale-0.6.0/upscale/memmap_util.py +70 -0
  80. tileupscale-0.6.0/upscale/models.py +628 -0
  81. tileupscale-0.6.0/upscale/naming.py +63 -0
  82. tileupscale-0.6.0/upscale/pipeline.py +482 -0
  83. tileupscale-0.6.0/upscale/presets.py +127 -0
  84. tileupscale-0.6.0/upscale/quality.py +36 -0
  85. tileupscale-0.6.0/upscale/schema.py +315 -0
  86. tileupscale-0.6.0/upscale/server.py +893 -0
  87. tileupscale-0.6.0/upscale/speed_stats.py +273 -0
  88. tileupscale-0.6.0/upscale/suggest.py +93 -0
  89. tileupscale-0.6.0/upscale/system.py +102 -0
  90. tileupscale-0.6.0/upscale/tiling.py +430 -0
  91. tileupscale-0.6.0/upscale/web.py +118 -0
  92. tileupscale-0.6.0/upscale/weight_blend.py +75 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Upscale contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ Third-party notices
2
+ ===================
3
+
4
+ Third-party model weights (Real-ESRGAN, HAT, SPAN, and community checkpoints)
5
+ remain under their own licenses. Review each model's license before redistribution.
6
+ OpenCV, ONNX Runtime, PyTorch, and other dependencies use their respective licenses.
@@ -0,0 +1,172 @@
1
+ Metadata-Version: 2.4
2
+ Name: tileupscale
3
+ Version: 0.6.0
4
+ Summary: Local AI image upscaler: chained Real-ESRGAN passes to any scale, seam-free feather-blended tiles
5
+ Author: tileupscale
6
+ License: MIT
7
+ Project-URL: Homepage, https://tileupscale.dev/
8
+ Project-URL: Repository, https://github.com/wwylon/upscale
9
+ Project-URL: Issues, https://github.com/wwylon/upscale/issues
10
+ Keywords: image-upscaler,super-resolution,real-esrgan,upscaling,pytorch,onnx,mcp,cli
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: End Users/Desktop
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Multimedia :: Graphics
21
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ License-File: NOTICE
26
+ Requires-Dist: torch>=2.0
27
+ Requires-Dist: torchvision
28
+ Requires-Dist: spandrel
29
+ Requires-Dist: Pillow
30
+ Requires-Dist: tifffile
31
+ Requires-Dist: imagecodecs
32
+ Requires-Dist: psd-tools>=1.9
33
+ Requires-Dist: tqdm
34
+ Requires-Dist: click
35
+ Requires-Dist: numpy
36
+ Requires-Dist: pydantic>=2.0
37
+ Provides-Extra: ui
38
+ Requires-Dist: gradio>=4.0; extra == "ui"
39
+ Provides-Extra: server
40
+ Requires-Dist: fastapi>=0.110; extra == "server"
41
+ Requires-Dist: uvicorn[standard]>=0.27; extra == "server"
42
+ Requires-Dist: python-multipart>=0.0.9; extra == "server"
43
+ Provides-Extra: mcp
44
+ Requires-Dist: mcp>=1.0; extra == "mcp"
45
+ Provides-Extra: desktop
46
+ Requires-Dist: pywebview>=5.0; extra == "desktop"
47
+ Provides-Extra: slim
48
+ Requires-Dist: tileupscale[desktop,server]; extra == "slim"
49
+ Requires-Dist: onnxruntime>=1.17; extra == "slim"
50
+ Requires-Dist: Pillow; extra == "slim"
51
+ Requires-Dist: numpy; extra == "slim"
52
+ Requires-Dist: tifffile; extra == "slim"
53
+ Requires-Dist: imagecodecs; extra == "slim"
54
+ Requires-Dist: tqdm; extra == "slim"
55
+ Requires-Dist: click; extra == "slim"
56
+ Requires-Dist: pydantic>=2.0; extra == "slim"
57
+ Provides-Extra: dev
58
+ Requires-Dist: pytest>=7.0; extra == "dev"
59
+ Requires-Dist: ruff>=0.4; extra == "dev"
60
+ Requires-Dist: httpx>=0.27; extra == "dev"
61
+ Requires-Dist: mypy>=1.8; extra == "dev"
62
+ Provides-Extra: classical
63
+ Requires-Dist: opencv-python-headless>=4.8; extra == "classical"
64
+ Provides-Extra: vectorize
65
+ Requires-Dist: vtracer>=0.6; extra == "vectorize"
66
+ Requires-Dist: pyautotrace>=0.0.7; extra == "vectorize"
67
+ Requires-Dist: resvg_py>=0.2; extra == "vectorize"
68
+ Provides-Extra: all
69
+ Requires-Dist: tileupscale[classical,desktop,dev,mcp,server,slim,ui,vectorize]; extra == "all"
70
+ Dynamic: license-file
71
+
72
+ # tileupscale
73
+
74
+ [![CI](https://github.com/wwylon/upscale/actions/workflows/ci.yml/badge.svg)](https://github.com/wwylon/upscale/actions/workflows/ci.yml)
75
+ [![Release](https://img.shields.io/github/v/release/wwylon/upscale)](https://github.com/wwylon/upscale/releases)
76
+ [![PyPI](https://img.shields.io/pypi/v/tileupscale)](https://pypi.org/project/tileupscale/)
77
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
78
+
79
+ Local AI image upscale. Chains Real-ESRGAN passes (via [spandrel](https://github.com/chaiNNer-org/spandrel)) to reach any target scale, with feather-blended overlapping tiles so large outputs have no seams. Runs on CPU or an NVIDIA GPU; nothing leaves your machine except the one-time model download.
80
+
81
+ Homepage: [tileupscale.dev](https://tileupscale.dev/)
82
+
83
+ ![tileupscale hero](docs/assets/hero.jpg)
84
+
85
+ ![Before/after: 160px source upscaled 4x](docs/assets/demo.gif)
86
+
87
+ > PyPI distribution **tileupscale**. Import and command stay `upscale`. Not related to other projects named "upscaler" on GitHub or PyPI.
88
+
89
+ ## Install
90
+
91
+ ```bash
92
+ pip install tileupscale
93
+ pip install "tileupscale[server]" # web UI + job API
94
+ pip install "tileupscale[mcp]" # MCP tools for agents
95
+ # or: pipx install tileupscale
96
+ ```
97
+
98
+ The pip install pulls PyTorch (large, slow first install). A PyTorch-free build exists only as the Windows desktop app (ONNX Runtime); see [docs/develop.md](docs/develop.md).
99
+
100
+ From a clone:
101
+
102
+ ```bash
103
+ pip install -e .
104
+ pip install -e ".[server,mcp]"
105
+ # tip without cloning: pip install "git+https://github.com/wwylon/upscale.git"
106
+ ```
107
+
108
+ ## First win
109
+
110
+ ```bash
111
+ upscale upscale input.png output.png --scale 4 --cpu
112
+ ```
113
+
114
+ Use `--target-size 8000` for a target long edge instead of a factor, drop `--cpu` to use the GPU, and `--fast` for the quick SPAN model. Models download on first use and are hash-verified.
115
+
116
+ ```bash
117
+ upscale models list # built-in models
118
+ upscale suggest input.png # heuristic model pick
119
+ upscale serve # local web UI at http://127.0.0.1:8787/en/
120
+ upscale mcp # MCP tools over stdio
121
+ ```
122
+
123
+ Equivalent module form: `python -m upscale upscale ...`
124
+
125
+ ## Highlights
126
+
127
+ - Exact scale (`--scale`) or target long edge (`--target-size`); extra passes only when needed
128
+ - Tile size chosen from free VRAM; very large frames spill to disk between passes
129
+ - Swappable models: Real-ESRGAN family, HAT, SPAN, community weights, or your own `.pth`
130
+ - Large outputs saved as BigTIFF; alpha preserved
131
+ - Web UI in several languages; Windows desktop build uses ONNX Runtime (no PyTorch)
132
+ - No telemetry
133
+
134
+ ## Library
135
+
136
+ ```python
137
+ from upscale import UpscaleConfig, execute
138
+
139
+ execute(UpscaleConfig(input="in.png", output="out.png", scale=4, cpu=True))
140
+ ```
141
+
142
+ ## Documentation
143
+
144
+ - [CLI reference](docs/cli.md)
145
+ - [HTTP and MCP API](docs/api.md)
146
+ - [Development, desktop build, layout](docs/develop.md)
147
+ - [Android skeleton](docs/android.md)
148
+
149
+ ## Tests
150
+
151
+ Local gate (also in [CONTRIBUTING.md](CONTRIBUTING.md) / `publish.manifest.yaml`):
152
+
153
+ ```bash
154
+ uv sync --locked --extra dev --extra server --extra mcp
155
+ uv run ruff check upscale tests
156
+ uv run mypy --follow-imports=silent upscale/schema.py upscale/job_prep.py upscale/config.py upscale/naming.py upscale/api
157
+ uv run pytest -q
158
+ uv run python scripts/cpu_smoke.py
159
+ ```
160
+
161
+ GitHub Actions are disabled to save minutes; run the gate locally (or `workflow_dispatch` if re-enabled) before publish.
162
+
163
+ MIT licensed. See [CONTRIBUTING.md](CONTRIBUTING.md) and [SECURITY.md](SECURITY.md).
164
+
165
+ ## Verify
166
+
167
+ ```bash
168
+ uv run pytest -q
169
+ ```
170
+
171
+ Or: python -m manager verify upscale --tier prereq. Contract: [project.manifest.yaml](project.manifest.yaml).
172
+
@@ -0,0 +1,101 @@
1
+ # tileupscale
2
+
3
+ [![CI](https://github.com/wwylon/upscale/actions/workflows/ci.yml/badge.svg)](https://github.com/wwylon/upscale/actions/workflows/ci.yml)
4
+ [![Release](https://img.shields.io/github/v/release/wwylon/upscale)](https://github.com/wwylon/upscale/releases)
5
+ [![PyPI](https://img.shields.io/pypi/v/tileupscale)](https://pypi.org/project/tileupscale/)
6
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7
+
8
+ Local AI image upscale. Chains Real-ESRGAN passes (via [spandrel](https://github.com/chaiNNer-org/spandrel)) to reach any target scale, with feather-blended overlapping tiles so large outputs have no seams. Runs on CPU or an NVIDIA GPU; nothing leaves your machine except the one-time model download.
9
+
10
+ Homepage: [tileupscale.dev](https://tileupscale.dev/)
11
+
12
+ ![tileupscale hero](docs/assets/hero.jpg)
13
+
14
+ ![Before/after: 160px source upscaled 4x](docs/assets/demo.gif)
15
+
16
+ > PyPI distribution **tileupscale**. Import and command stay `upscale`. Not related to other projects named "upscaler" on GitHub or PyPI.
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ pip install tileupscale
22
+ pip install "tileupscale[server]" # web UI + job API
23
+ pip install "tileupscale[mcp]" # MCP tools for agents
24
+ # or: pipx install tileupscale
25
+ ```
26
+
27
+ The pip install pulls PyTorch (large, slow first install). A PyTorch-free build exists only as the Windows desktop app (ONNX Runtime); see [docs/develop.md](docs/develop.md).
28
+
29
+ From a clone:
30
+
31
+ ```bash
32
+ pip install -e .
33
+ pip install -e ".[server,mcp]"
34
+ # tip without cloning: pip install "git+https://github.com/wwylon/upscale.git"
35
+ ```
36
+
37
+ ## First win
38
+
39
+ ```bash
40
+ upscale upscale input.png output.png --scale 4 --cpu
41
+ ```
42
+
43
+ Use `--target-size 8000` for a target long edge instead of a factor, drop `--cpu` to use the GPU, and `--fast` for the quick SPAN model. Models download on first use and are hash-verified.
44
+
45
+ ```bash
46
+ upscale models list # built-in models
47
+ upscale suggest input.png # heuristic model pick
48
+ upscale serve # local web UI at http://127.0.0.1:8787/en/
49
+ upscale mcp # MCP tools over stdio
50
+ ```
51
+
52
+ Equivalent module form: `python -m upscale upscale ...`
53
+
54
+ ## Highlights
55
+
56
+ - Exact scale (`--scale`) or target long edge (`--target-size`); extra passes only when needed
57
+ - Tile size chosen from free VRAM; very large frames spill to disk between passes
58
+ - Swappable models: Real-ESRGAN family, HAT, SPAN, community weights, or your own `.pth`
59
+ - Large outputs saved as BigTIFF; alpha preserved
60
+ - Web UI in several languages; Windows desktop build uses ONNX Runtime (no PyTorch)
61
+ - No telemetry
62
+
63
+ ## Library
64
+
65
+ ```python
66
+ from upscale import UpscaleConfig, execute
67
+
68
+ execute(UpscaleConfig(input="in.png", output="out.png", scale=4, cpu=True))
69
+ ```
70
+
71
+ ## Documentation
72
+
73
+ - [CLI reference](docs/cli.md)
74
+ - [HTTP and MCP API](docs/api.md)
75
+ - [Development, desktop build, layout](docs/develop.md)
76
+ - [Android skeleton](docs/android.md)
77
+
78
+ ## Tests
79
+
80
+ Local gate (also in [CONTRIBUTING.md](CONTRIBUTING.md) / `publish.manifest.yaml`):
81
+
82
+ ```bash
83
+ uv sync --locked --extra dev --extra server --extra mcp
84
+ uv run ruff check upscale tests
85
+ uv run mypy --follow-imports=silent upscale/schema.py upscale/job_prep.py upscale/config.py upscale/naming.py upscale/api
86
+ uv run pytest -q
87
+ uv run python scripts/cpu_smoke.py
88
+ ```
89
+
90
+ GitHub Actions are disabled to save minutes; run the gate locally (or `workflow_dispatch` if re-enabled) before publish.
91
+
92
+ MIT licensed. See [CONTRIBUTING.md](CONTRIBUTING.md) and [SECURITY.md](SECURITY.md).
93
+
94
+ ## Verify
95
+
96
+ ```bash
97
+ uv run pytest -q
98
+ ```
99
+
100
+ Or: python -m manager verify upscale --tier prereq. Contract: [project.manifest.yaml](project.manifest.yaml).
101
+
@@ -0,0 +1,103 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tileupscale"
7
+ version = "0.6.0"
8
+ description = "Local AI image upscaler: chained Real-ESRGAN passes to any scale, seam-free feather-blended tiles"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "tileupscale" }]
13
+ keywords = ["image-upscaler", "super-resolution", "real-esrgan", "upscaling", "pytorch", "onnx", "mcp", "cli"]
14
+ dependencies = [
15
+ "torch>=2.0",
16
+ "torchvision",
17
+ "spandrel",
18
+ "Pillow",
19
+ "tifffile",
20
+ "imagecodecs",
21
+ "psd-tools>=1.9",
22
+ "tqdm",
23
+ "click",
24
+ "numpy",
25
+ "pydantic>=2.0",
26
+ ]
27
+
28
+ classifiers = [
29
+ "Development Status :: 4 - Beta",
30
+ "Environment :: Console",
31
+ "Intended Audience :: End Users/Desktop",
32
+ "License :: OSI Approved :: MIT License",
33
+ "Operating System :: OS Independent",
34
+ "Programming Language :: Python :: 3",
35
+ "Programming Language :: Python :: 3.10",
36
+ "Programming Language :: Python :: 3.11",
37
+ "Programming Language :: Python :: 3.12",
38
+ "Topic :: Multimedia :: Graphics",
39
+ "Topic :: Scientific/Engineering :: Image Processing",
40
+ ]
41
+
42
+ [project.urls]
43
+ Homepage = "https://tileupscale.dev/"
44
+ Repository = "https://github.com/wwylon/upscale"
45
+ Issues = "https://github.com/wwylon/upscale/issues"
46
+
47
+ [project.optional-dependencies]
48
+ ui = ["gradio>=4.0"]
49
+ server = ["fastapi>=0.110", "uvicorn[standard]>=0.27", "python-multipart>=0.0.9"]
50
+ mcp = ["mcp>=1.0"]
51
+ desktop = ["pywebview>=5.0"]
52
+ # Adds ONNX Runtime + desktop deps for the Windows exe build. Does NOT remove torch (a core
53
+ # dependency); the shipped exe is built without it by desktop/build_windows_slim.ps1.
54
+ slim = [
55
+ "tileupscale[server,desktop]",
56
+ "onnxruntime>=1.17",
57
+ "Pillow",
58
+ "numpy",
59
+ "tifffile",
60
+ "imagecodecs",
61
+ "tqdm",
62
+ "click",
63
+ "pydantic>=2.0",
64
+ ]
65
+ dev = ["pytest>=7.0", "ruff>=0.4", "httpx>=0.27", "mypy>=1.8"]
66
+ # Classical resize prefers OpenCV (C++/SIMD); Pillow fallback always works
67
+ classical = ["opencv-python-headless>=4.8"]
68
+ # Raster→SVG→raster paper path (logos / line art). resvg_py = Windows-friendly SVG→PNG.
69
+ vectorize = ["vtracer>=0.6", "pyautotrace>=0.0.7", "resvg_py>=0.2"]
70
+ all = ["tileupscale[ui,server,mcp,desktop,slim,dev,classical,vectorize]"]
71
+
72
+ [project.scripts]
73
+ upscale = "upscale.cli:cli"
74
+
75
+ [tool.setuptools.packages.find]
76
+ include = ["upscale*"]
77
+
78
+ [tool.pytest.ini_options]
79
+ testpaths = ["tests"]
80
+ addopts = "-q"
81
+
82
+ [tool.ruff]
83
+ line-length = 100
84
+ target-version = "py310"
85
+
86
+ [tool.ruff.lint]
87
+ # Classic pyflakes + pycodestyle errors (keeps verify/CI stable across ruff minors)
88
+ select = ["E4", "E7", "E9", "F", "I", "B"]
89
+ ignore = [
90
+ "E402", # lazy/optional imports inside functions are intentional
91
+ "E742", # single-letter type names in generics (e.g. I for Image)
92
+ ]
93
+
94
+ [tool.ruff.lint.flake8-bugbear]
95
+ # FastAPI / Gradio require these calls in parameter defaults.
96
+ extend-immutable-calls = ["fastapi.File", "fastapi.Form", "gradio.Progress"]
97
+
98
+ [tool.mypy]
99
+ python_version = "3.11"
100
+ ignore_missing_imports = true
101
+ follow_imports = "silent"
102
+ warn_unused_ignores = false
103
+ pretty = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,72 @@
1
+ """About / license / update-check helpers."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from pathlib import Path
7
+
8
+ from upscale.about import (
9
+ about_payload,
10
+ check_for_updates,
11
+ license_text,
12
+ models_disk_summary,
13
+ package_version,
14
+ )
15
+
16
+
17
+ def test_package_version():
18
+ assert package_version()
19
+
20
+
21
+ def test_license_text_mentions_mit():
22
+ text = license_text()
23
+ assert "MIT" in text
24
+ assert "Permission is hereby granted" in text
25
+
26
+
27
+ def test_about_payload_has_models_policy():
28
+ a = about_payload()
29
+ assert a["name"] == "Upscale"
30
+ assert a["license"] == "MIT"
31
+ assert "models_dir" in a
32
+ assert "on demand" in a["models_policy"].lower() or "download" in a["models_policy"].lower()
33
+
34
+
35
+ def test_models_disk_summary_shape():
36
+ s = models_disk_summary()
37
+ assert "models_dir" in s
38
+ assert "installed_count" in s
39
+ assert isinstance(s["models"], list)
40
+
41
+
42
+ def test_check_updates_unconfigured():
43
+ r = check_for_updates(releases_url="")
44
+ assert r["status"] == "unconfigured"
45
+ assert r["current"] == package_version()
46
+ assert r["update_available"] is False
47
+
48
+
49
+ def test_check_updates_from_local_json(tmp_path: Path, monkeypatch):
50
+ data = {"tag_name": "v99.0.0", "html_url": "https://example.com/r"}
51
+ path = tmp_path / "latest.json"
52
+ path.write_text(json.dumps(data), encoding="utf-8")
53
+ # file:// may not work on all platforms via urlopen; use a tiny HTTP stub via data URL is hard —
54
+ # instead monkeypatch urlopen.
55
+ class _Resp:
56
+ def read(self):
57
+ return path.read_bytes()
58
+
59
+ def __enter__(self):
60
+ return self
61
+
62
+ def __exit__(self, *a):
63
+ return False
64
+
65
+ def fake_open(req, timeout=8.0):
66
+ return _Resp()
67
+
68
+ monkeypatch.setattr("urllib.request.urlopen", fake_open)
69
+ r = check_for_updates(releases_url="https://example.com/releases/latest")
70
+ assert r["status"] == "ok"
71
+ assert r["update_available"] is True
72
+ assert r["latest"] == "99.0.0"