sqliter-py 0.2.0__tar.gz → 0.10.0__tar.gz

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.

Potentially problematic release.


This version of sqliter-py might be problematic. Click here for more details.

@@ -0,0 +1,207 @@
1
+ Metadata-Version: 2.4
2
+ Name: sqliter-py
3
+ Version: 0.10.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
+ - Automatic primary key generation
80
+ - User defined indexes on any field
81
+ - Set any field as UNIQUE
82
+ - CRUD operations (Create, Read, Update, Delete)
83
+ - Chained Query building with filtering, ordering, and pagination
84
+ - Transaction support
85
+ - Custom exceptions for better error handling
86
+ - Full type hinting and type checking
87
+ - Detailed documentation and examples
88
+ - No external dependencies other than Pydantic
89
+ - Full test coverage
90
+ - Can optionally output the raw SQL queries being executed for debugging
91
+ purposes.
92
+
93
+ ## Installation
94
+
95
+ You can install SQLiter using whichever method you prefer or is compatible with
96
+ your project setup.
97
+
98
+ With `uv` which is rapidly becoming my favorite tool for managing projects and
99
+ virtual environments (`uv` is used for developing this project and in the CI):
100
+
101
+ ```bash
102
+ uv add sqliter-py
103
+ ```
104
+
105
+ With `Poetry`:
106
+
107
+ ```bash
108
+ poetry add sqliter-py
109
+ ```
110
+
111
+ Or with `pip`:
112
+
113
+ ```bash
114
+ pip install sqliter-py
115
+ ```
116
+
117
+ ### Optional Dependencies
118
+
119
+ Currently by default, the only external dependency is Pydantic. However, there
120
+ are some optional dependencies that can be installed to enable additional
121
+ features:
122
+
123
+ - `inflect`: For pluralizing the auto-generated table names (if not explicitly
124
+ set in the Model) This just offers a more-advanced pluralization than the
125
+ default method used. In most cases you will not need this.
126
+
127
+ See [Installing Optional
128
+ Dependencies](https://sqliter.grantramsay.dev/installation#optional-dependencies)
129
+ for more information.
130
+
131
+ ## Quick Start
132
+
133
+ Here's a quick example of how to use SQLiter:
134
+
135
+ ```python
136
+ from sqliter import SqliterDB
137
+ from sqliter.model import BaseDBModel
138
+
139
+ # Define your model
140
+ class User(BaseDBModel):
141
+ name: str
142
+ age: int
143
+
144
+ # Create a database connection
145
+ db = SqliterDB("example.db")
146
+
147
+ # Create the table
148
+ db.create_table(User)
149
+
150
+ # Insert a record
151
+ user = User(name="John Doe", age=30)
152
+ new_user = db.insert(user)
153
+
154
+ # Query records
155
+ results = db.select(User).filter(name="John Doe").fetch_all()
156
+ for user in results:
157
+ print(f"User: {user.name}, Age: {user.age}")
158
+
159
+ # Update a record
160
+ new_user.age = 31
161
+ db.update(new_user)
162
+
163
+ # Delete a record by primary key
164
+ db.delete(User, new_user.pk)
165
+
166
+ # Delete all records returned from a query:
167
+ delete_count = db.select(User).filter(age__gt=30).delete()
168
+ ```
169
+
170
+ See the [Guide](https://sqliter.grantramsay.dev/guide/guide/) section of the
171
+ documentation for more detailed information on how to use SQLiter, and advanced
172
+ features.
173
+
174
+ ## Contributing
175
+
176
+ Contributions are welcome! Please feel free to submit a Pull Request.
177
+
178
+ See the [CONTRIBUTING](CONTRIBUTING.md) guide for more information.
179
+
180
+ Please note that this project is released with a Contributor Code of Conduct,
181
+ which you can read in the [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) file.
182
+
183
+ ## License
184
+
185
+ This project is licensed under the MIT License.
186
+
187
+ ```pre
188
+ Copyright (c) 2024-2025 Grant Ramsay
189
+
190
+ Permission is hereby granted, free of charge, to any person obtaining a copy
191
+ of this software and associated documentation files (the "Software"), to deal
192
+ in the Software without restriction, including without limitation the rights
193
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
194
+ copies of the Software, and to permit persons to whom the Software is
195
+ furnished to do so, subject to the following conditions:
196
+
197
+ The above copyright notice and this permission notice shall be included in all
198
+ copies or substantial portions of the Software.
199
+
200
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
201
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
202
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
203
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
204
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
205
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
206
+ OR OTHER DEALINGS IN THE SOFTWARE.
207
+ ```
@@ -0,0 +1,175 @@
1
+ # SQLiter <!-- omit in toc -->
2
+
3
+ [![PyPI version](https://badge.fury.io/py/sqliter-py.svg)](https://badge.fury.io/py/sqliter-py)
4
+ [![Test Suite](https://github.com/seapagan/sqliter-py/actions/workflows/testing.yml/badge.svg)](https://github.com/seapagan/sqliter-py/actions/workflows/testing.yml)
5
+ [![Linting](https://github.com/seapagan/sqliter-py/actions/workflows/linting.yml/badge.svg)](https://github.com/seapagan/sqliter-py/actions/workflows/linting.yml)
6
+ [![Type Checking](https://github.com/seapagan/sqliter-py/actions/workflows/mypy.yml/badge.svg)](https://github.com/seapagan/sqliter-py/actions/workflows/mypy.yml)
7
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sqliter-py)
8
+
9
+ SQLiter is a lightweight Object-Relational Mapping (ORM) library for SQLite
10
+ databases in Python. It provides a simplified interface for interacting with
11
+ SQLite databases using Pydantic models. The only external run-time dependency
12
+ is Pydantic itself.
13
+
14
+ It does not aim to be a full-fledged ORM like SQLAlchemy, but rather a simple
15
+ and easy-to-use library for basic database operations, especially for small
16
+ projects. It is NOT asynchronous and does not support complex queries (at this
17
+ time).
18
+
19
+ The ideal use case is more for Python CLI tools that need to store data in a
20
+ database-like format without needing to learn SQL or use a full ORM.
21
+
22
+ Full documentation is available on the [Website](https://sqliter.grantramsay.dev)
23
+
24
+ > [!CAUTION]
25
+ >
26
+ > This project is still in the early stages of development and is lacking some
27
+ > planned functionality. Please use with caution - Classes and methods may
28
+ > change until a stable release is made. I'll try to keep this to an absolute
29
+ > minimum and the releases and documentation will be very clear about any
30
+ > breaking changes.
31
+ >
32
+ > See the [TODO](TODO.md) for planned features and improvements.
33
+
34
+ - [Features](#features)
35
+ - [Installation](#installation)
36
+ - [Optional Dependencies](#optional-dependencies)
37
+ - [Quick Start](#quick-start)
38
+ - [Contributing](#contributing)
39
+ - [License](#license)
40
+
41
+ ## Features
42
+
43
+ - Table creation based on Pydantic models
44
+ - Supports `date` and `datetime` fields
45
+ - Support for complex data types (`list`, `dict`, `set`, `tuple`) stored as
46
+ BLOBs
47
+ - Automatic primary key generation
48
+ - User defined indexes on any field
49
+ - Set any field as UNIQUE
50
+ - CRUD operations (Create, Read, Update, Delete)
51
+ - Chained Query building with filtering, ordering, and pagination
52
+ - Transaction support
53
+ - Custom exceptions for better error handling
54
+ - Full type hinting and type checking
55
+ - Detailed documentation and examples
56
+ - No external dependencies other than Pydantic
57
+ - Full test coverage
58
+ - Can optionally output the raw SQL queries being executed for debugging
59
+ purposes.
60
+
61
+ ## Installation
62
+
63
+ You can install SQLiter using whichever method you prefer or is compatible with
64
+ your project setup.
65
+
66
+ With `uv` which is rapidly becoming my favorite tool for managing projects and
67
+ virtual environments (`uv` is used for developing this project and in the CI):
68
+
69
+ ```bash
70
+ uv add sqliter-py
71
+ ```
72
+
73
+ With `Poetry`:
74
+
75
+ ```bash
76
+ poetry add sqliter-py
77
+ ```
78
+
79
+ Or with `pip`:
80
+
81
+ ```bash
82
+ pip install sqliter-py
83
+ ```
84
+
85
+ ### Optional Dependencies
86
+
87
+ Currently by default, the only external dependency is Pydantic. However, there
88
+ are some optional dependencies that can be installed to enable additional
89
+ features:
90
+
91
+ - `inflect`: For pluralizing the auto-generated table names (if not explicitly
92
+ set in the Model) This just offers a more-advanced pluralization than the
93
+ default method used. In most cases you will not need this.
94
+
95
+ See [Installing Optional
96
+ Dependencies](https://sqliter.grantramsay.dev/installation#optional-dependencies)
97
+ for more information.
98
+
99
+ ## Quick Start
100
+
101
+ Here's a quick example of how to use SQLiter:
102
+
103
+ ```python
104
+ from sqliter import SqliterDB
105
+ from sqliter.model import BaseDBModel
106
+
107
+ # Define your model
108
+ class User(BaseDBModel):
109
+ name: str
110
+ age: int
111
+
112
+ # Create a database connection
113
+ db = SqliterDB("example.db")
114
+
115
+ # Create the table
116
+ db.create_table(User)
117
+
118
+ # Insert a record
119
+ user = User(name="John Doe", age=30)
120
+ new_user = db.insert(user)
121
+
122
+ # Query records
123
+ results = db.select(User).filter(name="John Doe").fetch_all()
124
+ for user in results:
125
+ print(f"User: {user.name}, Age: {user.age}")
126
+
127
+ # Update a record
128
+ new_user.age = 31
129
+ db.update(new_user)
130
+
131
+ # Delete a record by primary key
132
+ db.delete(User, new_user.pk)
133
+
134
+ # Delete all records returned from a query:
135
+ delete_count = db.select(User).filter(age__gt=30).delete()
136
+ ```
137
+
138
+ See the [Guide](https://sqliter.grantramsay.dev/guide/guide/) section of the
139
+ documentation for more detailed information on how to use SQLiter, and advanced
140
+ features.
141
+
142
+ ## Contributing
143
+
144
+ Contributions are welcome! Please feel free to submit a Pull Request.
145
+
146
+ See the [CONTRIBUTING](CONTRIBUTING.md) guide for more information.
147
+
148
+ Please note that this project is released with a Contributor Code of Conduct,
149
+ which you can read in the [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) file.
150
+
151
+ ## License
152
+
153
+ This project is licensed under the MIT License.
154
+
155
+ ```pre
156
+ Copyright (c) 2024-2025 Grant Ramsay
157
+
158
+ Permission is hereby granted, free of charge, to any person obtaining a copy
159
+ of this software and associated documentation files (the "Software"), to deal
160
+ in the Software without restriction, including without limitation the rights
161
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
162
+ copies of the Software, and to permit persons to whom the Software is
163
+ furnished to do so, subject to the following conditions:
164
+
165
+ The above copyright notice and this permission notice shall be included in all
166
+ copies or substantial portions of the Software.
167
+
168
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
169
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
170
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
171
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
172
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
173
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
174
+ OR OTHER DEALINGS IN THE SOFTWARE.
175
+ ```
@@ -1,12 +1,15 @@
1
+ # Configuration file for the SQLiter project.
2
+ # This file defines project metadata, dependencies, and development tools.
3
+
1
4
  [project]
2
5
  name = "sqliter-py"
3
- version = "0.2.0"
6
+ version = "0.10.0"
4
7
  description = "Interact with SQLite databases using Python and Pydantic"
5
8
  readme = "README.md"
6
9
  requires-python = ">=3.9"
7
10
  license = "MIT"
8
11
  authors = [{ name = "Grant Ramsay", email = "grant@gnramsay.com" }]
9
- dependencies = ["pydantic>=2.9.0"]
12
+ dependencies = ["pydantic>=2.12.5"]
10
13
 
11
14
  classifiers = [
12
15
  "Development Status :: 4 - Beta",
@@ -18,32 +21,36 @@ classifiers = [
18
21
  "Programming Language :: Python :: 3.10",
19
22
  "Programming Language :: Python :: 3.11",
20
23
  "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Programming Language :: Python :: 3.14",
26
+ "Topic :: Database :: Front-Ends",
21
27
  "Topic :: Software Development",
22
28
  "Topic :: Software Development :: Libraries :: Python Modules",
23
29
  ]
24
30
 
31
+ [project.optional-dependencies]
32
+ extras = ["inflect==7.0.0"]
33
+
25
34
  [project.urls]
26
- # "HomeHage" = "https://xxxxxx"
35
+ "Homepage" = "http://sqliter.grantramsay.dev"
27
36
  "Pull Requests" = "https://github.com/seapagan/sqliter-py/pulls"
28
37
  "Bug Tracker" = "https://github.com/seapagan/sqliter-py/issues"
29
38
  "Changelog" = "https://github.com/seapagan/sqliter-py/blob/main/CHANGELOG.md"
30
39
  "Repository" = "https://github.com/seapagan/sqliter-py"
31
40
 
32
41
  [build-system]
33
- requires = ["hatchling"]
34
- build-backend = "hatchling.build"
42
+ requires = ["uv_build>=0.9.9,<0.10.0"]
43
+ build-backend = "uv_build"
35
44
 
36
- [tool.hatch.build.targets.sdist]
37
- packages = ["sqliter"]
45
+ [tool.uv.build-backend]
46
+ module-name = "sqliter"
47
+ module-root = ""
38
48
 
39
- [tool.hatch.build.targets.wheel]
40
- packages = ["sqliter"]
41
-
42
- [tool.uv]
43
- dev-dependencies = [
49
+ [dependency-groups]
50
+ dev = [
44
51
  "mock>=5.1.0",
45
52
  "mypy>=1.11.2",
46
- "pytest>=8.3.2",
53
+ "pytest>=8.3.2,<9.0",
47
54
  "pytest-mock>=3.14.0",
48
55
  "ruff>=0.6.4",
49
56
  "pytest-sugar>=1.0.0",
@@ -54,45 +61,67 @@ dev-dependencies = [
54
61
  "pytest-clarity>=1.0.1",
55
62
  "poethepoet>=0.28.0",
56
63
  "github-changelog-md>=0.9.5",
64
+ "pre-commit>=3.8.0",
65
+ "mkdocs>=1.6.1",
66
+ "mkdocs-material>=9.5.36",
67
+ "pygments>=2.18.0",
68
+ "mkdocs-minify-plugin>=0.8.0",
69
+ "mdx-truly-sane-lists>=1.3",
57
70
  ]
58
71
 
59
72
  [tool.poe.tasks]
73
+ pre.cmd = "pre-commit run --all-files"
74
+ pre.help = "Run pre-commit checks"
75
+
60
76
  mypy.cmd = "mypy . --strict"
61
77
  mypy.help = "Run mypy checks"
62
- format.help = "Format code with Ruff"
63
78
  format.cmd = "ruff format ."
79
+ format.help = "Format code with Ruff"
80
+ ruff.cmd = "ruff check --output-format=concise ."
64
81
  ruff.help = "Run Ruff checks"
65
- ruff.cmd = "ruff check ."
66
- test.help = "Run tests using Pytest"
82
+
67
83
  test.cmd = "pytest"
84
+ test.help = "Run tests using Pytest"
68
85
  "test:watch".cmd = "ptw . --now --clear"
69
86
  "test:watch".help = "Run tests using Pytest in watch mode"
87
+
70
88
  changelog.cmd = "github-changelog-md"
71
89
  changelog.help = "Generate a changelog"
72
90
 
91
+ "docs:publish".cmd = "mkdocs gh-deploy"
92
+ "docs:publish".help = "Publish documentation to GitHub Pages"
93
+ "docs:build".cmd = "mkdocs build"
94
+ "docs:build".help = "Build documentation locally to './site' folder"
95
+ "docs:serve".cmd = "mkdocs serve -w TODO.md -w CHANGELOG.md -w CONTRIBUTING.md"
96
+ "docs:serve".help = "Serve documentation locally"
97
+ "docs:serve:all".cmd = "mkdocs serve -w TODO.md -w CHANGELOG.md -w CONTRIBUTING.md -a 0.0.0.0:9000"
98
+ "docs:serve:all".help = "Serve documentation locally on all interfaces"
99
+
73
100
  [tool.ruff]
74
101
  line-length = 80
75
102
  lint.select = ["ALL"] # we are being very strict!
76
103
  lint.ignore = [
77
- "ANN101",
78
- "ANN102",
79
104
  "PGH003",
80
105
  "FBT002",
81
106
  "FBT003",
82
107
  "B006",
108
+ "S301", # in this library we use 'pickle' for saving and loading list etc
83
109
  ] # These rules are too strict even for us 😝
84
110
  lint.extend-ignore = [
85
111
  "COM812",
86
112
  "ISC001",
87
113
  ] # these are ignored for ruff formatting
88
114
 
89
- src = ["lice2"]
115
+ src = ["sqliter"]
90
116
  target-version = "py39" # minimum python version supported
91
117
 
92
118
  [tool.ruff.format]
93
119
  indent-style = "space"
94
120
  quote-style = "double"
95
121
 
122
+ [tool.ruff.lint.pylint]
123
+ max-args = 6
124
+
96
125
  [tool.ruff.lint.pep8-naming]
97
126
  classmethod-decorators = ["pydantic.validator", "pydantic.root_validator"]
98
127
 
@@ -105,25 +134,40 @@ convention = "google"
105
134
  "ANN001", # annotations for fixtures are sometimes a pain for test files
106
135
  "ARG00", # test fixtures often are not directly used
107
136
  "PLR2004", # magic numbers are often used in test files
137
+ "SLF001", # sometimes we need to test private methods
108
138
  ]
109
139
 
110
140
  [tool.ruff.lint.isort]
111
- known-first-party = ["lice2"]
141
+ known-first-party = ["sqliter"]
112
142
 
113
143
  [tool.ruff.lint.pyupgrade]
114
144
  keep-runtime-typing = true
115
145
 
116
146
  [tool.mypy]
147
+ plugins = ["pydantic.mypy"]
148
+
117
149
  python_version = "3.9"
150
+ exclude = ["docs"]
118
151
 
119
152
  [[tool.mypy.overrides]]
120
153
  disable_error_code = ["method-assign", "no-untyped-def", "attr-defined"]
121
154
  module = "tests.*"
122
155
 
123
156
  [tool.pytest.ini_options]
124
- addopts = ["--cov", "--cov-report", "term-missing", "--cov-report", "html"]
125
- filterwarnings = []
157
+ addopts = [
158
+ "--cov",
159
+ "--cov-report",
160
+ "term-missing",
161
+ "--cov-report",
162
+ "html",
163
+ "--cov-report",
164
+ "lcov",
165
+ ]
166
+ filterwarnings = [
167
+ "ignore:'direction' argument is deprecated:DeprecationWarning",
168
+ ]
126
169
  mock_use_standalone_module = true
170
+ markers = []
127
171
 
128
172
  [tool.coverage.run]
129
173
  source = ["sqliter"]
@@ -0,0 +1,9 @@
1
+ """SQLiter: A lightweight ORM-like library for SQLite databases in Python.
2
+
3
+ This module provides the main SqliterDB class for interacting with
4
+ SQLite databases using Pydantic models.
5
+ """
6
+
7
+ from .sqliter import SqliterDB
8
+
9
+ __all__ = ["SqliterDB"]
@@ -0,0 +1,45 @@
1
+ """Constant values and mappings used throughout SQLiter.
2
+
3
+ This module defines constant dictionaries that map SQLiter-specific
4
+ concepts to their SQLite equivalents. It includes mappings for query
5
+ operators and data types, which are crucial for translating between
6
+ Pydantic models and SQLite database operations.
7
+ """
8
+
9
+ import datetime
10
+
11
+ # A dictionary mapping SQLiter filter operators to their corresponding SQL
12
+ # operators.
13
+ OPERATOR_MAPPING = {
14
+ "__lt": "<",
15
+ "__lte": "<=",
16
+ "__gt": ">",
17
+ "__gte": ">=",
18
+ "__eq": "=",
19
+ "__ne": "!=",
20
+ "__in": "IN",
21
+ "__not_in": "NOT IN",
22
+ "__isnull": "IS NULL",
23
+ "__notnull": "IS NOT NULL",
24
+ "__startswith": "LIKE",
25
+ "__endswith": "LIKE",
26
+ "__contains": "LIKE",
27
+ "__istartswith": "LIKE",
28
+ "__iendswith": "LIKE",
29
+ "__icontains": "LIKE",
30
+ }
31
+
32
+ # A dictionary mapping Python types to their corresponding SQLite column types.
33
+ SQLITE_TYPE_MAPPING = {
34
+ int: "INTEGER",
35
+ float: "REAL",
36
+ str: "TEXT",
37
+ bool: "INTEGER", # SQLite stores booleans as integers (0 or 1)
38
+ bytes: "BLOB",
39
+ datetime.datetime: "INTEGER", # Store as Unix timestamp
40
+ datetime.date: "INTEGER", # Store as Unix timestamp
41
+ list: "BLOB",
42
+ dict: "BLOB",
43
+ set: "BLOB",
44
+ tuple: "BLOB",
45
+ }