aiohttp-zip-response 2.3.0__tar.gz → 3.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.
@@ -1,29 +1,33 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: aiohttp-zip-response
3
- Version: 2.3.0
4
- Summary: A AIOHTTP response class streaming a directory as ZIP archive
5
- License: MIT
3
+ Version: 3.0.0
4
+ Summary: An AIOHTTP response class streaming a directory as a ZIP archive
6
5
  Author: Jonathan Ehwald
7
- Author-email: github@ehwald.info
8
- Requires-Python: >=3.9,<4.0
6
+ Author-email: Jonathan Ehwald <github@ehwald.info>
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 5 - Production/Stable
9
10
  Classifier: Environment :: Web Environment
10
11
  Classifier: Intended Audience :: Developers
11
- Classifier: License :: OSI Approved :: MIT License
12
12
  Classifier: Operating System :: OS Independent
13
13
  Classifier: Programming Language :: Python
14
14
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.9
16
- Classifier: Programming Language :: Python :: 3.10
17
15
  Classifier: Programming Language :: Python :: 3.11
18
16
  Classifier: Programming Language :: Python :: 3.12
19
17
  Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3.15
20
20
  Classifier: Topic :: Internet :: WWW/HTTP
21
21
  Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
22
- Requires-Dist: aiohttp (>=3.9.5,<4.0.0)
23
- Requires-Dist: stream-zip (>=0.0.83,<0.0.84)
24
- Project-URL: Documentation, https://github.com/DoctorJohn/aiohttp-zip-response
25
- Project-URL: Homepage, https://github.com/DoctorJohn/aiohttp-zip-response
26
- Project-URL: Repository, https://github.com/DoctorJohn/aiohttp-zip-response
22
+ Classifier: Topic :: Software Development :: Libraries
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Typing :: Typed
25
+ Requires-Dist: aiohttp>=3.9.5,<4.0
26
+ Requires-Dist: stream-zip>=0.0.83,<0.1.0
27
+ Requires-Python: >=3.11, <4.0
28
+ Project-URL: homepage, https://github.com/DoctorJohn/aiohttp-zip-response
29
+ Project-URL: repository, https://github.com/DoctorJohn/aiohttp-zip-response
30
+ Project-URL: documentation, https://github.com/DoctorJohn/aiohttp-zip-response
27
31
  Description-Content-Type: text/markdown
28
32
 
29
33
  # AIOHTTP ZIP Response
@@ -42,7 +46,7 @@ Description-Content-Type: text/markdown
42
46
  [license-image]: https://img.shields.io/pypi/l/aiohttp-zip-response
43
47
  [license-url]: https://github.com/DoctorJohn/aiohttp-zip-response/blob/main/LICENSE
44
48
 
45
- A AIOHTTP response class streaming the contents of a directory as a ZIP archive.
49
+ An AIOHTTP response class streaming the contents of a directory as a ZIP archive.
46
50
  Thanks to [stream-zip](https://github.com/uktrade/stream-zip/), this works **without storing the entire ZIP in memory or disk**.
47
51
 
48
52
  Generally, this package is meant to complement the existing `aiohttp.web.FileResponse` class which can be used to stream the contents of a single file.
@@ -61,11 +65,11 @@ from aiohttp_zip_response import ZipResponse
61
65
 
62
66
 
63
67
  async def handle_zip(request):
64
- return ZipResponse('path/to/directory')
68
+ return ZipResponse("path/to/directory")
65
69
 
66
70
 
67
71
  app = web.Application()
68
- app.router.add_get('/zip', handle_zip)
72
+ app.router.add_get("/zip", handle_zip)
69
73
  web.run_app(app)
70
74
  ```
71
75
 
@@ -73,4 +77,3 @@ web.run_app(app)
73
77
 
74
78
  - The `Content-Length` header is not set because the size of the ZIP archive is not known in advance. This means clients such as browsers cannot display a download progress bar.
75
79
  - This package currently doesn't support streaming of symbolic links to directories.
76
-
@@ -14,7 +14,7 @@
14
14
  [license-image]: https://img.shields.io/pypi/l/aiohttp-zip-response
15
15
  [license-url]: https://github.com/DoctorJohn/aiohttp-zip-response/blob/main/LICENSE
16
16
 
17
- A AIOHTTP response class streaming the contents of a directory as a ZIP archive.
17
+ An AIOHTTP response class streaming the contents of a directory as a ZIP archive.
18
18
  Thanks to [stream-zip](https://github.com/uktrade/stream-zip/), this works **without storing the entire ZIP in memory or disk**.
19
19
 
20
20
  Generally, this package is meant to complement the existing `aiohttp.web.FileResponse` class which can be used to stream the contents of a single file.
@@ -33,11 +33,11 @@ from aiohttp_zip_response import ZipResponse
33
33
 
34
34
 
35
35
  async def handle_zip(request):
36
- return ZipResponse('path/to/directory')
36
+ return ZipResponse("path/to/directory")
37
37
 
38
38
 
39
39
  app = web.Application()
40
- app.router.add_get('/zip', handle_zip)
40
+ app.router.add_get("/zip", handle_zip)
41
41
  web.run_app(app)
42
42
  ```
43
43
 
@@ -1,6 +1,6 @@
1
+ from collections.abc import AsyncGenerator
1
2
  from datetime import datetime
2
3
  from pathlib import Path
3
- from typing import AsyncGenerator, Optional
4
4
 
5
5
  from aiohttp import web
6
6
  from aiohttp.typedefs import LooseHeaders, PathLike
@@ -13,12 +13,12 @@ class ZipResponse(web.StreamResponse):
13
13
  base_path: PathLike,
14
14
  chunk_size: int = 256 * 1024,
15
15
  status: int = 200,
16
- reason: Optional[str] = None,
17
- headers: Optional[LooseHeaders] = None,
16
+ reason: str | None = None,
17
+ headers: LooseHeaders | None = None,
18
18
  ) -> None:
