activemodel 0.24.0__tar.gz → 0.24.2__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.
- {activemodel-0.24.0 → activemodel-0.24.2}/PKG-INFO +4 -19
- {activemodel-0.24.0 → activemodel-0.24.2}/README.md +0 -4
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/base_model.py +4 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/patches/get_column_from_field_patch.py +4 -4
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/patches/get_sqlalchemy_type_patch.py +1 -1
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/pytest/factories.py +3 -1
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/session_manager.py +1 -1
- activemodel-0.24.2/activemodel/types/__init__.py +24 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/types/whenever/__init__.py +7 -1
- {activemodel-0.24.0 → activemodel-0.24.2}/pyproject.toml +16 -19
- activemodel-0.24.0/activemodel/types/__init__.py +0 -12
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/__init__.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/celery.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/decorators.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/errors.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/jsonb_snapshot.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/logger.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/mixins/__init__.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/mixins/pydantic_json.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/mixins/soft_delete.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/mixins/timestamps.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/mixins/typeid.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/patches/__init__.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/py.typed +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/pytest/__init__.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/pytest/plugin.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/pytest/transaction.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/pytest/truncate.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/query_wrapper.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/types/sqlalchemy_protocol.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/types/sqlalchemy_protocol.pyi +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/types/typeid.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/types/typeid_patch.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/types/whenever/date_type.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/types/whenever/instant_type.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/types/whenever/plain_date_time_type.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/types/whenever/time_type.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/types/whenever/zoned_date_time_type.py +0 -0
- {activemodel-0.24.0 → activemodel-0.24.2}/activemodel/utils.py +0 -0
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: activemodel
|
|
3
|
-
Version: 0.24.
|
|
3
|
+
Version: 0.24.2
|
|
4
4
|
Summary: SQLModel with developer ergonomics. Make SQLModel act like ActiveRecord.
|
|
5
5
|
Keywords: sqlmodel,orm,activerecord,activemodel,sqlalchemy
|
|
6
6
|
Author: Michael Bianco
|
|
7
7
|
Author-email: Michael Bianco <iloveitaly@gmail.com>
|
|
8
|
-
Requires-Dist: sqlmodel==0.0.
|
|
9
|
-
Requires-Dist: typeid-python==0.3.
|
|
10
|
-
Requires-Dist: whenever>=0.10.
|
|
11
|
-
Requires-Dist: sphinx>=7.1.2 ; extra == 'docs'
|
|
12
|
-
Requires-Dist: shibuya ; extra == 'docs'
|
|
13
|
-
Requires-Dist: myst-parser>=2.0.0 ; extra == 'docs'
|
|
14
|
-
Requires-Dist: sphinx-design>=0.5.0 ; extra == 'docs'
|
|
15
|
-
Requires-Dist: sphinx-copybutton>=0.5.2 ; extra == 'docs'
|
|
16
|
-
Requires-Dist: sphinx-autobuild ; extra == 'docs'
|
|
17
|
-
Requires-Dist: sphinx-autoapi ; extra == 'docs'
|
|
18
|
-
Requires-Dist: sphinx-autodoc-typehints ; extra == 'docs'
|
|
19
|
-
Requires-Dist: sphinx-paramlinks ; extra == 'docs'
|
|
20
|
-
Requires-Dist: sphinx-llm ; extra == 'docs'
|
|
8
|
+
Requires-Dist: sqlmodel==0.0.39
|
|
9
|
+
Requires-Dist: typeid-python==0.3.10
|
|
10
|
+
Requires-Dist: whenever>=0.10.3
|
|
21
11
|
Requires-Python: >=3.13
|
|
22
12
|
Project-URL: Repository, https://github.com/iloveitaly/activemodel
|
|
23
13
|
Project-URL: Documentation, https://iloveitaly.github.io/activemodel/
|
|
24
|
-
Provides-Extra: docs
|
|
25
14
|
Description-Content-Type: text/markdown
|
|
26
15
|
|
|
27
16
|
[](https://github.com/iloveitaly/activemodel/releases)
|
|
@@ -31,10 +20,6 @@ Description-Content-Type: text/markdown
|
|
|
31
20
|
|
|
32
21
|
# ActiveModel: ORM Wrapper for SQLModel
|
|
33
22
|
|
|
34
|
-
<p align="center">
|
|
35
|
-
<img src="docs/_static/logo.png" alt="ActiveModel Logo" width="600"/>
|
|
36
|
-
</p>
|
|
37
|
-
|
|
38
23
|
No, this isn't *really* [ActiveModel](https://guides.rubyonrails.org/active_model_basics.html). It's just a wrapper around SQLModel that provides a ActiveRecord-like interface.
|
|
39
24
|
|
|
40
25
|
SQLModel is *not* an ORM. It's a SQL query builder and a schema definition tool. This drives me nuts because the developer ergonomics are terrible because of this.
|
|
@@ -5,10 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
# ActiveModel: ORM Wrapper for SQLModel
|
|
7
7
|
|
|
8
|
-
<p align="center">
|
|
9
|
-
<img src="docs/_static/logo.png" alt="ActiveModel Logo" width="600"/>
|
|
10
|
-
</p>
|
|
11
|
-
|
|
12
8
|
No, this isn't *really* [ActiveModel](https://guides.rubyonrails.org/active_model_basics.html). It's just a wrapper around SQLModel that provides a ActiveRecord-like interface.
|
|
13
9
|
|
|
14
10
|
SQLModel is *not* an ORM. It's a SQL query builder and a schema definition tool. This drives me nuts because the developer ergonomics are terrible because of this.
|
|
@@ -487,6 +487,10 @@ class BaseModel(SQLModel):
|
|
|
487
487
|
def one(cls, *args: t.Any, **kwargs: t.Any):
|
|
488
488
|
"""
|
|
489
489
|
Gets a single record from the database. Pass an PK ID or a kwarg to filter by.
|
|
490
|
+
|
|
491
|
+
Raises:
|
|
492
|
+
sqlalchemy.exc.NoResultFound: If no record is found.
|
|
493
|
+
sqlalchemy.exc.MultipleResultsFound: If more than one record is found.
|
|
490
494
|
"""
|
|
491
495
|
|
|
492
496
|
args, kwargs = cls.__process_filter_args__(*args, **kwargs)
|
{activemodel-0.24.0 → activemodel-0.24.2}/activemodel/patches/get_column_from_field_patch.py
RENAMED
|
@@ -40,16 +40,16 @@ if TYPE_CHECKING:
|
|
|
40
40
|
from pydantic_core import PydanticUndefinedType as UndefinedType
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
# https://github.com/fastapi/sqlmodel/blob/
|
|
43
|
+
# https://github.com/fastapi/sqlmodel/blob/0.0.39/sqlmodel/main.py#L740
|
|
44
44
|
assert (
|
|
45
45
|
hash_function_code(sqlmodel.main.get_column_from_field)
|
|
46
|
-
== "
|
|
46
|
+
== "cddbf17b0ffec0615bf726962e62dfb3fb83ab1b81a175de72ec697b0fb21632"
|
|
47
47
|
), (
|
|
48
48
|
f"get_column_from_field has changed, please verify the patch is still valid: {hash_function_code(sqlmodel.main.get_column_from_field)}"
|
|
49
49
|
)
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
def get_column_from_field(field: Any) -> Column:
|
|
52
|
+
def get_column_from_field(field: Any) -> Column:
|
|
53
53
|
field_info = field
|
|
54
54
|
sa_column = _get_sqlmodel_field_value(field_info, "sa_column", Undefined)
|
|
55
55
|
if isinstance(sa_column, Column):
|
|
@@ -88,7 +88,7 @@ def get_column_from_field(field: Any) -> Column: # type: ignore
|
|
|
88
88
|
assert isinstance(foreign_key, str)
|
|
89
89
|
assert isinstance(ondelete_value, (str, type(None))) # for typing
|
|
90
90
|
args.append(ForeignKey(foreign_key, ondelete=ondelete_value))
|
|
91
|
-
kwargs = {
|
|
91
|
+
kwargs: dict[str, Any] = {
|
|
92
92
|
"primary_key": primary_key,
|
|
93
93
|
"nullable": nullable,
|
|
94
94
|
"index": index,
|
|
@@ -24,7 +24,7 @@ from activemodel.types.whenever import (
|
|
|
24
24
|
)
|
|
25
25
|
from activemodel.utils import hash_function_code
|
|
26
26
|
|
|
27
|
-
# https://github.com/fastapi/sqlmodel/blob/
|
|
27
|
+
# https://github.com/fastapi/sqlmodel/blob/0.0.39/sqlmodel/main.py#L686
|
|
28
28
|
assert (
|
|
29
29
|
hash_function_code(sqlmodel.main.get_sqlalchemy_type)
|
|
30
30
|
== "ac1225457303bb04a41d72382161914047b03891b76a427bdcc6668af5570933"
|
|
@@ -135,4 +135,6 @@ class ActiveModelFactory[T](SQLModelFactory[T]):
|
|
|
135
135
|
|
|
136
136
|
ActiveModelFactory.add_provider(Instant, lambda: Instant.now())
|
|
137
137
|
ActiveModelFactory.add_provider(ZonedDateTime, lambda: ZonedDateTime.now_in_system_tz())
|
|
138
|
-
ActiveModelFactory.add_provider(
|
|
138
|
+
ActiveModelFactory.add_provider(
|
|
139
|
+
PlainDateTime, lambda: ZonedDateTime.now_in_system_tz().to_plain()
|
|
140
|
+
)
|
|
@@ -33,7 +33,7 @@ def _serialize_pydantic_model(model: BaseModel | list[BaseModel] | None) -> str
|
|
|
33
33
|
# not everything in a list is a pydantic model
|
|
34
34
|
def dump_if_model(m):
|
|
35
35
|
if isinstance(m, BaseModel):
|
|
36
|
-
return m.model_dump()
|
|
36
|
+
return m.model_dump(mode="json")
|
|
37
37
|
return m
|
|
38
38
|
|
|
39
39
|
return json.dumps([dump_if_model(m) for m in model])
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from .typeid import TypeIDType
|
|
2
|
+
|
|
3
|
+
__all__ = [
|
|
4
|
+
"TypeIDType",
|
|
5
|
+
]
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
from .whenever import (
|
|
9
|
+
DateType,
|
|
10
|
+
InstantType,
|
|
11
|
+
PlainDateTimeType,
|
|
12
|
+
TimeType,
|
|
13
|
+
ZonedDateTimeType,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
__all__ += [
|
|
17
|
+
"DateType",
|
|
18
|
+
"InstantType",
|
|
19
|
+
"PlainDateTimeType",
|
|
20
|
+
"TimeType",
|
|
21
|
+
"ZonedDateTimeType",
|
|
22
|
+
]
|
|
23
|
+
except ImportError:
|
|
24
|
+
pass
|
|
@@ -4,4 +4,10 @@ from .plain_date_time_type import PlainDateTimeType
|
|
|
4
4
|
from .time_type import TimeType
|
|
5
5
|
from .zoned_date_time_type import ZonedDateTimeType
|
|
6
6
|
|
|
7
|
-
__all__ = [
|
|
7
|
+
__all__ = [
|
|
8
|
+
"DateType",
|
|
9
|
+
"InstantType",
|
|
10
|
+
"PlainDateTimeType",
|
|
11
|
+
"TimeType",
|
|
12
|
+
"ZonedDateTimeType",
|
|
13
|
+
]
|
|
@@ -1,37 +1,23 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "activemodel"
|
|
3
|
-
version = "0.24.
|
|
3
|
+
version = "0.24.2"
|
|
4
4
|
description = "SQLModel with developer ergonomics. Make SQLModel act like ActiveRecord."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.13"
|
|
7
7
|
dependencies = [
|
|
8
|
-
"sqlmodel==0.0.
|
|
9
|
-
"typeid-python==0.3.
|
|
10
|
-
"whenever>=0.10.
|
|
8
|
+
"sqlmodel==0.0.39",
|
|
9
|
+
"typeid-python==0.3.10",
|
|
10
|
+
"whenever>=0.10.3",
|
|
11
11
|
]
|
|
12
12
|
authors = [{ name = "Michael Bianco", email = "iloveitaly@gmail.com" }]
|
|
13
13
|
keywords = ["sqlmodel", "orm", "activerecord", "activemodel", "sqlalchemy"]
|
|
14
14
|
urls = { "Repository" = "https://github.com/iloveitaly/activemodel", "Documentation" = "https://iloveitaly.github.io/activemodel/" }
|
|
15
15
|
|
|
16
|
-
[project.optional-dependencies]
|
|
17
|
-
docs = [
|
|
18
|
-
"sphinx>=7.1.2",
|
|
19
|
-
"shibuya",
|
|
20
|
-
"myst-parser>=2.0.0",
|
|
21
|
-
"sphinx-design>=0.5.0",
|
|
22
|
-
"sphinx-copybutton>=0.5.2",
|
|
23
|
-
"sphinx-autobuild",
|
|
24
|
-
"sphinx-autoapi",
|
|
25
|
-
"sphinx-autodoc-typehints",
|
|
26
|
-
"sphinx-paramlinks",
|
|
27
|
-
"sphinx-llm",
|
|
28
|
-
]
|
|
29
|
-
|
|
30
16
|
[project.entry-points.pytest11]
|
|
31
17
|
activemodel = "activemodel.pytest.plugin"
|
|
32
18
|
|
|
33
19
|
[build-system]
|
|
34
|
-
requires = ["uv_build>=0.11.0,<0.
|
|
20
|
+
requires = ["uv_build>=0.11.0,<0.13"]
|
|
35
21
|
build-backend = "uv_build"
|
|
36
22
|
|
|
37
23
|
[tool.uv.build-backend]
|
|
@@ -62,6 +48,17 @@ dev = [
|
|
|
62
48
|
"covdefaults>=2.3.0",
|
|
63
49
|
"factory-boy>=3.3.3",
|
|
64
50
|
]
|
|
51
|
+
# Sphinx toolchain for local/CI docs builds — not a published package extra
|
|
52
|
+
docs = [
|
|
53
|
+
"sphinx>=7.1.2",
|
|
54
|
+
"shibuya",
|
|
55
|
+
"myst-parser>=2.0.0",
|
|
56
|
+
"sphinx-design>=0.5.0",
|
|
57
|
+
"sphinx-copybutton>=0.5.2",
|
|
58
|
+
"sphinx-autobuild",
|
|
59
|
+
"sphinx-autoapi",
|
|
60
|
+
"sphinx-llm",
|
|
61
|
+
]
|
|
65
62
|
|
|
66
63
|
[tool.pyright]
|
|
67
64
|
exclude = [
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
from .typeid import TypeIDType
|
|
2
|
-
|
|
3
|
-
__all__ = [
|
|
4
|
-
"TypeIDType",
|
|
5
|
-
]
|
|
6
|
-
|
|
7
|
-
try:
|
|
8
|
-
from .whenever import DateType, InstantType, PlainDateTimeType, TimeType, ZonedDateTimeType
|
|
9
|
-
|
|
10
|
-
__all__ += ["DateType", "InstantType", "PlainDateTimeType", "TimeType", "ZonedDateTimeType"]
|
|
11
|
-
except ImportError:
|
|
12
|
-
pass
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{activemodel-0.24.0 → activemodel-0.24.2}/activemodel/types/whenever/plain_date_time_type.py
RENAMED
|
File without changes
|
|
File without changes
|
{activemodel-0.24.0 → activemodel-0.24.2}/activemodel/types/whenever/zoned_date_time_type.py
RENAMED
|
File without changes
|
|
File without changes
|