djhtmx 1.1.1__py3-none-any.whl → 1.1.2__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.
djhtmx/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  from .middleware import middleware
2
2
 
3
- __version__ = "1.1.1"
3
+ __version__ = "1.1.2"
4
4
  __all__ = ("middleware",)
djhtmx/introspection.py CHANGED
@@ -419,9 +419,12 @@ def is_simple_annotation(ann):
419
419
 
420
420
 
421
421
  def is_collection_annotation(ann):
422
- return issubclass_safe(ann, _COLLECTION_TYPES)
422
+ if isinstance(ann, types.GenericAlias):
423
+ return issubclass_safe(ann.__origin__, _COLLECTION_TYPES)
424
+ else:
425
+ return issubclass_safe(ann, _COLLECTION_TYPES)
423
426
 
424
427
 
425
428
  Unset = object()
426
429
  _SIMPLE_TYPES = (int, str, float, UUID, types.NoneType, date, datetime, bool)
427
- _COLLECTION_TYPES = (dict, tuple, list, set)
430
+ _COLLECTION_TYPES = (dict, tuple, list, set, defaultdict)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: djhtmx
3
- Version: 1.1.1
3
+ Version: 1.1.2
4
4
  Summary: Interactive UI Components for Django using HTMX
5
5
  Project-URL: Homepage, https://github.com/edelvalle/djhtmx
6
6
  Project-URL: Documentation, https://github.com/edelvalle/djhtmx#readme
@@ -66,6 +66,20 @@ pip install djhtmx
66
66
 
67
67
  # Configuration
68
68
 
