svc-infra 0.1.177__py3-none-any.whl → 0.1.179__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.
- svc_infra/db/README.md +1 -1
- svc_infra/db/constants.py +2 -2
- svc_infra/db/scaffold.py +3 -3
- svc_infra/db/templates/__init__.py +1 -1
- svc_infra/db/templates/models_schemas/auth/models.py.tmpl +2 -1
- svc_infra/db/templates/setup/env_async.py.tmpl +1 -1
- svc_infra/db/templates/setup/env_sync.py.tmpl +1 -1
- svc_infra/db/utils.py +1 -1
- {svc_infra-0.1.177.dist-info → svc_infra-0.1.179.dist-info}/METADATA +2 -2
- {svc_infra-0.1.177.dist-info → svc_infra-0.1.179.dist-info}/RECORD +12 -12
- {svc_infra-0.1.177.dist-info → svc_infra-0.1.179.dist-info}/WHEEL +0 -0
- {svc_infra-0.1.177.dist-info → svc_infra-0.1.179.dist-info}/entry_points.txt +0 -0
svc_infra/db/README.md
CHANGED
svc_infra/db/constants.py
CHANGED
@@ -12,12 +12,12 @@ DEFAULT_DB_ENV_VARS: Sequence[str] = (
|
|
12
12
|
# Regex used to detect async drivers from URL drivername
|
13
13
|
ASYNC_DRIVER_HINT = re.compile(r"\+(?:async|asyncpg|aiosqlite|aiomysql|asyncmy|aio\w+)")
|
14
14
|
|
15
|
-
# Alembic templates loaded from package resources (svc_infra.db.
|
15
|
+
# Alembic templates loaded from package resources (svc_infra.db.templates.setup)
|
16
16
|
# Kept as module-level constants for compatibility with core.py
|
17
17
|
try:
|
18
18
|
import importlib.resources as pkg
|
19
19
|
|
20
|
-
_tmpl_pkg = pkg.files("svc_infra.db.
|
20
|
+
_tmpl_pkg = pkg.files("svc_infra.db.templates.setup")
|
21
21
|
ALEMBIC_INI_TEMPLATE = _tmpl_pkg.joinpath("alembic.ini.tmpl").read_text(encoding="utf-8")
|
22
22
|
ALEMBIC_SCRIPT_TEMPLATE = _tmpl_pkg.joinpath("script.py.mako.tmpl").read_text(encoding="utf-8")
|
23
23
|
except Exception:
|
svc_infra/db/scaffold.py
CHANGED
@@ -31,7 +31,7 @@ def _ensure_init_py(dir_path: Path, overwrite: bool, paired: bool) -> Dict[str,
|
|
31
31
|
def _render_auth_template(name: str) -> str:
|
32
32
|
import importlib.resources as pkg
|
33
33
|
from string import Template as _T
|
34
|
-
txt = pkg.files("svc_infra.db.
|
34
|
+
txt = pkg.files("svc_infra.db.templates.models_schemas.auth").joinpath(name).read_text(encoding="utf-8")
|
35
35
|
return _T(txt).substitute({}) # no variables today
|
36
36
|
|
37
37
|
# ---------------- entity templates (loaded from package only) ----------------
|
@@ -39,10 +39,10 @@ def _render_auth_template(name: str) -> str:
|
|
39
39
|
def _render_entity_template(name: str, subs: Dict[str, Any]) -> str:
|
40
40
|
"""Render an entity template file using string.Template.
|
41
41
|
|
42
|
-
Looks up templates under svc_infra.db.
|
42
|
+
Looks up templates under svc_infra.db.templates.models_schemas.entity/<name> and requires them to exist.
|
43
43
|
"""
|
44
44
|
import importlib.resources as pkg
|
45
|
-
txt = pkg.files("svc_infra.db.
|
45
|
+
txt = pkg.files("svc_infra.db.templates.models_schemas.entity").joinpath(name).read_text(encoding="utf-8")
|
46
46
|
return Template(txt).substitute(subs)
|
47
47
|
|
48
48
|
# ---------------- tiny utilities ----------------
|
@@ -1,2 +1,2 @@
|
|
1
|
-
# package marker for svc_infra.db.
|
1
|
+
# package marker for svc_infra.db.templates
|
2
2
|
|
@@ -11,6 +11,7 @@ from sqlalchemy.orm import Mapped, mapped_column
|
|
11
11
|
from sqlalchemy.ext.mutable import MutableDict, MutableList # <-- add
|
12
12
|
|
13
13
|
from svc_infra.db.base import ModelBase
|
14
|
+
from svc_infra.auth.user_default import _pwd
|
14
15
|
|
15
16
|
class User(ModelBase):
|
16
17
|
__tablename__ = "users"
|
@@ -26,7 +27,7 @@ class User(ModelBase):
|
|
26
27
|
password_hash: Mapped[str] = mapped_column(String(512), nullable=False)
|
27
28
|
|
28
29
|
@property
|
29
|
-
def password(self) -> str:
|
30
|
+
def password(self) -> str: # never readable
|
30
31
|
raise AttributeError("password is write-only")
|
31
32
|
|
32
33
|
@password.setter
|
@@ -8,7 +8,7 @@ from alembic import context
|
|
8
8
|
from sqlalchemy.engine import make_url, URL
|
9
9
|
from sqlalchemy.ext.asyncio import create_async_engine
|
10
10
|
|
11
|
-
from svc_infra.db.
|
11
|
+
from svc_infra.db.utils import (
|
12
12
|
get_database_url_from_env,
|
13
13
|
_ensure_ssl_default_async as _ensure_ssl_default,
|
14
14
|
)
|
svc_infra/db/utils.py
CHANGED
@@ -777,7 +777,7 @@ def render_env_py(packages: Sequence[str], *, async_db: bool | None = None) -> s
|
|
777
777
|
async_db = False
|
778
778
|
|
779
779
|
pkg_list = ", ".join(repr(p) for p in packages)
|
780
|
-
tmpl_root = pkg.files("svc_infra.db.
|
780
|
+
tmpl_root = pkg.files("svc_infra.db.templates.setup")
|
781
781
|
name = "env_async.py.tmpl" if async_db else "env_sync.py.tmpl"
|
782
782
|
txt = tmpl_root.joinpath(name).read_text(encoding="utf-8")
|
783
783
|
return txt.replace("__PACKAGES_LIST__", pkg_list)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: svc-infra
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.179
|
4
4
|
Summary: Infrastructure for building and deploying prod-ready services
|
5
5
|
License: MIT
|
6
6
|
Keywords: fastapi,sqlalchemy,alembic,auth,infra,async,pydantic
|
@@ -87,7 +87,7 @@ pip install svc-infra
|
|
87
87
|
|
88
88
|
Two MCP servers are available as Node shims that launch the Python modules via uvx:
|
89
89
|
- auth-infra-mcp -> svc_infra.auth.mcp
|
90
|
-
- db-management-mcp -> svc_infra.db.
|
90
|
+
- db-management-mcp -> svc_infra.db.mcp
|
91
91
|
|
92
92
|
Prerequisites:
|
93
93
|
- Python 3.11+ available to uvx
|
@@ -41,24 +41,24 @@ svc_infra/cli/cmds/scaffold_cmds.py,sha256=4GBtDgtn9-ipDoos-6NA32Hk_b0ZNNByzS-7c
|
|
41
41
|
svc_infra/cli/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
42
42
|
svc_infra/cli/foundation/runner.py,sha256=LV6XCPSSdiRzjSoueS422gi-4ZaQH-YWPad82C8ohX0,1822
|
43
43
|
svc_infra/cli/foundation/typer_bootstrap.py,sha256=Px1cQR58Rv14CXwVdI_1YwZvUg1ywtt3ohVJfuo0axk,937
|
44
|
-
svc_infra/db/README.md,sha256=
|
44
|
+
svc_infra/db/README.md,sha256=14AAnvzv9IC72G-VKC3tUePIKgXuTcrS3c0AMuhrhVg,8622
|
45
45
|
svc_infra/db/__init__.py,sha256=z4jTjKAZDJVLaSzBbiaTTqx649CgK0BnidIfM7HbMDo,37
|
46
46
|
svc_infra/db/base.py,sha256=Bol82wM1Zkp0QUwoXH_rHkdaclqwC9BIAVFkixlAhgo,312
|
47
|
-
svc_infra/db/constants.py,sha256=
|
47
|
+
svc_infra/db/constants.py,sha256=uVW0OEkHocBkGw6OHk2FiLjHIFW25uOuumuHnVEV0Hw,1619
|
48
48
|
svc_infra/db/core.py,sha256=3Efm88fajfKJa8gDiiTVkhx2ci_UbrLiR4B8gMQYuwU,10745
|
49
|
-
svc_infra/db/scaffold.py,sha256=
|
50
|
-
svc_infra/db/templates/__init__.py,sha256=
|
49
|
+
svc_infra/db/scaffold.py,sha256=NBz8BJR8MPvntCGv5HKoqNNR41SMnCkb-DlCCIsu0fo,9878
|
50
|
+
svc_infra/db/templates/__init__.py,sha256=3PRa4v05RGyjX6LZXSOf-eMRir8vij7tET95limMips,45
|
51
51
|
svc_infra/db/templates/models_schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
52
|
-
svc_infra/db/templates/models_schemas/auth/models.py.tmpl,sha256=
|
52
|
+
svc_infra/db/templates/models_schemas/auth/models.py.tmpl,sha256=oBr-xVlR5OgeMTztd1qPmPc4TLjdHLJyieATkheo710,2514
|
53
53
|
svc_infra/db/templates/models_schemas/auth/schemas.py.tmpl,sha256=GjDDEHO-BNV-Xi5z2ZOygXovnECgSu8OkEg8Qx6vgIE,1693
|
54
54
|
svc_infra/db/templates/models_schemas/entity/models.py.tmpl,sha256=dZk7a3WwpddSylPW81ARTyjbqJ-4rduX8-KAZ3Tlomo,1173
|
55
55
|
svc_infra/db/templates/models_schemas/entity/schemas.py.tmpl,sha256=zBhid1jFPwVN86OvkiIJkTFphN7LDcs_Hs9kxxeoNjE,1009
|
56
56
|
svc_infra/db/templates/setup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
57
57
|
svc_infra/db/templates/setup/alembic.ini.tmpl,sha256=QAQ_3-p8GnrpLoX2g-Fpi6aMfrS3m4ZMJ34OTfujnrI,780
|
58
|
-
svc_infra/db/templates/setup/env_async.py.tmpl,sha256=
|
59
|
-
svc_infra/db/templates/setup/env_sync.py.tmpl,sha256=
|
58
|
+
svc_infra/db/templates/setup/env_async.py.tmpl,sha256=05uDe_jiEkJOdXcSIgJovN3TxPG8wm8BjUoSdktsH_0,6224
|
59
|
+
svc_infra/db/templates/setup/env_sync.py.tmpl,sha256=vlUKrhnQiBqAGDfbtx0D_CahF1Hjj8uTIQ5lNnx_l0Q,6273
|
60
60
|
svc_infra/db/templates/setup/script.py.mako.tmpl,sha256=EgltN1ghYU7rH1zAujsLWLe1NThI-41x9fabByne5II,509
|
61
|
-
svc_infra/db/utils.py,sha256=
|
61
|
+
svc_infra/db/utils.py,sha256=PxaZ6AesRlDyQk7tOzi9YaeF7Ge4zsZP83wqkKHu5-E,30838
|
62
62
|
svc_infra/mcp/__init__.py,sha256=SiJ50LO7J6AneYswZe1kUX3dKXiECPpsjGPjT0SGtuc,1272
|
63
63
|
svc_infra/mcp/svc_infra_mcp.py,sha256=VTU8esJ4FH9WNgxplufUWCVqGkxwscaLnBBtj-B5iCQ,1343
|
64
64
|
svc_infra/observability/README.md,sha256=U26PnGA0nN6a0yT3KGu2eN9lpiUXkvK9nxCqWpasiyw,4459
|
@@ -75,7 +75,7 @@ svc_infra/observability/templates/prometheus_rules.yml,sha256=sbVLm1h40FMkGSeWO4
|
|
75
75
|
svc_infra/observability/tracing/__init__.py,sha256=TOs2yCicqBdo4OfOHTMmqeHsn7DBRu5EdvF2L5f31Y0,237
|
76
76
|
svc_infra/observability/tracing/setup.py,sha256=21Ob276U4KZOs6M2o1O79wQXFHV0gY6YdMyjeqMrzMU,5042
|
77
77
|
svc_infra/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
78
|
-
svc_infra-0.1.
|
79
|
-
svc_infra-0.1.
|
80
|
-
svc_infra-0.1.
|
81
|
-
svc_infra-0.1.
|
78
|
+
svc_infra-0.1.179.dist-info/METADATA,sha256=V2IaHLch6I5yCQfr6aJrAl2skDUatpqRbvf4q1GiPMY,4981
|
79
|
+
svc_infra-0.1.179.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
80
|
+
svc_infra-0.1.179.dist-info/entry_points.txt,sha256=6x_nZOsjvn6hRZsMgZLgTasaCSKCgAjsGhACe_CiP0U,48
|
81
|
+
svc_infra-0.1.179.dist-info/RECORD,,
|
File without changes
|
File without changes
|