19
19
  self._base_path = Path(base_path)
20
20
  self._chunk_size = chunk_size
21
- return super().__init__(
21
+ super().__init__(
22
22
  status=status,
23
23
  reason=reason,
24
24
  headers=headers,
@@ -0,0 +1,75 @@
1
+ [project]
2
+ name = "aiohttp-zip-response"
3
+ version = "3.0.0"
4
+ description = "An AIOHTTP response class streaming a directory as a ZIP archive"
5
+ license = "MIT"
6
+ license-files = ["LICENSE"]
7
+ readme = "README.md"
8
+ requires-python = ">=3.11,<4.0"
9
+ dependencies = [
10
+ "aiohttp (>=3.9.5,<4.0)",
11
+ "stream-zip (>=0.0.83,<0.1.0)",
12
+ ]
13
+ classifiers = [
14
+ "Development Status :: 5 - Production/Stable",
15
+ "Environment :: Web Environment",
16
+ "Intended Audience :: Developers",
17
+ "Operating System :: OS Independent",
18
+ "Programming Language :: Python",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Programming Language :: Python :: 3.14",
24
+ "Programming Language :: Python :: 3.15",
25
+ "Topic :: Internet :: WWW/HTTP",
26
+ "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
27
+ "Topic :: Software Development :: Libraries",
28
+ "Topic :: Software Development :: Libraries :: Python Modules",
29
+ "Typing :: Typed",
30
+ ]
31
+
32
+ [[project.authors]]
33
+ name = "Jonathan Ehwald"
34
+ email = "github@ehwald.info"
35
+
36
+ [project.urls]
37
+ homepage = "https://github.com/DoctorJohn/aiohttp-zip-response"
38
+ repository = "https://github.com/DoctorJohn/aiohttp-zip-response"
39
+ documentation = "https://github.com/DoctorJohn/aiohttp-zip-response"
40
+
41
+ [dependency-groups]
42
+ dev = [
43
+ "mypy>=1.15.0",
44
+ "prek>=0.2.29",
45
+ "pytest>=8.3.5",
46
+ "pytest-aiohttp>=1.1.0",
47
+ "pytest-asyncio>=0.26.0",
48
+ "pytest-cov>=6.1.1",
49
+ "pytest-randomly>=3.16.0",
50
+ "ruff>=0.11.6",
51
+ ]
52
+
53
+ [build-system]
54
+ requires = ["uv_build>=0.13.4,<0.14.0"]
55
+ build-backend = "uv_build"
56
+
57
+ [tool.uv.build-backend]
58
+ module-root = ""
59
+
60
+ [tool.ruff.lint]
61
+ extend-select = [
62
+ "I",
63
+ "UP",
64
+ ]
65
+
66
+ [tool.ruff.lint.per-file-ignores]
67
+ "tests/**" = ["ASYNC221"]
68
+
69
+ [tool.pytest.ini_options]
70
+ asyncio_mode = "auto"
71
+ asyncio_default_fixture_loop_scope = "function"
72
+ addopts = "--cov=aiohttp_zip_response --cov-report term-missing --cov-report html"
73
+
74
+ [tool.mypy]
75
+ check_untyped_defs = true
@@ -0,0 +1,69 @@
1
+ [project]
2
+ name = "aiohttp-zip-response"
3
+ version = "3.0.0"
4
+ description = "An AIOHTTP response class streaming a directory as a ZIP archive"
5
+ authors = [{ name = "Jonathan Ehwald", email = "github@ehwald.info" }]
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ readme = "README.md"
9
+ requires-python = ">=3.11,<4.0"
10
+ dependencies = ["aiohttp (>=3.9.5,<4.0)", "stream-zip (>=0.0.83,<0.1.0)"]
11
+ classifiers = [
12
+ "Development Status :: 5 - Production/Stable",
13
+ "Environment :: Web Environment",
14
+ "Intended Audience :: Developers",
15
+ "Operating System :: OS Independent",
16
+ "Programming Language :: Python",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Programming Language :: Python :: 3.14",
22
+ "Programming Language :: Python :: 3.15",
23
+ "Topic :: Internet :: WWW/HTTP",
24
+ "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
25
+ "Topic :: Software Development :: Libraries",
26
+ "Topic :: Software Development :: Libraries :: Python Modules",
27
+ "Typing :: Typed",
28
+ ]
29
+
30
+ [project.urls]
31
+ homepage = "https://github.com/DoctorJohn/aiohttp-zip-response"
32
+ repository = "https://github.com/DoctorJohn/aiohttp-zip-response"
33
+ documentation = "https://github.com/DoctorJohn/aiohttp-zip-response"
34
+
35
+ [dependency-groups]
36
+ dev = [
37
+ "mypy>=1.15.0",
38
+ "prek>=0.2.29",
39
+ "pytest>=8.3.5",
40
+ "pytest-aiohttp>=1.1.0",
41
+ "pytest-asyncio>=0.26.0",
42
+ "pytest-cov>=6.1.1",
43
+ "pytest-randomly>=3.16.0",
44
+ "ruff>=0.11.6",
45
+ ]
46
+
47
+ [build-system]
48
+ requires = ["uv_build>=0.13.4,<0.14.0"]
49
+ build-backend = "uv_build"
50
+
51
+ [tool.uv.build-backend]
52
+ module-root = ""
53
+
54
+ [tool.ruff.lint]
55
+ extend-select = ["I", "UP"]
56
+
57
+ [tool.ruff.lint.per-file-ignores]
58
+ "tests/**" = [
59
+ # Blocking calls (e.g. os.system) are fine in async tests
60
+ "ASYNC221",
61
+ ]
62
+
63
+ [tool.pytest.ini_options]
64
+ asyncio_mode = "auto"
65
+ asyncio_default_fixture_loop_scope = "function"
66
+ addopts = "--cov=aiohttp_zip_response --cov-report term-missing --cov-report html"
67
+
68
+ [tool.mypy]
69
+ check_untyped_defs = true
@@ -1,54 +0,0 @@
1
- [tool.poetry]
2
- name = "aiohttp-zip-response"
3
- version = "2.3.0"
4
- description = "A AIOHTTP response class streaming a directory as ZIP archive"
5
- authors = ["Jonathan Ehwald <github@ehwald.info>"]
6
- license = "MIT"
7
- readme = "README.md"
8
- homepage = "https://github.com/DoctorJohn/aiohttp-zip-response"
9
- repository = "https://github.com/DoctorJohn/aiohttp-zip-response"
10
- documentation = "https://github.com/DoctorJohn/aiohttp-zip-response"
11
- classifiers = [
12
- "Environment :: Web Environment",
13
- "Intended Audience :: Developers",
14
- "License :: OSI Approved :: MIT License",
15
- "Operating System :: OS Independent",
16
- "Programming Language :: Python",
17
- "Programming Language :: Python :: 3",
18
- "Programming Language :: Python :: 3.9",
19
- "Programming Language :: Python :: 3.10",
20
- "Programming Language :: Python :: 3.11",
21
- "Programming Language :: Python :: 3.12",
22
- "Programming Language :: Python :: 3.13",
23
- "Topic :: Internet :: WWW/HTTP",
24
- "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
25
- ]
26
-
27
- [tool.poetry.dependencies]
28
- python = "^3.9"
29
- aiohttp = "^3.9.5"
30
- stream-zip = "^0.0.83"
31
-
32
- [tool.poetry.group.dev.dependencies]
33
- pre-commit = "^4.0.1"
34
- pytest = "^8.2.2"
35
- pytest-cov = "^6.0.0"
36
- pytest-asyncio = "^0.26.0"
37
- pytest-aiohttp = "^1.0.5"
38
- pytest-randomly = "^3.15.0"
39
- ruff = "^0.11.2"
40
- mypy = "^1.10.1"
41
-
42
- [tool.ruff.lint]
43
- extend-select = ["I"]
44
-
45
- [tool.pytest.ini_options]
46
- asyncio_mode = "auto"
47
- addopts = "--cov=aiohttp_zip_response --cov-report term-missing"
48
-
49
- [tool.mypy]
50
- check_untyped_defs = true
51
-
52
- [build-system]
53
- requires = ["poetry-core"]
54
- build-backend = "poetry.core.masonry.api"