TypeDAL 5.0.0__tar.gz → 5.0.1__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.
- {typedal-5.0.0 → typedal-5.0.1}/CHANGELOG.md +5 -0
- {typedal-5.0.0 → typedal-5.0.1}/PKG-INFO +1 -1
- {typedal-5.0.0 → typedal-5.0.1}/pyproject.toml +1 -1
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/tables.py +3 -3
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_mypy.py +2 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_table.py +16 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_typing_mypy.md +1 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_typing_pyright.md +1 -0
- {typedal-5.0.0 → typedal-5.0.1}/uv.lock +1 -1
- {typedal-5.0.0 → typedal-5.0.1}/.crush/.gitignore +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/.crush/init +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/.crush/logs/crush.log +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/.github/workflows/su6.yml +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/.gitignore +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/.readthedocs.yml +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/README.md +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/coverage.svg +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/docs/10_advanced_apis.md +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/docs/11_async.md +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/docs/1_getting_started.md +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/docs/2_defining_tables.md +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/docs/3_building_queries.md +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/docs/4_relationships.md +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/docs/5_py4web.md +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/docs/6_migrations.md +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/docs/7_configuration.md +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/docs/8_mixins.md +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/docs/9_memoization.md +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/docs/css/code_blocks.css +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/docs/index.md +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/docs/requirements.txt +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/example_new.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/example_old.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/mkdocs.yml +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/__about__.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/__init__.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/asynchronous.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/caching.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/cli.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/config.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/constants.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/core.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/define.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/enum_helpers.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/fields.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/for_py4web.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/for_web2py.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/helpers.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/mixins.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/py.typed +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/query_builder.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/relationships.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/rows.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/serializers/as_json.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/serializers/typescript.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/types.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/src/typedal/web2py_py4web_shared.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tasks.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/__init__.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/configs/simple.toml +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/configs/valid.env +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/configs/valid.toml +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/conftest.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/py314_tests.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_async.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_cli.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_config.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_docs_examples.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_helpers.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_json.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_main.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_mixins.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_orm.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_py4web.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_query_builder.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_relationships.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_row.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_stats.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_typescript.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_web2py.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/test_xx_others.py +0 -0
- {typedal-5.0.0 → typedal-5.0.1}/tests/timings.py +0 -0
|
@@ -96,6 +96,8 @@ class TableMeta(type):
|
|
|
96
96
|
|
|
97
97
|
"""
|
|
98
98
|
|
|
99
|
+
id: "TypedField[int]" # class access; instance access is declared on _TypedTable
|
|
100
|
+
|
|
99
101
|
# set up by db.define:
|
|
100
102
|
# _db: TypeDAL | None = None
|
|
101
103
|
# _table: Table | None = None
|
|
@@ -877,7 +879,7 @@ class _TypedTable(metaclass=TableMeta):
|
|
|
877
879
|
# This class contains weird typing glue to dodge MRO headaches without losing editor/mypy table methods
|
|
878
880
|
# you can safely ignore it when changing runtime behavior; touch it only for typing/mypy issues
|
|
879
881
|
|
|
880
|
-
id:
|
|
882
|
+
id: int # instance access; class access comes from TableMeta
|
|
881
883
|
|
|
882
884
|
_before_insert: list[t.Callable[[t.Self], t.Optional[bool]] | t.Callable[[OpRow], t.Optional[bool]]]
|
|
883
885
|
_after_insert: list[
|
|
@@ -1062,8 +1064,6 @@ class TypedTable(_TypedTable, metaclass=TableMeta):
|
|
|
1062
1064
|
_row: Row | None = None
|
|
1063
1065
|
_rows: tuple[Row, ...] = ()
|
|
1064
1066
|
|
|
1065
|
-
id: "TypedField[int]"
|
|
1066
|
-
|
|
1067
1067
|
_with: list[str]
|
|
1068
1068
|
|
|
1069
1069
|
@classproperty
|
|
@@ -50,6 +50,8 @@ def mypy_test_typedal_define() -> None:
|
|
|
50
50
|
db.define(LaterDefine)
|
|
51
51
|
reveal_type(LaterDefine()) # R: tests.test_mypy.LaterDefine
|
|
52
52
|
|
|
53
|
+
reveal_type(MyTable.id) # R: typedal.fields.TypedField[int]
|
|
54
|
+
reveal_type(MyTable().id) # R: int
|
|
53
55
|
reveal_type(MyTable.normal) # R: str
|
|
54
56
|
reveal_type(MyTable().normal) # R: str
|
|
55
57
|
reveal_type(MyTable.fancy) # R: typedal.fields.TypedField[str]
|
|
@@ -256,3 +256,19 @@ def test_table_with_methods():
|
|
|
256
256
|
|
|
257
257
|
loaded = json.loads(dumped)
|
|
258
258
|
assert loaded[0]["age"] == 20
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def test_string_annotation_is_resolved():
|
|
262
|
+
# annotations reach the builder as strings on Python < 3.14, or when quoted twice
|
|
263
|
+
builder = db._builder
|
|
264
|
+
|
|
265
|
+
assert builder.annotation_to_pydal_fieldtype("str", {}) == "string"
|
|
266
|
+
assert builder.annotation_to_pydal_fieldtype("TypedField[str]", {}) == "string"
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def test_as_typeddict_unwraps_typed_field():
|
|
270
|
+
@db.define()
|
|
271
|
+
class TypedDictModel(TypedTable):
|
|
272
|
+
generic: TypedField[str]
|
|
273
|
+
|
|
274
|
+
assert TypedDictModel.as_typeddict().__annotations__ == {"id": int, "generic": str}
|
|
@@ -43,6 +43,7 @@ for deferred_define in DeferredDefine.paginate(limit=1):
|
|
|
43
43
|
new_row = WithBraces.insert()
|
|
44
44
|
|
|
45
45
|
reveal_type(new_row) # revealed: test_snippet.WithBraces
|
|
46
|
+
reveal_type(WithBraces.id) # revealed: typedal.fields.TypedField[int]
|
|
46
47
|
reveal_type(new_row.id) # revealed: int
|
|
47
48
|
|
|
48
49
|
reveal_type(WithBraces.gid) # revealed: typedal.fields.TypedField[str]
|
|
@@ -41,6 +41,7 @@ for deferred_define in DeferredDefine.paginate(limit=1):
|
|
|
41
41
|
new_row = WithBraces.insert()
|
|
42
42
|
|
|
43
43
|
reveal_type(new_row) # revealed: WithBraces
|
|
44
|
+
reveal_type(WithBraces.id) # revealed: TypedField[int]
|
|
44
45
|
reveal_type(new_row.id) # revealed: int
|
|
45
46
|
|
|
46
47
|
reveal_type(WithBraces.gid) # revealed: TypedField[str]
|
|
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
|
|
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
|
|
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
|
|
File without changes
|