utkit 0.9.0__tar.gz → 0.10.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 (101) hide show
  1. {utkit-0.9.0 → utkit-0.10.0}/PKG-INFO +1 -1
  2. {utkit-0.9.0 → utkit-0.10.0}/pyproject.toml +1 -1
  3. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/docs/index.md +1 -1
  4. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/store/aws/s3.py +34 -11
  5. {utkit-0.9.0 → utkit-0.10.0}/README.md +0 -0
  6. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/__init__.py +0 -0
  7. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/api/rate_limit/__init__.py +0 -0
  8. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/api/rate_limit/error.py +0 -0
  9. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/api/rate_limit/middleware.py +0 -0
  10. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/api/schema/query.py +0 -0
  11. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/auth/__init__.py +0 -0
  12. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/cli/__init__.py +0 -0
  13. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/communication/__init__.py +0 -0
  14. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/communication/mail/__init__.py +0 -0
  15. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/communication/mail/smtp.py +0 -0
  16. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/core/logging.py +0 -0
  17. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/.gitignore +0 -0
  18. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/10042715452264249772 +0 -0
  19. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/10986014347042203044 +0 -0
  20. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/11038628458439117958 +0 -0
  21. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/11306067049371264785 +0 -0
  22. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/13386297405578974681 +0 -0
  23. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/15312684519617069940 +0 -0
  24. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/15661711846603463071 +0 -0
  25. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/16166828772222643061 +0 -0
  26. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/17695336329032716848 +0 -0
  27. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/17985671397626253671 +0 -0
  28. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/2940665334038842907 +0 -0
  29. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/3226154870166803660 +0 -0
  30. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/326316130724058699 +0 -0
  31. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/3476900567878811119 +0 -0
  32. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/3541202890535126406 +0 -0
  33. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/360188204203718330 +0 -0
  34. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/403326901327389294 +0 -0
  35. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/4969546423033644587 +0 -0
  36. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/5530722400779903482 +0 -0
  37. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/5696925338617156769 +0 -0
  38. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/5859600648538783245 +0 -0
  39. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/5974781288462474643 +0 -0
  40. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/5976522500417319979 +0 -0
  41. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/6210600303880993421 +0 -0
  42. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/6916343365748484443 +0 -0
  43. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/9033698058957892258 +0 -0
  44. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/9102534330981319844 +0 -0
  45. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.cache/9811225078116513287 +0 -0
  46. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.github/workflows/docs.yml +0 -0
  47. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/.gitignore +0 -0
  48. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/docs/api/rate-limit.md +0 -0
  49. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/docs/api/schema.md +0 -0
  50. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/docs/auth.md +0 -0
  51. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/docs/communication/mail.md +0 -0
  52. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/docs/core/logging.md +0 -0
  53. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/docs/images/logo-old.png +0 -0
  54. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/docs/images/logo.png +0 -0
  55. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/docs/privacy/mask.md +0 -0
  56. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/docs/privacy/security.md +0 -0
  57. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/docs/store/redis.md +0 -0
  58. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/docs/store/s3.md +0 -0
  59. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/docs/stylesheets/extra.css +0 -0
  60. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/docs/template/render.md +0 -0
  61. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/docs/utils/performance.md +0 -0
  62. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/docs/validators/data.md +0 -0
  63. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/404.html +0 -0
  64. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/api/rate-limit/index.html +0 -0
  65. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/api/schema/index.html +0 -0
  66. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/assets/images/favicon.png +0 -0
  67. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/assets/javascripts/LICENSE +0 -0
  68. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/assets/javascripts/bundle.dbc0afdc.min.js +0 -0
  69. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/assets/javascripts/workers/search.e2d2d235.min.js +0 -0
  70. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/assets/stylesheets/classic/main.a2001754.min.css +0 -0
  71. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/assets/stylesheets/classic/palette.7dc9a0ad.min.css +0 -0
  72. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/assets/stylesheets/modern/main.1e981d71.min.css +0 -0
  73. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/assets/stylesheets/modern/palette.dfe2e883.min.css +0 -0
  74. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/auth/index.html +0 -0
  75. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/communication/mail/index.html +0 -0
  76. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/core/logging/index.html +0 -0
  77. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/images/logo-old.png +0 -0
  78. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/images/logo.png +0 -0
  79. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/index.html +0 -0
  80. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/objects.inv +0 -0
  81. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/privacy/mask/index.html +0 -0
  82. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/privacy/security/index.html +0 -0
  83. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/search.json +0 -0
  84. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/sitemap.xml +0 -0
  85. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/store/redis/index.html +0 -0
  86. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/store/s3/index.html +0 -0
  87. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/stylesheets/extra.css +0 -0
  88. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/template/render/index.html +0 -0
  89. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/utils/performance/index.html +0 -0
  90. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/site/validators/data/index.html +0 -0
  91. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/documentation/zensical.toml +0 -0
  92. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/privacy/__init__.py +0 -0
  93. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/privacy/mask.py +0 -0
  94. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/privacy/security.py +0 -0
  95. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/store/aws/__init__.py +0 -0
  96. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/store/redis/__init__.py +0 -0
  97. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/template/__init__.py +0 -0
  98. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/template/render.py +0 -0
  99. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/utils/performance.py +0 -0
  100. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/validators/__init__.py +0 -0
  101. {utkit-0.9.0 → utkit-0.10.0}/src/utkit/validators/data.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: utkit
