TypeDAL 3.0.0b3__py3-none-any.whl → 3.0.1__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.
Potentially problematic release.
This version of TypeDAL might be problematic. Click here for more details.
- typedal/__about__.py +1 -1
- typedal/cli.py +6 -20
- typedal/config.py +4 -5
- typedal/core.py +1 -1
- typedal/helpers.py +15 -0
- {typedal-3.0.0b3.dist-info → typedal-3.0.1.dist-info}/METADATA +5 -5
- {typedal-3.0.0b3.dist-info → typedal-3.0.1.dist-info}/RECORD +9 -9
- {typedal-3.0.0b3.dist-info → typedal-3.0.1.dist-info}/WHEEL +1 -1
- {typedal-3.0.0b3.dist-info → typedal-3.0.1.dist-info}/entry_points.txt +0 -0
typedal/__about__.py
CHANGED
typedal/cli.py
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Typer CLI for TypeDAL.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
import fnmatch
|
|
6
5
|
import sys
|
|
7
6
|
import typing
|
|
8
7
|
import warnings
|
|
@@ -14,6 +13,7 @@ from configuraptor import asdict
|
|
|
14
13
|
from configuraptor.alias import is_alias
|
|
15
14
|
from configuraptor.helpers import is_optional
|
|
16
15
|
|
|
16
|
+
from .helpers import match_strings
|
|
17
17
|
from .types import AnyDict
|
|
18
18
|
|
|
19
19
|
try:
|
|
@@ -240,7 +240,7 @@ def generate_migrations(
|
|
|
240
240
|
output_format: OutputFormat_Option = None,
|
|
241
241
|
output_file: Optional[str] = None,
|
|
242
242
|
dry_run: bool = False,
|
|
243
|
-
) -> bool:
|
|
243
|
+
) -> bool: # pragma: no cover
|
|
244
244
|
"""
|
|
245
245
|
Run pydal2sql based on the typedal config.
|
|
246
246
|
"""
|
|
@@ -313,7 +313,7 @@ def run_migrations(
|
|
|
313
313
|
schema: Optional[str] = None,
|
|
314
314
|
create_flag_location: Optional[bool] = None,
|
|
315
315
|
dry_run: bool = False,
|
|
316
|
-
) -> bool:
|
|
316
|
+
) -> bool: # pragma: no cover
|
|
317
317
|
"""
|
|
318
318
|
Run edwh-migrate based on the typedal config.
|
|
319
319
|
"""
|
|
@@ -345,20 +345,6 @@ def run_migrations(
|
|
|
345
345
|
return True
|
|
346
346
|
|
|
347
347
|
|
|
348
|
-
def match_strings(patterns: list[str] | str, string_list: list[str]) -> list[str]:
|
|
349
|
-
"""
|
|
350
|
-
Glob but on a list of strings.
|
|
351
|
-
"""
|
|
352
|
-
if isinstance(patterns, str):
|
|
353
|
-
patterns = [patterns]
|
|
354
|
-
|
|
355
|
-
matches = []
|
|
356
|
-
for pattern in patterns:
|
|
357
|
-
matches.extend([s for s in string_list if fnmatch.fnmatch(s, pattern)])
|
|
358
|
-
|
|
359
|
-
return matches
|
|
360
|
-
|
|
361
|
-
|
|
362
348
|
@app.command(name="migrations.fake")
|
|
363
349
|
@with_exit_code(hide_tb=IS_DEBUG)
|
|
364
350
|
def fake_migrations(
|
|
@@ -370,7 +356,7 @@ def fake_migrations(
|
|
|
370
356
|
db_folder: Optional[str] = None,
|
|
371
357
|
migrate_table: Optional[str] = None,
|
|
372
358
|
dry_run: bool = False,
|
|
373
|
-
) -> int:
|
|
359
|
+
) -> int: # pragma: no cover
|
|
374
360
|
"""
|
|
375
361
|
Mark one or more migrations as completed in the database, without executing the SQL code.
|
|
376
362
|
|
|
@@ -495,7 +481,7 @@ def cache_stats(
|
|
|
495
481
|
fmt: typing.Annotated[
|
|
496
482
|
str, typer.Option("--format", "--fmt", "-f", help="plaintext (default) or json")
|
|
497
483
|
] = "plaintext",
|
|
498
|
-
) -> None:
|
|
484
|
+
) -> None: # pragma: no cover
|
|
499
485
|
"""
|
|
500
486
|
Collect caching stats.
|
|
501
487
|
|
|
@@ -538,7 +524,7 @@ def cache_stats(
|
|
|
538
524
|
def cache_clear(
|
|
539
525
|
connection: typing.Annotated[str, typer.Option("--connection", "-c")] = None,
|
|
540
526
|
purge: typing.Annotated[bool, typer.Option("--all", "--purge", "-p")] = False,
|
|
541
|
-
) -> None:
|
|
527
|
+
) -> None: # pragma: no cover
|
|
542
528
|
"""
|
|
543
529
|
Clear (expired) items from the cache.
|
|
544
530
|
|
typedal/config.py
CHANGED
|
@@ -122,8 +122,7 @@ class TypeDALConfig(TypedConfig):
|
|
|
122
122
|
)
|
|
123
123
|
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
def _load_toml(path: str | bool | None = True) -> tuple[str, AnyDict]:
|
|
125
|
+
def _load_toml(path: str | bool | Path | None = True) -> tuple[str, AnyDict]:
|
|
127
126
|
"""
|
|
128
127
|
Path can be a file, a directory, a bool or None.
|
|
129
128
|
|
|
@@ -136,10 +135,10 @@ def _load_toml(path: str | bool | None = True) -> tuple[str, AnyDict]:
|
|
|
136
135
|
toml_path = None
|
|
137
136
|
elif path in (True, None):
|
|
138
137
|
toml_path = find_pyproject_toml()
|
|
139
|
-
elif Path(str(path)).is_file():
|
|
140
|
-
toml_path =
|
|
138
|
+
elif (_p := Path(str(path))) and _p.is_file():
|
|
139
|
+
toml_path = _p
|
|
141
140
|
else:
|
|
142
|
-
toml_path = find_pyproject_toml(path)
|
|
141
|
+
toml_path = find_pyproject_toml(str(path))
|
|
143
142
|
|
|
144
143
|
if not toml_path:
|
|
145
144
|
# nothing to load
|
typedal/core.py
CHANGED
|
@@ -519,7 +519,7 @@ class TypeDAL(pydal.DAL): # type: ignore
|
|
|
519
519
|
if k not in relationships and (new_relationship := to_relationship(cls, k, annotations[k]))
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
-
cache_dependency = kwargs.pop("cache_dependency", True)
|
|
522
|
+
cache_dependency = self._config.caching and kwargs.pop("cache_dependency", True)
|
|
523
523
|
|
|
524
524
|
table: Table = self.define_table(tablename, *fields.values(), **kwargs)
|
|
525
525
|
|
typedal/helpers.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Helpers that work independently of core.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
+
import fnmatch
|
|
5
6
|
import io
|
|
6
7
|
import types
|
|
7
8
|
import typing
|
|
@@ -241,3 +242,17 @@ def as_lambda(value: T) -> typing.Callable[..., T]:
|
|
|
241
242
|
Wrap value in a callable.
|
|
242
243
|
"""
|
|
243
244
|
return lambda *_, **__: value
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
def match_strings(patterns: list[str] | str, string_list: list[str]) -> list[str]:
|
|
248
|
+
"""
|
|
249
|
+
Glob but on a list of strings.
|
|
250
|
+
"""
|
|
251
|
+
if isinstance(patterns, str):
|
|
252
|
+
patterns = [patterns]
|
|
253
|
+
|
|
254
|
+
matches = []
|
|
255
|
+
for pattern in patterns:
|
|
256
|
+
matches.extend([s for s in string_list if fnmatch.fnmatch(s, pattern)])
|
|
257
|
+
|
|
258
|
+
return matches
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: TypeDAL
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.1
|
|
4
4
|
Summary: Typing support for PyDAL
|
|
5
5
|
Project-URL: Documentation, https://typedal.readthedocs.io/
|
|
6
6
|
Project-URL: Issues, https://github.com/trialandsuccess/TypeDAL/issues
|
|
@@ -22,7 +22,7 @@ Requires-Dist: pydal
|
|
|
22
22
|
Provides-Extra: all
|
|
23
23
|
Requires-Dist: edwh-migrate>=0.8.0b1; extra == 'all'
|
|
24
24
|
Requires-Dist: py4web; extra == 'all'
|
|
25
|
-
Requires-Dist: pydal2sql[all]; extra == 'all'
|
|
25
|
+
Requires-Dist: pydal2sql[all]>=1.1.3; extra == 'all'
|
|
26
26
|
Requires-Dist: questionary; extra == 'all'
|
|
27
27
|
Requires-Dist: tabulate; extra == 'all'
|
|
28
28
|
Requires-Dist: tomlkit; extra == 'all'
|
|
@@ -37,8 +37,8 @@ Requires-Dist: su6[all]; extra == 'dev'
|
|
|
37
37
|
Requires-Dist: types-pyyaml; extra == 'dev'
|
|
38
38
|
Requires-Dist: types-tabulate; extra == 'dev'
|
|
39
39
|
Provides-Extra: migrations
|
|
40
|
-
Requires-Dist: edwh-migrate; extra == 'migrations'
|
|
41
|
-
Requires-Dist: pydal2sql; extra == 'migrations'
|
|
40
|
+
Requires-Dist: edwh-migrate>=0.8.0b1; extra == 'migrations'
|
|
41
|
+
Requires-Dist: pydal2sql>=1.1.3; extra == 'migrations'
|
|
42
42
|
Requires-Dist: questionary; extra == 'migrations'
|
|
43
43
|
Requires-Dist: tabulate; extra == 'migrations'
|
|
44
44
|
Requires-Dist: tomlkit; extra == 'migrations'
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
typedal/__about__.py,sha256=
|
|
1
|
+
typedal/__about__.py,sha256=8UfBCir8PsjPHcCRJyA0FLS1a3orteNLkZd6vHHlXjc,206
|
|
2
2
|
typedal/__init__.py,sha256=QQpLiVl9w9hm2LBxey49Y_tCF_VB2bScVaS_mCjYy54,366
|
|
3
3
|
typedal/caching.py,sha256=8UABVAhOlBpL96ykmqhxLaFYOe-XeAh7JoGh57OkxP8,11818
|
|
4
|
-
typedal/cli.py,sha256=
|
|
5
|
-
typedal/config.py,sha256=
|
|
6
|
-
typedal/core.py,sha256=
|
|
4
|
+
typedal/cli.py,sha256=3tge8B-YjgjMC6425-RMczmWvpOTfWV5QYPXRY23IWA,18200
|
|
5
|
+
typedal/config.py,sha256=jS1K0_1F5rwJtvwTZ-qR29ZCX7WlyORGEIFvfSnusko,11645
|
|
6
|
+
typedal/core.py,sha256=nHJ2Iq67rFIB4j43KCCD-tLIjvvvf4oJhT9T6tjXqxU,95063
|
|
7
7
|
typedal/fields.py,sha256=z2PD9vLWqBR_zXtiY0DthqTG4AeF3yxKoeuVfGXnSdg,5197
|
|
8
8
|
typedal/for_py4web.py,sha256=d07b8hL_PvNDUS26Z5fDH2OxWb-IETBuAFPSzrRwm04,1285
|
|
9
9
|
typedal/for_web2py.py,sha256=zvd5xC-SmuKc0JLDqT3hMIs6COaYnwTFXD_BIeC1vug,1832
|
|
10
|
-
typedal/helpers.py,sha256=
|
|
10
|
+
typedal/helpers.py,sha256=n9dpIjXIjPpVFQnLBQreTWqRDR6hIsoNt8vGdEHGo_s,6871
|
|
11
11
|
typedal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
typedal/types.py,sha256=1kGkNX6vfGg6ln84AG558C4Zx5ACRz-emrUTnuy-rRY,3410
|
|
13
13
|
typedal/web2py_py4web_shared.py,sha256=cEbjkK0WOS9Q0nTyZuQaJWffeP4bjrL79Bx0xGy_UOs,1504
|
|
14
14
|
typedal/serializers/as_json.py,sha256=ffo152W-sARYXym4BzwX709rrO2-QwKk2KunWY8RNl4,2229
|
|
15
|
-
typedal-3.0.
|
|
16
|
-
typedal-3.0.
|
|
17
|
-
typedal-3.0.
|
|
18
|
-
typedal-3.0.
|
|
15
|
+
typedal-3.0.1.dist-info/METADATA,sha256=GTmtFnSnOhgJI-P_hriMxRSZJf1EkEu9cT6eV2APM0s,7782
|
|
16
|
+
typedal-3.0.1.dist-info/WHEEL,sha256=uNdcs2TADwSd5pVaP0Z_kcjcvvTUklh2S7bxZMF8Uj0,87
|
|
17
|
+
typedal-3.0.1.dist-info/entry_points.txt,sha256=m1wqcc_10rHWPdlQ71zEkmJDADUAnZtn7Jac_6mbyUc,44
|
|
18
|
+
typedal-3.0.1.dist-info/RECORD,,
|
|
File without changes
|