69
+ ## Requirements
70
+
71
+ djhtmx requires **Redis** to be running for session storage and component state management.
72
+
73
+ **Important**: Redis is not included with djhtmx and must be installed separately on your system. Make sure Redis is installed and accessible before using djhtmx.
74
+
75
+ ### Installing Redis
76
+
77
+ - **macOS**: `brew install redis`
78
+ - **Ubuntu/Debian**: `sudo apt-get install redis-server`
79
+ - **CentOS/RHEL**: `sudo yum install redis` or `sudo dnf install redis`
80
+ - **Docker**: `docker run -d -p 6379:6379 redis:alpine`
81
+ - **Windows**: Download from [Redis for Windows](https://github.com/microsoftarchive/redis/releases)
82
+
69
83
  Add `djhtmx` to your `INSTALLED_APPS`.
70
84
 
71
85
  ```python
@@ -116,6 +130,40 @@ urlpatterns = [
116
130
  ]
117
131
  ```
118
132
 
133
+ ## Settings
134
+
135
+ djhtmx can be configured through Django settings:
136
+
137
+ ### Required Settings
138
+
139
+ - **`DJHTMX_REDIS_URL`** (default: `"redis://localhost/0"`): Redis connection URL for session storage and component state management.
140
+
141
+ ### Optional Settings
142
+
143
+ - **`DJHTMX_SESSION_TTL`** (default: `3600`): Session timeout in seconds. Can be an integer or a `datetime.timedelta` object.
144
+ - **`DJHTMX_DEFAULT_LAZY_TEMPLATE`** (default: `"htmx/lazy.html"`): Default template for lazy-loaded components.
145
+ - **`DJHTMX_ENABLE_SENTRY_TRACING`** (default: `True`): Enable Sentry tracing integration.
146
+ - **`DJHTMX_ENABLE_LOGFIRE_TRACING`** (default: `False`): Enable Logfire tracing integration.
147
+ - **`DJHTMX_STRICT_EVENT_HANDLER_CONSISTENCY_CHECK`** (default: `False`): Enable strict consistency checking for event handlers.
148
+ - **`DJHTMX_KEY_SIZE_ERROR_THRESHOLD`** (default: `0`): Threshold in bytes for session key size errors (0 = disabled).
149
+ - **`DJHTMX_KEY_SIZE_WARN_THRESHOLD`** (default: `51200`): Threshold in bytes for session key size warnings (50KB).
150
+ - **`DJHTMX_KEY_SIZE_SAMPLE_PROB`** (default: `0.1`): Probability for sampling session key size checks.
151
+
152
+ ### Example Configuration
153
+
154
+ ```python
155
+ # settings.py
156
+
157
+ # Redis connection (required)
158
+ DJHTMX_REDIS_URL = "redis://localhost:6379/0" # or redis://user:password@host:port/db
159
+
160
+ # Optional settings
161
+ DJHTMX_SESSION_TTL = 7200 # 2 hours
162
+ DJHTMX_DEFAULT_LAZY_TEMPLATE = "my_app/lazy_component.html"
163
+ DJHTMX_ENABLE_SENTRY_TRACING = True
164
+ DJHTMX_KEY_SIZE_WARN_THRESHOLD = 100 * 1024 # 100KB
165
+ ```
166
+
119
167
  In your base template you need to load the necessary scripts to make this work
120
168
 
121
169
  ```html
@@ -130,6 +178,10 @@ In your base template you need to load the necessary scripts to make this work
130
178
 
131
179
  ## Getting started
132
180
 
181
+ **Important**: djhtmx is a framework for building interactive components, not a component library. No pre-built components, templates, or behaviors are provided. You need to create your own components from scratch using the framework's base classes and conventions.
182
+
183
+ This library is opinionated about how to use HTMX with Django, but it is not opinionated about components, styling, or specific functionality. You have complete freedom to design and implement your components as needed for your application.
184
+
133
185
  This app will look for `htmx.py` files in your app and registers all components found there, but if you load any module where you have components manually when Django boots up, that also works.
134
186
 
135
187
  ```python
@@ -1,4 +1,4 @@
1
- djhtmx/__init__.py,sha256=xrcVGamFk6KoJqtBJy3ACEWX66jWJTfebnCGNPZcAu8,84
1
+ djhtmx/__init__.py,sha256=FJ6V7xlcgRBLI2mcRzdK5-zP1d1bUGHrkeqdTtUUOE0,84
2
2
  djhtmx/apps.py,sha256=_Ic52zQLpbYmyuCAlgZ0lF3NDgi77sxptb31snBAN4o,268
3
3
  djhtmx/command_queue.py,sha256=kiYbQFPyjnhMSR7KgO1Nu-lWiapnH511P2Pyg-Zrdq4,4862
4
4
  djhtmx/commands.py,sha256=UxXbARd4Teetjh_zjvAWgI2KNbvdETH-WrGf4qD9Xr8,1206
@@ -7,7 +7,7 @@ djhtmx/consumer.py,sha256=kHNoXokcWaFjs5zbZAhM7Y0x7GVwwawXbxBCkP8HNA8,2839
7
7
  djhtmx/context.py,sha256=cWvz8Z0MC6x_G8sn5mvoH8Hu38qReY21_eNdThuba1A,214
8
8
  djhtmx/exceptions.py,sha256=UtyE1N-52OmzwgRM9xFxjUuhHTMDvD7Oy3rNpgthLcs,47
9
9
  djhtmx/global_events.py,sha256=bYb8WmQn_WsZ_Dadr0pGiGOPia01K-VanPpM97Lt324,342
10
- djhtmx/introspection.py,sha256=HAc4iRxAzEW1n0Oyb1yEW7K80lLhQhZdTHGwVOMong0,13294
10
+ djhtmx/introspection.py,sha256=OVNaQ8r6G13HMftydfW2UVCfs2dzy34HET2Tb7bGnN4,13431
11
11
  djhtmx/json.py,sha256=7cjwWIJj7e0dk54INKYZJe6zKkIW7wlsNSlD05cbXfY,1374
12
12
  djhtmx/middleware.py,sha256=JuMtv9ZnpungTvQ1qD2Lg6LiFPB3knQlA1ERgH4iGl0,1274
13
13
  djhtmx/query.py,sha256=UyjN1jokh4wTwQJxcRwA9f-Zn-A7A4GLToeGrCnPhKA,6674
@@ -30,7 +30,7 @@ djhtmx/templates/htmx/headers.html,sha256=rBQTBt9rnlxE8lgxN4U7nvzQZNw4JZKS4flD1V
30
30
  djhtmx/templates/htmx/lazy.html,sha256=LfAThtKmFj-lCUZ7JWF_sC1Y6XsIpEz8A3IgWASn-J8,52
31
31
  djhtmx/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  djhtmx/templatetags/htmx.py,sha256=HlH7_B9lJoTDoIkYPeEE55OwpBTrrCesE70j1KcRC70,8063
33
- djhtmx-1.1.1.dist-info/METADATA,sha256=NMrxVSCGCi-0f4X5jWgClss_sMFM_M8vZ7Yx3mipc28,28777
34
- djhtmx-1.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
35
- djhtmx-1.1.1.dist-info/licenses/LICENSE,sha256=kCi_iSBUGsRZInQn96w7LXYzjiRjZ8FXl6vP--mFRPk,1085
36
- djhtmx-1.1.1.dist-info/RECORD,,
33
+ djhtmx-1.1.2.dist-info/METADATA,sha256=vmEvS7oSkUGd2P-AI6cgBFJ2zCABXjYRWeWmACPmmbY,31423
34
+ djhtmx-1.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
35
+ djhtmx-1.1.2.dist-info/licenses/LICENSE,sha256=kCi_iSBUGsRZInQn96w7LXYzjiRjZ8FXl6vP--mFRPk,1085
36
+ djhtmx-1.1.2.dist-info/RECORD,,
File without changes