imgproxykit 0.1.0__py3-none-any.whl

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 (62) hide show
  1. imgproxykit/__init__.py +2 -0
  2. imgproxykit/builders.py +132 -0
  3. imgproxykit/client.py +167 -0
  4. imgproxykit/internal/__init__.py +0 -0
  5. imgproxykit/internal/constants.py +8 -0
  6. imgproxykit/internal/empty.py +8 -0
  7. imgproxykit/internal/encoding.py +13 -0
  8. imgproxykit/internal/paths.py +21 -0
  9. imgproxykit/internal/serialization.py +34 -0
  10. imgproxykit/options/__init__.py +62 -0
  11. imgproxykit/options/auto_rotate.py +39 -0
  12. imgproxykit/options/background.py +46 -0
  13. imgproxykit/options/base.py +41 -0
  14. imgproxykit/options/blur.py +38 -0
  15. imgproxykit/options/cache_buster.py +40 -0
  16. imgproxykit/options/crop.py +61 -0
  17. imgproxykit/options/dpr.py +40 -0
  18. imgproxykit/options/enforce_thumbnail.py +39 -0
  19. imgproxykit/options/enlarge.py +38 -0
  20. imgproxykit/options/expires.py +38 -0
  21. imgproxykit/options/extend.py +50 -0
  22. imgproxykit/options/extend_aspect_ratio.py +50 -0
  23. imgproxykit/options/filename.py +41 -0
  24. imgproxykit/options/flip.py +44 -0
  25. imgproxykit/options/format_quality.py +38 -0
  26. imgproxykit/options/gravity.py +48 -0
  27. imgproxykit/options/height.py +39 -0
  28. imgproxykit/options/keep_copyright.py +38 -0
  29. imgproxykit/options/max_animation_frame_resolution.py +39 -0
  30. imgproxykit/options/max_animation_frames.py +39 -0
  31. imgproxykit/options/max_bytes.py +39 -0
  32. imgproxykit/options/max_result_dimension.py +39 -0
  33. imgproxykit/options/max_src_file_size.py +39 -0
  34. imgproxykit/options/max_src_resolution.py +39 -0
  35. imgproxykit/options/min_height.py +38 -0
  36. imgproxykit/options/min_width.py +38 -0
  37. imgproxykit/options/padding.py +50 -0
  38. imgproxykit/options/pixelate.py +38 -0
  39. imgproxykit/options/preserve_hdr.py +38 -0
  40. imgproxykit/options/quality.py +38 -0
  41. imgproxykit/options/raw.py +39 -0
  42. imgproxykit/options/resize.py +55 -0
  43. imgproxykit/options/resizing_type.py +39 -0
  44. imgproxykit/options/return_attachment.py +39 -0
  45. imgproxykit/options/rotate.py +38 -0
  46. imgproxykit/options/sharpen.py +38 -0
  47. imgproxykit/options/size.py +45 -0
  48. imgproxykit/options/skip_processing.py +39 -0
  49. imgproxykit/options/strip_color_profile.py +39 -0
  50. imgproxykit/options/strip_metadata.py +38 -0
  51. imgproxykit/options/trim.py +52 -0
  52. imgproxykit/options/watermark.py +60 -0
  53. imgproxykit/options/width.py +39 -0
  54. imgproxykit/options/zoom.py +45 -0
  55. imgproxykit/py.typed +0 -0
  56. imgproxykit/signing.py +114 -0
  57. imgproxykit/transform.py +54 -0
  58. imgproxykit/types.py +95 -0
  59. imgproxykit-0.1.0.dist-info/METADATA +150 -0
  60. imgproxykit-0.1.0.dist-info/RECORD +62 -0
  61. imgproxykit-0.1.0.dist-info/WHEEL +4 -0
  62. imgproxykit-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,150 @@