3
- Version: 0.9.0
3
+ Version: 0.10.0
4
4
  Summary: core libraries for development
5
5
  Author: TINS PJ
6
6
  Author-email: TINS PJ <tinspj1997@gmail.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "utkit"
3
- version = "0.9.0"
3
+ version = "0.10.0"
4
4
  description = "core libraries for development"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -83,7 +83,7 @@ utkit --version
83
83
  | typer | `>=0.20.0` | CLI framework |
84
84
  | cryptography | `>=47.0.0` | Fernet & RSA encryption |
85
85
  | loguru | `>=0.7.3` | Logging |
86
- | pwdlib[argon2] | `>=0.3.0` | Password hashing |
86
+ | pwdlib\[argon2\] | `>=0.3.0` | Password hashing |
87
87
  | pyjwt | `>=2.12.1` | JWT token creation & verification |
88
88
  | zensical | `>=0.0.37` | Documentation server |
89
89
 
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import mimetypes
3
4
  import os
4
5
  from dataclasses import dataclass
5
6
  from typing import Any
@@ -19,16 +20,19 @@ class S3Client:
19
20
  bucket: str,
20
21
  object_name: str | None = None,
21
22
  extra_args: dict | None = None,
23
+ content_type: str | None = None,
22
24
  ) -> bool:
23
- # If S3 object_name was not specified, use file_name
24
25
  if object_name is None:
25
26
  object_name = os.path.basename(file_name)
26
27
 
27
- # Upload the file
28
- if extra_args:
29
- self.client.upload_file(file_name, bucket, object_name, ExtraArgs=extra_args)
30
- else:
31
- self.client.upload_file(file_name, bucket, object_name)
28
+ if content_type is None:
29
+ content_type, _ = mimetypes.guess_type(file_name)
30
+
31
+ extra_args = extra_args or {}
32
+ if content_type:
33
+ extra_args["ContentType"] = content_type
34
+
35
+ self.client.upload_file(file_name, bucket, object_name, ExtraArgs=extra_args)
32
36
  return True
33
37
 
34
38
  def upload_fileobj(
@@ -37,11 +41,16 @@ class S3Client:
37
41
  bucket: str,
38
42
  object_name: str,
39
43
  extra_args: dict | None = None,
44
+ content_type: str | None = None,
40
45
  ) -> bool:
41
- if extra_args:
42
- self.client.upload_fileobj(file_obj, bucket, object_name, ExtraArgs=extra_args)
43
- else:
44
- self.client.upload_fileobj(file_obj, bucket, object_name)
46
+ if content_type is None:
47
+ content_type, _ = mimetypes.guess_type(object_name)
48
+
49
+ extra_args = extra_args or {}
50
+ if content_type:
51
+ extra_args["ContentType"] = content_type
52
+
53
+ self.client.upload_fileobj(file_obj, bucket, object_name, ExtraArgs=extra_args)
45
54
  return True
46
55
 
47
56
  def download_file(
@@ -75,10 +84,24 @@ class S3Client:
75
84
  bucket: str,
76
85
  object_name: str,
77
86
  expiration: int = 3600,
87
+ inline: bool = False,
88
+ content_type: str | None = None,
78
89
  ) -> str | None:
90
+ params: dict[str, Any] = {
91
+ "Bucket": bucket,
92
+ "Key": object_name,
93
+ }
94
+
95
+ if inline:
96
+ params["ResponseContentDisposition"] = "inline"
97
+ if content_type is None:
98
+ content_type, _ = mimetypes.guess_type(object_name)
99
+ if content_type:
100
+ params["ResponseContentType"] = content_type
101
+
79
102
  response = self.client.generate_presigned_url(
80
103
  "get_object",
81
- Params={"Bucket": bucket, "Key": object_name},
104
+ Params=params,
82
105
  ExpiresIn=expiration,
83
106
  )
84
107
  return response
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes