sqliter-py 0.3.0__py3-none-any.whl → 0.9.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.9.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: Topic :: Database :: Front-Ends
19
+ Classifier: Topic :: Software Development
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Dist: pydantic==2.11.5
22
+ Requires-Dist: inflect==7.0.0 ; extra == 'extras'
23
+ Requires-Python: >=3.9
24
+ Project-URL: Bug Tracker, https://github.com/seapagan/sqliter-py/issues
25
+ Project-URL: Changelog, https://github.com/seapagan/sqliter-py/blob/main/CHANGELOG.md
26
+ Project-URL: Homepage, http://sqliter.grantramsay.dev
27
+ Project-URL: Pull Requests, https://github.com/seapagan/sqliter-py/pulls
28
+ Project-URL: Repository, https://github.com/seapagan/sqliter-py
29
+ Provides-Extra: extras
30
+ Description-Content-Type: text/markdown
31
+
32
+ # SQLiter <!-- omit in toc -->
33
+
34
+ [![PyPI version](https://badge.fury.io/py/sqliter-py.svg)](https://badge.fury.io/py/sqliter-py)
35
+ [![Test Suite](https://github.com/seapagan/sqliter-py/actions/workflows/testing.yml/badge.svg)](https://github.com/seapagan/sqliter-py/actions/workflows/testing.yml)
36
+ [![Linting](https://github.com/seapagan/sqliter-py/actions/workflows/linting.yml/badge.svg)](https://github.com/seapagan/sqliter-py/actions/workflows/linting.yml)
37
+ [![Type Checking](https://github.com/seapagan/sqliter-py/actions/workflows/mypy.yml/badge.svg)](https://github.com/seapagan/sqliter-py/actions/workflows/mypy.yml)
38
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sqliter-py)
39
+
40
+ SQLiter is a lightweight Object-Relational Mapping (ORM) library for SQLite
41
+ databases in Python. It provides a simplified interface for interacting with
42
+ SQLite databases using Pydantic models. The only external run-time dependency
43
+ is Pydantic itself.
44
+
45
+ It does not aim to be a full-fledged ORM like SQLAlchemy, but rather a simple
46
+ and easy-to-use library for basic database operations, especially for small
47
+ projects. It is NOT asynchronous and does not support complex queries (at this
48
+ time).
49
+
50
+ The ideal use case is more for Python CLI tools that need to store data in a
51
+ database-like format without needing to learn SQL or use a full ORM.
52
+
53
+ Full documentation is available on the [Website](https://sqliter.grantramsay.dev)
54
+
55
+ > [!CAUTION]
56
+ >
57
+ > Currently NOT compatible with Python 3.14 (I need to refactor some code d/t
58
+ > changes in the latest Pydantic versions, this is a priority.)
59
+ >
60
+ > This project is still in the early stages of development and is lacking some
61
+ > planned functionality. Please use with caution - Classes and methods may
62
+ > change until a stable release is made. I'll try to keep this to an absolute
63
+ > minimum and the releases and documentation will be very clear about any
64
+ > breaking changes.
65
+ >
66
+ > See the [TODO](TODO.md) for planned features and improvements.
67
+
68
+ - [Features](#features)
69
+ - [Installation](#installation)
70
+ - [Optional Dependencies](#optional-dependencies)
71
+ - [Quick Start](#quick-start)
72
+ - [Contributing](#contributing)
73
+ - [License](#license)
74
+
75
+ ## Features
76
+
77
+ - Table creation based on Pydantic models
78
+ - Supports `date` and `datetime` fields
79
+ - Support for complex data types (`list`, `dict`, `set`, `tuple`) stored as
80
+ BLOBs
81
+ - Automatic primary key generation
82
+ - User defined indexes on any field
83
+ - Set any field as UNIQUE
84
+ - CRUD operations (Create, Read, Update, Delete)
85
+ - Chained Query building with filtering, ordering, and pagination
86
+ - Transaction support
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,14 @@
1
+ sqliter/__init__.py,sha256=ECfn02OPmiMCQvRYbfizKFhVDk00xV-HV1s2cH9037I,244
2
+ sqliter/constants.py,sha256=pNKalajchG6YvXw0-lTMKOJ_OL2xPSs_3YuOuVsqkVk,1257
3
+ sqliter/exceptions.py,sha256=g-YZaPazBxlYxQ0lVP_MCWC-mQlX_qgyWip5LJCVLV4,5654
4
+ sqliter/helpers.py,sha256=d6k4oWl43Se_c8rAmX8Zj0_sf2O-bpaaeu33VN2IcsI,3442
5
+ sqliter/model/__init__.py,sha256=sBp6HcDZdespSYmA4sCXq9OikCFTNdFFkT-wM3JJ2Mw,396
6
+ sqliter/model/model.py,sha256=UOD5yO5CizHFWye_BlG28keSK6qWRdHQVI79Y7ovQ9o,8058
7
+ sqliter/model/unique.py,sha256=r4CXrW1GXB6OgNoOVDTpTEVZl8_zta3mYbbT5quMc-c,578
8
+ sqliter/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ sqliter/query/__init__.py,sha256=MRajhjTPJqjbmmrwndVKj8vqMbK5-XufpwoIswQf5z4,239
10
+ sqliter/query/query.py,sha256=yQjYtfSWxgEvbxQgQgwpjS6Z9tSFTQ2aISSKoQ9kaGM,25743
11
+ sqliter/sqliter.py,sha256=lPSvBrFrszCGT47CNPssmp4G7NiFccpdas4kpKZQmO0,25173
12
+ sqliter_py-0.9.0.dist-info/WHEEL,sha256=93kfTGt3a0Dykt_T-gsjtyS5_p8F_d6CE1NwmBOirzo,79
13
+ sqliter_py-0.9.0.dist-info/METADATA,sha256=2Rd3ABHO8IG82IZQOlryAOMoSzxYB-D_pPFmrR3SiwA,7566
14
+ sqliter_py-0.9.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.9.16
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any