1
+ Metadata-Version: 2.4
2
+ Name: imgproxykit
3
+ Version: 0.1.0
4
+ Summary: A typed Python toolkit for building imgproxy URLs
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Keywords: image-processing,image-transformation,images,imgproxy,url-builder
8
+ Author: Alexander Kondratev
9
+ Author-email: mail@kondratev.dev
10
+ Requires-Python: >=3.12,<4
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3.15
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Typing :: Typed
23
+ Requires-Dist: typing-extensions (>=4.16,<5)
24
+ Project-URL: Changelog, https://github.com/kondratevdev/imgproxykit/releases
25
+ Project-URL: GitHub, https://github.com/kondratevdev/imgproxykit
26
+ Project-URL: Issues, https://github.com/kondratevdev/imgproxykit/issues
27
+ Description-Content-Type: text/markdown
28
+
29
+ <h1 align="center">imgproxykit</h1>
30
+
31
+ <p align="center">
32
+ <em>A typed Python toolkit for building imgproxy URLs.</em>
33
+ </p>
34
+
35
+ <p align="center">
36
+ <a href="#features">Features</a> ·
37
+ <a href="#installation">Installation</a> ·
38
+ <a href="#example">Example</a> ·
39
+ <a href="https://github.com/kondratevdev/imgproxykit/issues">Issues</a> ·
40
+ <a href="CONTRIBUTING.md">Contributing</a>
41
+ </p>
42
+
43
+ Define image transformations in Python and turn them into reusable, signed URLs.
44
+ Your imgproxy server fetches and processes the image when the URL is requested.
45
+
46
+ ## Features
47
+
48
+ - [x] Typed API with annotations
49
+ - [x] Immutable, reusable transforms built from Python dataclasses
50
+ - [x] Free imgproxy processing options, including geometry, filters, metadata,
51
+ quality, pixel density, gravity, and watermarks
52
+ - [x] Output format selection, including WebP and AVIF
53
+ - [x] Support for named presets configured on your imgproxy server
54
+
55
+ ## Installation
56
+
57
+ Requires **Python 3.12+** and a running imgproxy server.
58
+
59
+ ```bash
60
+ pip install imgproxykit
61
+ ```
62
+
63
+ ## Example
64
+
65
+ Create a client, define a transform, and generate a URL:
66
+
67
+ ```pycon
68
+ >>> from imgproxykit import Client, Transform
69
+ >>> from imgproxykit.options import Quality, Resize
70
+ >>> client = Client('https://images.example.com')
71
+ >>> thumbnail = Transform(
72
+ ... options=(
73
+ ... Resize(width=300, height=300, mode='fill'),
74
+ ... Quality(85),
75
+ ... ),
76
+ ... format='webp',
77
+ ... )
78
+ >>> url = client.url(
79
+ ... 'https://example.com/photo.jpg',
80
+ ... transform=thumbnail,
81
+ ... )
82
+ >>> url.startswith('https://images.example.com/unsafe/rs:fill:300:300/q:85/')
83
+ True
84
+ >>> url.endswith('.webp')
85
+ True
86
+
87
+ ```
88
+
89
+ Reuse `client` and `thumbnail` for other source images. Options you omit are
90
+ left to imgproxy's defaults.
91
+
92
+ Without signing credentials, URLs use the `unsafe` marker and require a server
93
+ with signature checking disabled.
94
+
95
+ ### Signed URLs
96
+
97
+ Supply the hex-encoded key and salt from your imgproxy server configuration:
98
+
99
+ ```python
100
+ import os
101
+
102
+ from imgproxykit import Client
103
+
104
+ client = Client(
105
+ 'https://images.example.com',
106
+ key=os.environ['IMGPROXY_KEY'],
107
+ salt=os.environ['IMGPROXY_SALT'],
108
+ )
109
+
110
+ url = client.url(
111
+ 'https://example.com/photo.jpg',
112
+ transform=thumbnail,
113
+ )
114
+ ```
115
+
116
+ Both credentials are required together. The client signs each generated path
117
+ automatically.
118
+
119
+ ### Server presets
120
+
121
+ Already have presets on your imgproxy server? Reference them by name:
122
+
123
+ ```python
124
+ url = client.url(
125
+ 'https://example.com/photo.jpg',
126
+ presets=('thumbnail', 'watermarked'),
127
+ format='webp',
128
+ )
129
+ ```
130
+
131
+ Use either a Python `transform` or server `presets` in each call.
132
+ For Python transforms, set `format` on `Transform`; for presets, pass it to
133
+ `client.url()`.
134
+
135
+ ## Contributing
136
+
137
+ See the [contributing guide](CONTRIBUTING.md) for development setup and checks.
138
+ Bug reports and feature requests are welcome on the
139
+ [issue tracker](https://github.com/kondratevdev/imgproxykit/issues).
140
+
141
+ ## License
142
+
143
+ [MIT](LICENSE)
144
+
145
+ ## Credits
146
+
147
+ Generated with
148
+ [`wemake-python-package`](https://github.com/wemake-services/wemake-python-package)
149
+ ([template version](https://github.com/wemake-services/wemake-python-package/tree/47d9dddd29da8d6d3d1a403f8a143b323a812083)).
150
+
@@ -0,0 +1,62 @@
1
+ imgproxykit/__init__.py,sha256=pC8RvaQYaeT2-Ete16P8gnvmTH1Or-JEx0vjymXsvqw,105
2
+ imgproxykit/builders.py,sha256=pW0iYMeQh4dZ3Z6A1ng5gjnV49TkMS-0lLiPSmMqMt0,4617
3
+ imgproxykit/client.py,sha256=zNWZ6pftNCPmvy8o21NV51pRWMiVcfJlrPdSr1lZ6kc,5825
4
+ imgproxykit/internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ imgproxykit/internal/constants.py,sha256=ixwWAgQZGmKpjL0017hVjFz8NMqKDP2cSoV7F8dCxNw,308
6
+ imgproxykit/internal/empty.py,sha256=ZMHXhtB-NE3D5b8perf2VNobGfR3BN72VcAKbKyIStw,279
7
+ imgproxykit/internal/encoding.py,sha256=uBO1gxNJf0u8L2OcgQL-hOGmOuSDgElQf7MEIK_vGxY,417
8
+ imgproxykit/internal/paths.py,sha256=ksLWpxnjALhwPhWI8O0RirlBusNLtLdkFa8udpDU2hI,700
9
+ imgproxykit/internal/serialization.py,sha256=6sihHCHPWR4zP2LAD7XUvKpduQVOqwlNbIf1M0U6H7I,1283
10
+ imgproxykit/options/__init__.py,sha256=8mH1qM4uHOYinztvzlWPzmYbPKk0_QhHl9d2PIQSgdc,3049
11
+ imgproxykit/options/auto_rotate.py,sha256=DywJWGGIQgkv0U6E0naXhZdNXDw5cK9b49ZN0cCi6A8,958
12
+ imgproxykit/options/background.py,sha256=cEGpMC5TqjQX8oY00_qJG47mm0SB3knrAriojFt1A5U,1292
13
+ imgproxykit/options/base.py,sha256=wkXztojelMLwJCwFd4l_ydDCbOkhWdP8Gv3w_O-W6l8,1252
14
+ imgproxykit/options/blur.py,sha256=lo0VJKlQ26aabShIcYKR_8xgAhFu7BnK7wO1GGs3miA,821
15
+ imgproxykit/options/cache_buster.py,sha256=wmIo0pBSQ_bIv1rsFg5hrS6Luc6h2rs77ArMF7KAj_0,1032
16
+ imgproxykit/options/crop.py,sha256=pwd0ybItX8-JQLAqcOPqtasoboXFBTdftf7NdNPMDT0,1847
17
+ imgproxykit/options/dpr.py,sha256=ZR-2fhYKXjE3irH6M-H51XsyU9IHTeviOfGDYHfIKvw,868
18
+ imgproxykit/options/enforce_thumbnail.py,sha256=aDaL6r3cMxcCRcqVO1A8IXIe8Gm-_d0tTJR9XGx-oaU,969
19
+ imgproxykit/options/enlarge.py,sha256=ppwkedl2NTrUzUw2vdzaGRmH9gFdQi68LtG3PC1wo08,873
20
+ imgproxykit/options/expires.py,sha256=9Tx6b6W-C4t-ma62UQWu2KGfgR1AuiatrQXRSMcGooQ,894
21
+ imgproxykit/options/extend.py,sha256=5zYhPoDPAKWZHWB6jRoWA0Z_da3eX-81d6fmXAK5j7U,1392
22
+ imgproxykit/options/extend_aspect_ratio.py,sha256=H-0izMubhs0xW1wqk_IPhXx-xBbD4d3zQrBrQs6Y9RQ,1447
23
+ imgproxykit/options/filename.py,sha256=5apkeX2cqwuKyne_5nuccXCTI9squP7XYSam6GbsKWw,1134
24
+ imgproxykit/options/flip.py,sha256=7ahYVqIMRKrMRcW9lQ0MkQqsdCNV3oaws0ceZ9ny7RE,1129
25
+ imgproxykit/options/format_quality.py,sha256=ebIO-7UVWNv5FGbW5xBkFcdPjIGA4SaYCGhn-WCSPZ8,1051
26
+ imgproxykit/options/gravity.py,sha256=Ix67v-TgRMjei_RNAqK9v3sLg_h0o5v0QSJaP_B9EdE,1349
27
+ imgproxykit/options/height.py,sha256=E-01ihdr30FmVeAWV3a1wf3R3B2F8jbbnih-scmspiA,890
28
+ imgproxykit/options/keep_copyright.py,sha256=RS0Mp9grKf8GpzjwQkWjKHL-juNGRXvl7yhkvHqCkVQ,900
29
+ imgproxykit/options/max_animation_frame_resolution.py,sha256=J7CqieF7iPZlePtHfP1Ygb6VgTkihMQ153rJk-F8vkg,1051
30
+ imgproxykit/options/max_animation_frames.py,sha256=idcjEEpFHLA3P9thH_0auvyKk0MKEEh_x7HPWk-JLZE,1000
31
+ imgproxykit/options/max_bytes.py,sha256=0Ll4JhjEBEWGtPVEroUr8UkMvWfsHPsR9vEo-wrBgkk,957
32
+ imgproxykit/options/max_result_dimension.py,sha256=tTAPlC-ZI_ryUWmZO0vCarprh90MOCpLyiAQKaAtLtU,1012
33
+ imgproxykit/options/max_src_file_size.py,sha256=DvuJ7jCF8R40WbybWCC1070aHqAmJXtsUA6-nGPR98U,992
34
+ imgproxykit/options/max_src_resolution.py,sha256=jmnE5bsrTP732G5gVFsZc-6L5FlNMgyBOtf4TRjwYgA,996
35
+ imgproxykit/options/min_height.py,sha256=cQjyPTgf3fii5Wp4JTaIfVbic0uGUaPahtUQQOkqX-A,867
36
+ imgproxykit/options/min_width.py,sha256=gisEoyO6k1cq1qT3KSqSTeutV8Rt8Rifg5uwgpMVVpI,860
37
+ imgproxykit/options/padding.py,sha256=tKzSdZWx_uouLS_1fM93fb7Rp9OXCKwzUK9xLI6hd9Q,1474
38
+ imgproxykit/options/pixelate.py,sha256=L28cyJJhQO4pmrVvh9Rq_3mjr4LbQ-5CXlFaYR_-Nss,837
39
+ imgproxykit/options/preserve_hdr.py,sha256=kQFo17y-BkfnAsLJvEft-gc_k7RqcBROQ31loAXtWA8,909
40
+ imgproxykit/options/quality.py,sha256=A2zj36rul_bhinYQte5SFRwkVHqSX6qclu-cWolesKA,811
41
+ imgproxykit/options/raw.py,sha256=yj90l-BcOMNPu4VFIGRnnsHOtC31dcHMVIjcy5JHbI8,895
42
+ imgproxykit/options/resize.py,sha256=iXFYO68HAsMIe2EU9KHRR4odyYnOiIqONisdYhVh3Bo,1505
43
+ imgproxykit/options/resizing_type.py,sha256=XOsSTXCVXof1ARrDatO-e1wSbuHdKTsJsEu2wH1BU3c,948
44
+ imgproxykit/options/return_attachment.py,sha256=KkGrWS8Molbz2xkYZmBVKdKkfCB-6YjW4wISDQtj1rs,978
45
+ imgproxykit/options/rotate.py,sha256=AdQdr1u3KtgWJaaO6PdJj-nMkEXBs2fEAgqGn-UDerw,881
46
+ imgproxykit/options/sharpen.py,sha256=FagO74_OGq59yP5njfKjlZvfAFAlM4gkvPgKti-QrFs,831
47
+ imgproxykit/options/size.py,sha256=SqvQx-PAHsqWprzuGDxC6-yGM0rJFK9_51UDXqL35eU,1259
48
+ imgproxykit/options/skip_processing.py,sha256=M6bLjKOLEHxGERhhQO4eGqy3SwjNqtiIdnHPm4Z_gVQ,1054
49
+ imgproxykit/options/strip_color_profile.py,sha256=DO2HWtrtOZxP9Qav-mZgGXmDtoMLfparRaoIbF7g3c0,1007
50
+ imgproxykit/options/strip_metadata.py,sha256=JqBNCQRqAspUJdUPVVJx0Bx4ZXaYEFEnQL2pctJisos,887
51
+ imgproxykit/options/trim.py,sha256=63zOwBE9R7FbxLUhQ-N0uwtoJ8eE00ZgxJjcmTsBxWo,1554
52
+ imgproxykit/options/watermark.py,sha256=-DmoIFqidMGTSkBLhdn2uZvGi4aoWPzq9fvfnGRO3-Q,1820
53
+ imgproxykit/options/width.py,sha256=0ApWI7dvDolilLYWIJUq9wFdMU9Hk1muja3gmyE4hec,883
54
+ imgproxykit/options/zoom.py,sha256=wXAERiDFsj8YjgqVb9SqB2pYFNg-WPciO3uE4N5BrKc,1175
55
+ imgproxykit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
+ imgproxykit/signing.py,sha256=NXDMgBJ3nMa2vVQw8RcbZKI33b2EGHCN_87Ip_sAiBo,3506
57
+ imgproxykit/transform.py,sha256=jQEzNhVDd_Qsv1q5Dj-me73vHrkxtKObOvJa7J7ELxM,1914
58
+ imgproxykit/types.py,sha256=6bvlBxWwEcEjH0EWCcaXsMVuGJmpj9QgOvn0DWIEV-w,1152
59
+ imgproxykit-0.1.0.dist-info/METADATA,sha256=A-3QXBSf0gSL3KKobdyWvVjKFi5JJ1GZqzhEkAPqtbQ,4401
60
+ imgproxykit-0.1.0.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
61
+ imgproxykit-0.1.0.dist-info/licenses/LICENSE,sha256=DzvzsPqXVDlrI6vxhAAz4V9pipn3KwZ0kUCKb_2Fptk,1076
62
+ imgproxykit-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.5.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alexander Kondratev
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.