python-ppa 0.1.5__py3-none-any.whl → 0.1.6__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.
- {python_ppa-0.1.5.dist-info → python_ppa-0.1.6.dist-info}/METADATA +10 -10
- {python_ppa-0.1.5.dist-info → python_ppa-0.1.6.dist-info}/RECORD +5 -5
- {python_ppa-0.1.5.dist-info → python_ppa-0.1.6.dist-info}/WHEEL +0 -0
- {python_ppa-0.1.5.dist-info → python_ppa-0.1.6.dist-info}/licenses/LICENSE +0 -0
- {python_ppa-0.1.5.dist-info → python_ppa-0.1.6.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-ppa
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
4
4
|
Summary: JPA-like ORM for Python
|
|
5
5
|
Author: Pratyush Kumar
|
|
6
6
|
License-Expression: MIT
|
|
@@ -20,9 +20,9 @@ Requires-Dist: typing-inspection==0.4.2
|
|
|
20
20
|
Requires-Dist: typing_extensions==4.15.0
|
|
21
21
|
Dynamic: license-file
|
|
22
22
|
|
|
23
|
-
# python-
|
|
23
|
+
# python-ppa
|
|
24
24
|
|
|
25
|
-
`python-
|
|
25
|
+
`python-ppa` is a lightweight, Spring Data ppa-inspired Object-Document Mapper (ODM) for MongoDB built on top of **Python 3.13+**, **Pydantic v2**, and **PyMongo**.
|
|
26
26
|
|
|
27
27
|
It uses advanced Python metaprogramming (`metaclass`) to dynamically generate MongoDB queries at runtime based on method naming conventions or explicit query declarations, drastically reducing boilerplate code.
|
|
28
28
|
|
|
@@ -30,7 +30,7 @@ It uses advanced Python metaprogramming (`metaclass`) to dynamically generate Mo
|
|
|
30
30
|
|
|
31
31
|
## 🚀 Features
|
|
32
32
|
|
|
33
|
-
* **
|
|
33
|
+
* **ppa-Like Repository Pattern:** Declare an interface, and let the metaclass handle query assembly dynamically.
|
|
34
34
|
* **Query Naming Conventions:** Instantly supports `find_by_*`, `find_all_by_*`, `exists_by_*`, and `count_by_*` pattern resolutions.
|
|
35
35
|
* **Custom Query Annotations:** Bind complex MongoDB query templates with custom parameter injections using the `@query` decorator.
|
|
36
36
|
* **Data Validation:** Fully powered by Pydantic v2 for robust runtime type checking and parsing.
|
|
@@ -44,7 +44,7 @@ It uses advanced Python metaprogramming (`metaclass`) to dynamically generate Mo
|
|
|
44
44
|
```text
|
|
45
45
|
.
|
|
46
46
|
├── README.md
|
|
47
|
-
├──
|
|
47
|
+
├── ppa
|
|
48
48
|
│ ├── __init__.py
|
|
49
49
|
│ ├── config.py # App bootstrapping, YAML parsing & environment mapping
|
|
50
50
|
│ └── mongo
|
|
@@ -57,7 +57,7 @@ It uses advanced Python metaprogramming (`metaclass`) to dynamically generate Mo
|
|
|
57
57
|
Prerequisites
|
|
58
58
|
• Python 3.13 or higher
|
|
59
59
|
Installation & Virtual Env Setup
|
|
60
|
-
1. Clone the repository and navigate to its root: cd python-
|
|
60
|
+
1. Clone the repository and navigate to its root: cd python-ppa
|
|
61
61
|
2. Spin up a virtual environment and update your pip core dependencies: python3 -m venv venv source venv/bin/activate # On Windows use: venv\Scripts\activate pip install --upgrade pip
|
|
62
62
|
3. Install the project library dependencies: pip install -r requirements.txt
|
|
63
63
|
⚙️ Configuration Management
|
|
@@ -70,7 +70,7 @@ app:
|
|
|
70
70
|
2. Environment Profile Configuration (resources/settings-dev.yml)
|
|
71
71
|
mongodb:
|
|
72
72
|
uri: ${MONGO_URI:mongodb://localhost:27017}
|
|
73
|
-
database: ${MONGO_DB_NAME:
|
|
73
|
+
database: ${MONGO_DB_NAME:ppa_database}
|
|
74
74
|
|
|
75
75
|
framework:
|
|
76
76
|
logging:
|
|
@@ -81,7 +81,7 @@ framework:
|
|
|
81
81
|
Here is a quick overview of how you can configure a domain entity and generate auto-implemented interface pipelines:
|
|
82
82
|
1. Define your Document Model
|
|
83
83
|
from pydantic import Field
|
|
84
|
-
from
|
|
84
|
+
from ppa.mongo.interface import DocumentModel, document
|
|
85
85
|
|
|
86
86
|
@document(name="users")
|
|
87
87
|
class User(DocumentModel):
|
|
@@ -92,7 +92,7 @@ class User(DocumentModel):
|
|
|
92
92
|
|
|
93
93
|
2. Declare your Interface Repository
|
|
94
94
|
By extending IRepository[T], method naming patterns are captured and converted into database interactions seamlessly.
|
|
95
|
-
from
|
|
95
|
+
from ppa.mongo.interface import IRepository, query
|
|
96
96
|
from typing import List, Optional
|
|
97
97
|
|
|
98
98
|
class UserRepository(IRepository[User]):
|
|
@@ -107,7 +107,7 @@ class UserRepository(IRepository[User]):
|
|
|
107
107
|
def find_by_email_and_min_age(self, email: str, min_age: int) -> List[User]: ...
|
|
108
108
|
|
|
109
109
|
3. Execute CRUD Actions
|
|
110
|
-
from
|
|
110
|
+
from ppa.config import close_db_connection
|
|
111
111
|
|
|
112
112
|
# Initialize repository instance
|
|
113
113
|
user_repo = UserRepository()
|
|
@@ -2,8 +2,8 @@ ppa/__init__.py,sha256=hPJEX6p9ISqFn9oCk29_HIZYIFVUF_XLEk02dg5fl9c,44
|
|
|
2
2
|
ppa/config.py,sha256=BpnjdXIYjKe7P8HGKFwZkkTbHf94734dhuT1ki4x0UM,8430
|
|
3
3
|
ppa/mongo/__init__.py,sha256=tioeX330txLUWpEyAuj8rCO6C8DISjRkNFVDs8wGe54,168
|
|
4
4
|
ppa/mongo/interface.py,sha256=lKDtd1KOXIjl9gKPGP_WVoKsE54_esJadNqKIHTadcw,12684
|
|
5
|
-
python_ppa-0.1.
|
|
6
|
-
python_ppa-0.1.
|
|
7
|
-
python_ppa-0.1.
|
|
8
|
-
python_ppa-0.1.
|
|
9
|
-
python_ppa-0.1.
|
|
5
|
+
python_ppa-0.1.6.dist-info/licenses/LICENSE,sha256=J2MOuVHjIUNmdrDLa3O35gQz6E_wAJh9Ke3dod_ZDWc,1071
|
|
6
|
+
python_ppa-0.1.6.dist-info/METADATA,sha256=KJ2JYTZDnJMWAL24j0A28kDJlAHST4yKU3KxXHMAqgg,4903
|
|
7
|
+
python_ppa-0.1.6.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
8
|
+
python_ppa-0.1.6.dist-info/top_level.txt,sha256=43G6at2pfqB1LsMChCc2_K8WwSSt-LoYBAYN6Sf-krk,4
|
|
9
|
+
python_ppa-0.1.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|