sqliter-py 0.12.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.
@@ -0,0 +1,209 @@
1
+ Metadata-Version: 2.4
2
+ Name: sqliter-py
3
+ Version: 0.12.0
4
+ Summary: Interact with SQLite databases using Python and Pydantic
5
+ Author: Grant Ramsay
6
+ Author-email: Grant Ramsay <grant@gnramsay.com>
7
+ License-Expression: MIT
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Database :: Front-Ends
20
+ Classifier: Topic :: Software Development
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Dist: pydantic>=2.12.5
23
+ Requires-Dist: inflect==7.0.0 ; extra == 'extras'
24
+ Requires-Python: >=3.9
25
+ Project-URL: Bug Tracker, https://github.com/seapagan/sqliter-py/issues
26
+ Project-URL: Changelog, https://github.com/seapagan/sqliter-py/blob/main/CHANGELOG.md
27
+ Project-URL: Homepage, http://sqliter.grantramsay.dev
28
+ Project-URL: Pull Requests, https://github.com/seapagan/sqliter-py/pulls
29
+ Project-URL: Repository, https://github.com/seapagan/sqliter-py
30
+ Provides-Extra: extras
31
+ Description-Content-Type: text/markdown
32
+
33
+ # SQLiter <!-- omit in toc -->
34
+
35
+ [![PyPI version](https://badge.fury.io/py/sqliter-py.svg)](https://badge.fury.io/py/sqliter-py)
36
+ [![Test Suite](https://github.com/seapagan/sqliter-py/actions/workflows/testing.yml/badge.svg)](https://github.com/seapagan/sqliter-py/actions/workflows/testing.yml)
37
+ [![Linting](https://github.com/seapagan/sqliter-py/actions/workflows/linting.yml/badge.svg)](https://github.com/seapagan/sqliter-py/actions/workflows/linting.yml)
38
+ [![Type Checking](https://github.com/seapagan/sqliter-py/actions/workflows/mypy.yml/badge.svg)](https://github.com/seapagan/sqliter-py/actions/workflows/mypy.yml)
39
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sqliter-py)
40
+
41
+ SQLiter is a lightweight Object-Relational Mapping (ORM) library for SQLite
42
+ databases in Python. It provides a simplified interface for interacting with
43
+ SQLite databases using Pydantic models. The only external run-time dependency
44
+ is Pydantic itself.
45
+
46
+ It does not aim to be a full-fledged ORM like SQLAlchemy, but rather a simple
47
+ and easy-to-use library for basic database operations, especially for small
48
+ projects. It is NOT asynchronous and does not support complex queries (at this
49
+ time).
50
+
51
+ The ideal use case is more for Python CLI tools that need to store data in a
52
+ database-like format without needing to learn SQL or use a full ORM.
53
+
54
+ Full documentation is available on the [Website](https://sqliter.grantramsay.dev)
55
+
56
+ > [!CAUTION]
57
+ >
58
+ > This project is still in the early stages of development and is lacking some
59
+ > planned functionality. Please use with caution - Classes and methods may
60
+ > change until a stable release is made. I'll try to keep this to an absolute
61
+ > minimum and the releases and documentation will be very clear about any
62
+ > breaking changes.
63
+ >
64
+ > See the [TODO](TODO.md) for planned features and improvements.
65
+
66
+ - [Features](#features)
67
+ - [Installation](#installation)
68
+ - [Optional Dependencies](#optional-dependencies)
69
+ - [Quick Start](#quick-start)
70
+ - [Contributing](#contributing)
71
+ - [License](#license)
72
+
73
+ ## Features
74
+
75
+ - Table creation based on Pydantic models
76
+ - Supports `date` and `datetime` fields
77
+ - Support for complex data types (`list`, `dict`, `set`, `tuple`) stored as
78
+ BLOBs
79
+ - Foreign key relationships with referential integrity and CASCADE actions
80
+ - Automatic primary key generation
81
+ - User defined indexes on any field
82
+ - Set any field as UNIQUE
83
+ - CRUD operations (Create, Read, Update, Delete)
84
+ - Chained Query building with filtering, ordering, and pagination
85
+ - Transaction support
86
+ - Optional query result caching with LRU eviction, TTL, and memory limits
87
+ - Custom exceptions for better error handling
88
+ - Full type hinting and type checking
89
+ - Detailed documentation and examples
90
+ - No external dependencies other than Pydantic
91
+ - Full test coverage
92
+ - Can optionally output the raw SQL queries being executed for debugging
93
+ purposes.
94
+
95
+ ## Installation
96
+
97
+ You can install SQLiter using whichever method you prefer or is compatible with
98
+ your project setup.
99
+
100
+ With `uv` which is rapidly becoming my favorite tool for managing projects and
101
+ virtual environments (`uv` is used for developing this project and in the CI):
102
+
103
+ ```bash
104
+ uv add sqliter-py
105
+ ```
106
+
107
+ With `Poetry`:
108
+
109
+ ```bash
110
+ poetry add sqliter-py
111
+ ```
112
+
113
+ Or with `pip`:
114
+
115
+ ```bash
116
+ pip install sqliter-py
117
+ ```
118
+
119
+ ### Optional Dependencies
120
+
121
+ Currently by default, the only external dependency is Pydantic. However, there
122
+ are some optional dependencies that can be installed to enable additional
123
+ features:
124
+
125
+ - `inflect`: For pluralizing the auto-generated table names (if not explicitly
126
+ set in the Model) This just offers a more-advanced pluralization than the
127
+ default method used. In most cases you will not need this.
128
+
129
+ See [Installing Optional
130
+ Dependencies](https://sqliter.grantramsay.dev/installation#optional-dependencies)
131
+ for more information.
132
+
133
+ ## Quick Start
134
+
135
+ Here's a quick example of how to use SQLiter:
136
+
137
+ ```python
138
+ from sqliter import SqliterDB
139
+ from sqliter.model import BaseDBModel
140
+
141
+ # Define your model
142
+ class User(BaseDBModel):
143
+ name: str
144
+ age: int
145
+
146
+ # Create a database connection
147
+ db = SqliterDB("example.db")
148
+
149
+ # Create the table
150
+ db.create_table(User)
151
+
152
+ # Insert a record
153
+ user = User(name="John Doe", age=30)
154
+ new_user = db.insert(user)
155
+
156
+ # Query records
157
+ results = db.select(User).filter(name="John Doe").fetch_all()
158
+ for user in results:
159
+ print(f"User: {user.name}, Age: {user.age}")
160
+
161
+ # Update a record
162
+ new_user.age = 31
163
+ db.update(new_user)
164
+
165
+ # Delete a record by primary key
166
+ db.delete(User, new_user.pk)
167
+
168
+ # Delete all records returned from a query:
169
+ delete_count = db.select(User).filter(age__gt=30).delete()
170
+ ```
171
+
172
+ See the [Guide](https://sqliter.grantramsay.dev/guide/guide/) section of the
173
+ documentation for more detailed information on how to use SQLiter, and advanced
174
+ features.
175
+
176
+ ## Contributing
177
+
178
+ Contributions are welcome! Please feel free to submit a Pull Request.
179
+
180
+ See the [CONTRIBUTING](CONTRIBUTING.md) guide for more information.
181
+
182
+ Please note that this project is released with a Contributor Code of Conduct,
183
+ which you can read in the [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) file.
184
+
185
+ ## License
186
+
187
+ This project is licensed under the MIT License.
188
+
189
+ ```pre
190
+ Copyright (c) 2024-2025 Grant Ramsay
191
+
192
+ Permission is hereby granted, free of charge, to any person obtaining a copy
193
+ of this software and associated documentation files (the "Software"), to deal
194
+ in the Software without restriction, including without limitation the rights
195
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
196
+ copies of the Software, and to permit persons to whom the Software is
197
+ furnished to do so, subject to the following conditions:
198
+
199
+ The above copyright notice and this permission notice shall be included in all
200
+ copies or substantial portions of the Software.
201
+
202
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
203
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
204
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
205
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
206
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
207
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
208
+ OR OTHER DEALINGS IN THE SOFTWARE.
209
+ ```
@@ -0,0 +1,15 @@
1
+ sqliter/__init__.py,sha256=ECfn02OPmiMCQvRYbfizKFhVDk00xV-HV1s2cH9037I,244
2
+ sqliter/constants.py,sha256=pNKalajchG6YvXw0-lTMKOJ_OL2xPSs_3YuOuVsqkVk,1257
3
+ sqliter/exceptions.py,sha256=a0Ine1MeHDOjSG3RzMeLVwGfJXrl1YQW4eeUfj6SKJI,6560
4
+ sqliter/helpers.py,sha256=d6k4oWl43Se_c8rAmX8Zj0_sf2O-bpaaeu33VN2IcsI,3442
5
+ sqliter/model/__init__.py,sha256=IZC6you0Wt2o0OovmgBIszt7JzuIY7kMFBpcLwIhcCI,1304
6
+ sqliter/model/foreign_key.py,sha256=aaUJ-02o2_g9JOaxUoicaGTwNwjFS_Si4eYec0bMrqY,5381
7
+ sqliter/model/model.py,sha256=UOD5yO5CizHFWye_BlG28keSK6qWRdHQVI79Y7ovQ9o,8058
8
+ sqliter/model/unique.py,sha256=-Jh56jBv5cjWmZpChwm5jDb_hZBvcqP0gy6MeCNyJvk,827
9
+ sqliter/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ sqliter/query/__init__.py,sha256=MRajhjTPJqjbmmrwndVKj8vqMbK5-XufpwoIswQf5z4,239
11
+ sqliter/query/query.py,sha256=_IDd3tNKogcFYnh-8Ev0Py3SF7G5Igb5VJbhRq4VJPk,30460
12
+ sqliter/sqliter.py,sha256=F3yi816ZkmuzhabhPiCEX7YkoE4Hi3FsjCKKfHKAAlk,38235
13
+ sqliter_py-0.12.0.dist-info/WHEEL,sha256=RRVLqVugUmFOqBedBFAmA4bsgFcROUBiSUKlERi0Hcg,79
14
+ sqliter_py-0.12.0.dist-info/METADATA,sha256=dP1zmzrNB2J3Sj9u1_UfeDYmqzZneyJPmAD19e22pHM,7623
15
+ sqliter_py-0.12.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.9.21
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any