Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
405 lines (337 loc) · 12.7 KB
/
Copy pathpyproject.toml
File metadata and controls
405 lines (337 loc) · 12.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
# pyproject.toml
[build-system]
requires = ["setuptools>=64"]
build-backend = "setuptools.build_meta"
[project]
name = "rhosocial-activerecord"
version = "1.0.0.dev29"
description = "A modern, Pythonic implementation of the ActiveRecord pattern, providing an elegant and intuitive interface for database operations with type safety and rich features."
readme = "README.md"
license = { file = "LICENSE" }
# Python version compatibility
# Python 3.8 support: Due to the widespread user base of Python 3.8, we continue to provide support.
# However, since official support for Python 3.8 has ended, the next major version of this project
# will be the last to support Python 3.8, and future versions will not guarantee compatibility.
# Free-Threading support: This project is compatible with Free-Threading Python (3.14t+),
# but some threading-specific features may behave differently. See documentation for details.
requires-python = ">=3.8"
authors = [
{ name = "vistart", email = "i@vistart.me" }
]
keywords = ["activerecord", "orm", "database", "pydantic", "relation"]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Programming Language :: Python :: 3 :: Only",
"Framework :: Pydantic",
"Framework :: Pydantic :: 2",
"Intended Audience :: Developers",
"Topic :: Database",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
]
# Core dependencies with Python version-specific requirements
dependencies = [
# Core data validation and serialization framework
# Pydantic provides model validation, serialization, and type conversion
# Python 3.8: Limited to pydantic 2.10.6 due to compatibility constraints
"pydantic==2.10.6; python_version == '3.8'",
# Pydantic's core validation library written in Rust
# Provides high-performance validation and serialization
# Python 3.8: Uses pydantic-core 2.27.2 for compatibility
"pydantic-core==2.27.2; python_version == '3.8'",
# Python 3.9+: Requires pydantic 2.12+ and pydantic-core 2.41+ for full feature support
# No upper limit on minor versions as long as major version remains 2.x
# This includes Python 3.14 and any future Python versions
"pydantic>=2.12.0; python_version >= '3.9'",
"pydantic-core>=2.41.0; python_version >= '3.9'",
# Type extension utilities
# Provides additional typing features for older Python versions
"typing-extensions>=4.12.0; python_version < '3.9'",
# Timezone info backport for Python 3.8
# Python 3.8 lacks native zoneinfo support, this provides compatibility
# Only required for Python 3.8 as later versions have native zoneinfo
"backports.zoneinfo>=0.2.1; python_version < '3.9'",
]
[project.optional-dependencies]
# Async support for SQLite backend
# These are required only when using AsyncSQLiteBackend
async = [
"aiosqlite>=0.19.0",
"aiofiles>=23.0.0",
]
# Database backend dependencies (provided by separate packages)
# These are distributed as independent packages to maintain modularity
mysql = ["rhosocial-activerecord-mysql>=1.0.0,<2.0.0"]
mariadb = ["rhosocial-activerecord-mariadb>=1.0.0,<2.0.0"]
postgres = ["rhosocial-activerecord-postgres>=1.0.0,<2.0.0"]
oracle = ["rhosocial-activerecord-oracle>=1.0.0,<2.0.0"]
sqlserver = ["rhosocial-activerecord-sqlserver>=1.0.0,<2.0.0"]
firebird = ["rhosocial-activerecord-firebird>=1.0.0,<2.0.0"]
# Convenience extra for all database backends
databases = [
"rhosocial-activerecord-mysql>=1.0.0,<2.0.0",
"rhosocial-activerecord-mariadb>=1.0.0,<2.0.0",
"rhosocial-activerecord-postgres>=1.0.0,<2.0.0",
"rhosocial-activerecord-oracle>=1.0.0,<2.0.0",
"rhosocial-activerecord-sqlserver>=1.0.0,<2.0.0",
"rhosocial-activerecord-firebird>=1.0.0,<2.0.0",
]
# Database migration support
migration = ["rhosocial-activerecord-migration>=1.0.0,<2.0.0"]
# Complete package with all optional dependencies
all = [
"rhosocial-activerecord-mysql>=1.0.0,<2.0.0",
"rhosocial-activerecord-mariadb>=1.0.0,<2.0.0",
"rhosocial-activerecord-postgres>=1.0.0,<2.0.0",
"rhosocial-activerecord-oracle>=1.0.0,<2.0.0",
"rhosocial-activerecord-sqlserver>=1.0.0,<2.0.0",
"rhosocial-activerecord-firebird>=1.0.0,<2.0.0",
"rhosocial-activerecord-migration>=1.0.0,<2.0.0",
"aiosqlite>=0.19.0",
"aiofiles>=23.0.0",
]
# Development dependencies - These will be installed automatically during pip install -e .
test = [
# Testing framework for unit and integration tests
# Core framework for running test suites and fixtures
"pytest",
# Code coverage measurement tool
# Measures test coverage and generates coverage reports
"coverage>=7.0.0",
# Asyncio support for pytest
# Enables testing of asynchronous code
"pytest-asyncio",
# Async SQLite support
"aiosqlite>=0.19.0",
# Async file operations for tests
"aiofiles>=23.0.0",
# Benchmark integration with pytest
"pytest-benchmark",
# Coverage integration with pytest
# Combines pytest and coverage for seamless test coverage reporting
"pytest-cov",
# Parallel test execution plugin for pytest
# Enables faster test execution through parallel processing
"pytest-xdist",
# Pytest plugin for mocking
# Provides the 'mocker' fixture for patching and mocking objects in tests
"pytest-mock",
# Pydantic with email validation support
# Adds email field validation capabilities for testing
"pydantic[email]",
# YAML file processing library
# Used for configuration file handling and test data
"pyyaml>=6.0.2",
# FastAPI benchmark support
"fastapi>=0.110",
"httpx>=0.27",
]
dev = [
# Code formatter
# Maintains consistent code style across the project
"black>=23.0.0",
# Import sorter
# Organizes imports in a consistent manner
"isort>=5.0.0",
# Static type checker
# Provides static type analysis for Python code
"mypy>=1.0.0,<2.0.0",
# Fast Python linter
# Provides fast linting and code quality checks
"ruff>=0.1.0",
# Git pre-commit hooks
# Ensures code quality checks run before commits
"pre-commit>=3.0.0",
]
docs = [
# Documentation generator
# Generates HTML documentation from source code
"sphinx>=7.0.0",
# Sphinx theme
# Provides Read the Docs theme for documentation
"sphinx-rtd-theme>=1.0.0",
# Markdown parser for Sphinx
# Enables Markdown support in Sphinx documentation
"myst-parser>=2.0.0",
]
[project.urls]
Homepage = "https://github.com/rhosocial/python-activerecord"
Documentation = "https://docs.python-activerecord.dev.rho.social/"
Repository = "https://github.com/rhosocial/python-activerecord.git"
Issues = "https://github.com/rhosocial/python-activerecord/issues"
[tool.setuptools.packages.find]
where = ["src"]
namespaces = true
# Build configuration
# Default environment configuration (used for pip install -e .)
# Tool configurations
[tool.pytest.ini_options]
minversion = "7.0"
testpaths = ["tests"]
pythonpath = [".", "src"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
addopts = "-ra -q -m 'not benchmark'"
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
markers = [
"python38: marks tests specific to Python 3.8",
"python39plus: marks tests requiring Python 3.9+",
"python314: marks tests specific to Python 3.14",
# Feature-specific markers
"backend: marks tests as backend-specific tests",
"basic: marks tests for basic CRUD operations",
"basic_mapped_models: marks tests for models with custom column name mappings in basic feature",
"query: marks tests for query functionality",
"relation: marks tests for relation management",
"field: marks tests for field type handling",
"validation: marks tests for data validation",
"transaction: marks tests for transaction handling",
"mixin: marks tests for mixin functionality",
"events: marks tests for event system",
"interface: marks tests for interface contracts",
"cte: marks tests for CTE query functionality",
"aggregate: marks tests for aggregate queries",
"cache: marks tests for caching mechanisms",
"redis: marks RedisCache tests that require a running Redis instance (use -m redis to run)",
"benchmark: marks tests as performance benchmarks that should be excluded by default",
"benchmark_sync: marks synchronous benchmark tests",
"benchmark_async: marks asynchronous benchmark tests",
"benchmark_read: marks read-oriented benchmark tests",
"benchmark_write: marks write-oriented benchmark tests",
"benchmark_crud: marks CRUD benchmark tests",
"benchmark_backend: marks backend direct benchmark tests",
"benchmark_query: marks query benchmark tests",
"benchmark_transaction: marks transaction benchmark tests",
"benchmark_mixin: marks mixin benchmark tests",
"benchmark_fastapi: marks FastAPI benchmark tests",
"benchmark_relation: marks relation cache benchmark tests",
# Database backend-specific markers
"sqlite: marks tests specific to SQLite backend",
"mysql: marks tests specific to MySQL backend",
"postgres: marks tests specific to PostgreSQL backend",
"sqlserver: marks tests specific to SQL Server backend",
"oracle: marks tests specific to Oracle backend",
"mariadb: marks tests specific to MariaDB backend",
# Protocol requirement markers (from testsuite)
"requires_protocol: marks tests requiring specific protocol support",
"requires_functions: marks tests requiring specific database functions",
"requires_inner_join: marks tests requiring INNER JOIN support",
"requires_left_join: marks tests requiring LEFT JOIN support",
"requires_right_join: marks tests requiring RIGHT JOIN support",
"requires_full_join: marks tests requiring FULL JOIN support",
"requires_cross_join: marks tests requiring CROSS JOIN support",
"requires_natural_join: marks tests requiring NATURAL JOIN support",
"requires_lateral_join: marks tests requiring LATERAL join support",
]
[tool.coverage.run]
source = ["rhosocial"]
branch = true
concurrency = ["multiprocessing", "thread"]
omit = [
"*/tests/*",
"*/test_*",
"*/__pycache__/*",
"*/migrations/*",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
"pass",
"raise ImportError",
]
[tool.black]
line-length = 100
target-version = ["py38"]
include = '\.pyi?$'
[tool.isort]
profile = "black"
multi_line_output = 3
line_length = 100
[tool.ruff]
line-length = 120
target-version = "py38"
[tool.ruff.lint]
select = ["E", "F", "B"]
ignore = ["B024"] # Abstract base classes without abstract methods are intentional
[tool.mypy]
python_version = "3.8"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
check_untyped_defs = true
[tool.pyright]
include = ["src"]
exclude = ["**/__pycache__", "**/tests", "**/test_*"]
venvPath = "."
venv = ".venv3.8"
pythonVersion = "3.8"
typeCheckingMode = "standard"
useLibraryCodeForTypes = true
[tool.towncrier]
package = "rhosocial.activerecord"
package_dir = "src"
filename = "CHANGELOG.md"
directory = "changelog.d"
title_format = "## [{version}] - {project_date}"
template = "changelog.d/template.md"
start_string = "<!-- towncrier release notes start -->\n"
underlines = ["", "", ""]
issue_format = "[#{issue}](https://github.com/rhosocial/python-activerecord/issues/{issue})"
[[tool.towncrier.type]]
directory = "security"
name = "Security"
showcontent = true
[[tool.towncrier.type]]
directory = "removed"
name = "Removed"
showcontent = true
[[tool.towncrier.type]]
directory = "deprecated"
name = "Deprecated"
showcontent = true
[[tool.towncrier.type]]
directory = "added"
name = "Added"
showcontent = true
[[tool.towncrier.type]]
directory = "changed"
name = "Changed"
showcontent = true
[[tool.towncrier.type]]
directory = "fixed"
name = "Fixed"
showcontent = true
[[tool.towncrier.type]]
directory = "performance"
name = "Performance"
showcontent = true
[[tool.towncrier.type]]
directory = "docs"
name = "Documentation"
showcontent = true
[[tool.towncrier.type]]
directory = "internal"
name = "Internal"
showcontent = true