winidjango 2.0.31__py3-none-any.whl → 2.0.55__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.
- winidjango/__init__.py +18 -14
- winidjango/dev/cli/shared_subcommands.py +8 -0
- winidjango/dev/management/__init__.py +5 -0
- {winidjango-2.0.31.dist-info → winidjango-2.0.55.dist-info}/METADATA +48 -17
- {winidjango-2.0.31.dist-info → winidjango-2.0.55.dist-info}/RECORD +8 -6
- {winidjango-2.0.31.dist-info → winidjango-2.0.55.dist-info}/WHEEL +1 -1
- {winidjango-2.0.31.dist-info → winidjango-2.0.55.dist-info}/entry_points.txt +0 -0
- {winidjango-2.0.31.dist-info → winidjango-2.0.55.dist-info}/licenses/LICENSE +0 -0
winidjango/__init__.py
CHANGED
|
@@ -7,6 +7,8 @@ import django
|
|
|
7
7
|
import django_stubs_ext
|
|
8
8
|
from django.conf import settings
|
|
9
9
|
|
|
10
|
+
import winidjango
|
|
11
|
+
|
|
10
12
|
logger = logging.getLogger(__name__)
|
|
11
13
|
|
|
12
14
|
django_stubs_ext.monkeypatch()
|
|
@@ -18,17 +20,19 @@ logger = logging.getLogger(__name__)
|
|
|
18
20
|
|
|
19
21
|
# Configure Django settings for tests if not already configured
|
|
20
22
|
if not settings.configured:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
in_this_repo = Path(winidjango.__name__).exists()
|
|
24
|
+
if in_this_repo:
|
|
25
|
+
logger.info("Configuring minimal django settings for tests")
|
|
26
|
+
installed_apps = ["tests"] if Path("tests").exists() else []
|
|
27
|
+
settings.configure(
|
|
28
|
+
DATABASES={
|
|
29
|
+
"default": {
|
|
30
|
+
"ENGINE": "django.db.backends.sqlite3",
|
|
31
|
+
"NAME": ":memory:",
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
INSTALLED_APPS=installed_apps,
|
|
35
|
+
USE_TZ=True,
|
|
36
|
+
)
|
|
37
|
+
django.setup()
|
|
38
|
+
logger.info("Django setup complete")
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""Shared commands for the CLI.
|
|
2
|
+
|
|
3
|
+
This module provides shared CLI commands that can be used by multiple
|
|
4
|
+
packages in a multi-package architecture. These commands are automatically
|
|
5
|
+
discovered and added to the CLI by pyrig.
|
|
6
|
+
Example is version command that is available in all packages.
|
|
7
|
+
uv run my-awesome-project version will return my-awesome-project version 0.1.0
|
|
8
|
+
"""
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: winidjango
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.55
|
|
4
4
|
Summary: A utils package for django
|
|
5
|
+
Keywords:
|
|
5
6
|
Author: Winipedia
|
|
6
7
|
License-Expression: MIT
|
|
7
8
|
License-File: LICENSE
|
|
8
9
|
Classifier: Programming Language :: Python :: 3.12
|
|
9
10
|
Classifier: Programming Language :: Python :: 3.13
|
|
10
11
|
Classifier: Programming Language :: Python :: 3.14
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Typing :: Typed
|
|
11
14
|
Requires-Dist: django
|
|
12
15
|
Requires-Dist: django-stubs-ext
|
|
13
16
|
Requires-Dist: winiutils
|
|
17
|
+
Maintainer: Winipedia
|
|
14
18
|
Requires-Python: >=3.12
|
|
19
|
+
Project-URL: Changelog, https://github.com/Winipedia/winidjango/releases
|
|
20
|
+
Project-URL: Documentation, https://Winipedia.github.io/winidjango
|
|
21
|
+
Project-URL: Homepage, https://github.com/Winipedia/winidjango
|
|
22
|
+
Project-URL: Issues, https://github.com/Winipedia/winidjango/issues
|
|
23
|
+
Project-URL: Source, https://github.com/Winipedia/winidjango
|
|
15
24
|
Description-Content-Type: text/markdown
|
|
16
25
|
|
|
17
26
|
# winidjango
|
|
@@ -19,21 +28,25 @@ Description-Content-Type: text/markdown
|
|
|
19
28
|
<!-- tooling -->
|
|
20
29
|
[](https://github.com/Winipedia/pyrig)
|
|
21
30
|
[](https://github.com/astral-sh/uv)
|
|
31
|
+
[](https://podman.io/)
|
|
22
32
|
[](https://pre-commit.com/)
|
|
33
|
+
[](https://www.mkdocs.org/)
|
|
23
34
|
<!-- code-quality -->
|
|
24
35
|
[](https://github.com/astral-sh/ruff)
|
|
25
|
-
[](https://github.com/astral-sh/ty)
|
|
36
|
+
[](https://github.com/astral-sh/ty)
|
|
26
37
|
[](https://github.com/PyCQA/bandit)
|
|
27
38
|
[](https://pytest.org/)
|
|
28
39
|
[](https://codecov.io/gh/Winipedia/winidjango)
|
|
40
|
+
[](https://github.com/rvben/rumdl)
|
|
29
41
|
<!-- package-info -->
|
|
30
|
-
[](https://pypi.org/project/winidjango
|
|
42
|
+
[](https://pypi.org/project/winidjango)
|
|
31
43
|
[](https://www.python.org/)
|
|
32
44
|
[](https://github.com/Winipedia/winidjango/blob/main/LICENSE)
|
|
33
45
|
<!-- ci/cd -->
|
|
34
46
|
[](https://github.com/Winipedia/winidjango/actions/workflows/health_check.yaml)
|
|
35
47
|
[](https://github.com/Winipedia/winidjango/actions/workflows/release.yaml)
|
|
36
|
-
|
|
48
|
+
<!-- documentation -->
|
|
49
|
+
[](https://Winipedia.github.io/winidjango)
|
|
37
50
|
|
|
38
51
|
---
|
|
39
52
|
|
|
@@ -41,7 +54,6 @@ Description-Content-Type: text/markdown
|
|
|
41
54
|
|
|
42
55
|
---
|
|
43
56
|
|
|
44
|
-
|
|
45
57
|
## Table of Contents
|
|
46
58
|
|
|
47
59
|
- [Features](#features)
|
|
@@ -57,26 +69,38 @@ Description-Content-Type: text/markdown
|
|
|
57
69
|
## Features
|
|
58
70
|
|
|
59
71
|
### 🚀 High-Performance Bulk Operations
|
|
60
|
-
|
|
61
|
-
- **
|
|
62
|
-
|
|
63
|
-
- **
|
|
72
|
+
|
|
73
|
+
- **Multithreaded Processing**:
|
|
74
|
+
Parallel execution of database operations for maximum speed
|
|
75
|
+
- **Automatic Chunking**:
|
|
76
|
+
Configurable batch sizes (default: 1000) for memory-efficient processing
|
|
77
|
+
- **Transaction Safety**:
|
|
78
|
+
Atomic operations with intelligent transaction management
|
|
79
|
+
- **Dependency Resolution**:
|
|
80
|
+
Automatic topological sorting for foreign key relationships
|
|
64
81
|
|
|
65
82
|
### 🛠️ Database Utilities
|
|
83
|
+
|
|
66
84
|
- **Bulk Create/Update/Delete**: Process thousands of records efficiently
|
|
67
|
-
- **Deletion Simulation**:
|
|
68
|
-
|
|
85
|
+
- **Deletion Simulation**:
|
|
86
|
+
Preview cascade effects before executing destructive operations
|
|
87
|
+
- **Bulk Comparison**:
|
|
88
|
+
Detect differences between datasets with field-level hashing
|
|
69
89
|
- **Raw SQL Execution**: Safe parameter binding with automatic cursor management
|
|
70
90
|
|
|
71
91
|
### 📦 Model Utilities
|
|
72
|
-
|
|
92
|
+
|
|
93
|
+
- **BaseModel**:
|
|
94
|
+
Abstract base with `created_at`, `updated_at`, and type-safe `meta` property
|
|
73
95
|
- **Topological Sorting**: Automatic dependency ordering for model operations
|
|
74
96
|
- **Field Introspection**: Type-safe utilities for working with model fields
|
|
75
97
|
|
|
76
98
|
### 🎯 Management Command Framework
|
|
99
|
+
|
|
77
100
|
- **ABCBaseCommand**: Template method pattern with automatic logging
|
|
78
101
|
- **ImportDataBaseCommand**: Structured data import with Polars integration
|
|
79
|
-
- **Built-in Arguments**:
|
|
102
|
+
- **Built-in Arguments**:
|
|
103
|
+
Standard options for dry-run, batch size, threading, and more
|
|
80
104
|
- **Type Safety**: Full type hints with abstract method enforcement
|
|
81
105
|
|
|
82
106
|
## Installation
|
|
@@ -160,7 +184,9 @@ class ImportUsersCommand(ImportDataBaseCommand):
|
|
|
160
184
|
def get_cleaning_df_cls(self) -> type[CleaningDF]:
|
|
161
185
|
return MyCleaningDF
|
|
162
186
|
|
|
163
|
-
def get_bulks_by_model(
|
|
187
|
+
def get_bulks_by_model(
|
|
188
|
+
self, df: pl.DataFrame
|
|
189
|
+
) -> dict[type[Model], Iterable[Model]]:
|
|
164
190
|
users = [User(name=row["name"]) for row in df.iter_rows(named=True)]
|
|
165
191
|
return {User: users}
|
|
166
192
|
```
|
|
@@ -169,7 +195,8 @@ class ImportUsersCommand(ImportDataBaseCommand):
|
|
|
169
195
|
|
|
170
196
|
Comprehensive documentation is available in the [`docs/`](docs/) directory:
|
|
171
197
|
|
|
172
|
-
- **[Database Utilities](docs/db.md)**
|
|
198
|
+
- **[Database Utilities](docs/db.md)**
|
|
199
|
+
- Bulk operations, model utilities, and SQL helpers
|
|
173
200
|
- **[Management Commands](docs/commands.md)** - Command framework and data import patterns
|
|
174
201
|
- **[API Reference](docs/index.md)** - Complete API documentation
|
|
175
202
|
|
|
@@ -201,6 +228,7 @@ pre-commit install
|
|
|
201
228
|
### Code Quality
|
|
202
229
|
|
|
203
230
|
This project uses:
|
|
231
|
+
|
|
204
232
|
- **mypy**: Strict type checking
|
|
205
233
|
- **ruff**: Linting and formatting
|
|
206
234
|
- **bandit**: Security analysis
|
|
@@ -235,7 +263,9 @@ pytest tests/test_winidjango/test_src/test_db/test_bulk.py
|
|
|
235
263
|
|
|
236
264
|
## Contributing
|
|
237
265
|
|
|
238
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
266
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
267
|
+
For major changes, please open an issue first
|
|
268
|
+
to discuss what you would like to change.
|
|
239
269
|
|
|
240
270
|
1. Fork the repository
|
|
241
271
|
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
@@ -245,7 +275,8 @@ Contributions are welcome! Please feel free to submit a Pull Request. For major
|
|
|
245
275
|
|
|
246
276
|
## License
|
|
247
277
|
|
|
248
|
-
This project is licensed under the MIT License
|
|
278
|
+
This project is licensed under the MIT License,
|
|
279
|
+
see the [LICENSE](LICENSE) file for details.
|
|
249
280
|
|
|
250
281
|
## Acknowledgments
|
|
251
282
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
winidjango/__init__.py,sha256=
|
|
1
|
+
winidjango/__init__.py,sha256=cbh5Y743eDQHW25CF2WyW6EM_CGEK5jU9bBBwtoqbVA,973
|
|
2
2
|
winidjango/dev/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
3
3
|
winidjango/dev/builders/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
4
4
|
winidjango/dev/cli/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
5
|
+
winidjango/dev/cli/shared_subcommands.py,sha256=3sJl1DD-DVRok2BXFWjncF_NLnMZL_NLqMWozmQm390,365
|
|
5
6
|
winidjango/dev/cli/subcommands.py,sha256=iurWZwJwEKAfGpfjkn1YOhnRbIruCB4ouE-8R_Lh3JY,228
|
|
6
7
|
winidjango/dev/configs/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
7
8
|
winidjango/dev/configs/configs.py,sha256=N85kVaRHCHXc-ny0jbuYQwTcrxQJx_X_BcG30IcyrGw,586
|
|
9
|
+
winidjango/dev/management/__init__.py,sha256=dZm5jWpCTZl7I44Ykr6S1_yU4ATNG5evtUL3DmGjCLs,193
|
|
8
10
|
winidjango/dev/tests/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
9
11
|
winidjango/dev/tests/fixtures/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
10
12
|
winidjango/main.py,sha256=TdxQpUtNZIiYCsEdysMlQW-1UNy0__WTax-Ot5E2eYQ,144
|
|
@@ -20,8 +22,8 @@ winidjango/src/db/bulk.py,sha256=5mJyGyt3vtu8cf-xji3dd2zxAU5eH0tuV85RjXIMriw,201
|
|
|
20
22
|
winidjango/src/db/fields.py,sha256=sa_qe36rQoh7zzsgbadsREKYOqzgx0WDar5tPdZ4rpE,2098
|
|
21
23
|
winidjango/src/db/models.py,sha256=LBdN1pbG4jp_yy_pEKdXxNd05ZXAVCkj7srvO-UE1vw,5750
|
|
22
24
|
winidjango/src/db/sql.py,sha256=MMiJyc8uhJ_4VcN2s6i8koNfvDKxsSv3Gpb_kD-01IE,1638
|
|
23
|
-
winidjango-2.0.
|
|
24
|
-
winidjango-2.0.
|
|
25
|
-
winidjango-2.0.
|
|
26
|
-
winidjango-2.0.
|
|
27
|
-
winidjango-2.0.
|
|
25
|
+
winidjango-2.0.55.dist-info/licenses/LICENSE,sha256=o316mE2gGzd__JT69p7S_zlOmKiHh8YjpImCCcWyTvM,1066
|
|
26
|
+
winidjango-2.0.55.dist-info/WHEEL,sha256=RRVLqVugUmFOqBedBFAmA4bsgFcROUBiSUKlERi0Hcg,79
|
|
27
|
+
winidjango-2.0.55.dist-info/entry_points.txt,sha256=qM1ENsRWSLulhF8Cy92TeHW-4v8SAgzkRW7hNHXHG-4,55
|
|
28
|
+
winidjango-2.0.55.dist-info/METADATA,sha256=yGPABM2d9y90rVLunk5I0rgS2HRRlgI1N688CODA9Ak,9209
|
|
29
|
+
winidjango-2.0.55.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|