fastapi-augment 0.1.1__tar.gz → 0.1.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.
Files changed (78) hide show
  1. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/PKG-INFO +1 -1
  2. fastapi_augment-0.1.2/VERSION +1 -0
  3. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/pyproject.toml +3 -3
  4. fastapi_augment-0.1.2/src/fastapi_augment/common/utils/__init__.py +32 -0
  5. fastapi_augment-0.1.2/src/fastapi_augment/common/utils/paths.py +36 -0
  6. fastapi_augment-0.1.2/src/fastapi_augment/db/sqlalchemy/alembic/README +1 -0
  7. fastapi_augment-0.1.2/src/fastapi_augment/db/sqlalchemy/alembic/script.py.mako +28 -0
  8. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment.egg-info/PKG-INFO +1 -1
  9. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment.egg-info/SOURCES.txt +3 -0
  10. fastapi_augment-0.1.1/VERSION +0 -1
  11. fastapi_augment-0.1.1/src/fastapi_augment/common/utils/__init__.py +0 -5
  12. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/README.md +0 -0
  13. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/setup.cfg +0 -0
  14. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/__init__.py +0 -0
  15. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/common/__init__.py +0 -0
  16. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/common/constants.py +0 -0
  17. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/common/exception_handlers.py +0 -0
  18. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/common/exceptions.py +0 -0
  19. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/common/utils/strings.py +0 -0
  20. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/config/__init__.py +0 -0
  21. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/config/settings.py +0 -0
  22. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/db/__init__.py +0 -0
  23. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/db/sqlalchemy/__init__.py +0 -0
  24. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/db/sqlalchemy/alembic/__init__.py +0 -0
  25. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/db/sqlalchemy/alembic/env.py +0 -0
  26. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/db/sqlalchemy/base.py +0 -0
  27. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/db/sqlalchemy/engine.py +0 -0
  28. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/db/sqlalchemy/migrate.py +0 -0
  29. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/db/sqlalchemy/mixins/__init__.py +0 -0
  30. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/db/sqlalchemy/mixins/audit.py +0 -0
  31. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/db/sqlalchemy/mixins/soft_delete.py +0 -0
  32. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/db/sqlalchemy/mixins/timestamp.py +0 -0
  33. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/db/sqlalchemy/model_base.py +0 -0
  34. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/db/sqlalchemy/repository_base.py +0 -0
  35. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/db/sqlalchemy/session.py +0 -0
  36. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/factory.py +0 -0
  37. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/health/__init__.py +0 -0
  38. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/health/checker.py +0 -0
  39. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/health/checkers.py +0 -0
  40. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/health/router.py +0 -0
  41. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/lifespan.py +0 -0
  42. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/log/__init__.py +0 -0
  43. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/log/config.py +0 -0
  44. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/log/factory.py +0 -0
  45. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/log/filters.py +0 -0
  46. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/log/handlers.py +0 -0
  47. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/middlewares/__init__.py +0 -0
  48. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/middlewares/base.py +0 -0
  49. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/middlewares/request_id.py +0 -0
  50. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/openapi.py +0 -0
  51. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/py.typed +0 -0
  52. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/schemas/__init__.py +0 -0
  53. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/schemas/base.py +0 -0
  54. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/schemas/pagination.py +0 -0
  55. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/schemas/request.py +0 -0
  56. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/schemas/response.py +0 -0
  57. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment/schemas/types.py +0 -0
  58. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment.egg-info/dependency_links.txt +0 -0
  59. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment.egg-info/entry_points.txt +0 -0
  60. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment.egg-info/requires.txt +0 -0
  61. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/src/fastapi_augment.egg-info/top_level.txt +0 -0
  62. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/tests/test_config.py +0 -0
  63. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/tests/test_constants.py +0 -0
  64. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/tests/test_db_engine.py +0 -0
  65. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/tests/test_db_repository.py +0 -0
  66. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/tests/test_db_session_models.py +0 -0
  67. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/tests/test_exception_handlers.py +0 -0
  68. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/tests/test_exceptions.py +0 -0
  69. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/tests/test_factory.py +0 -0
  70. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/tests/test_health.py +0 -0
  71. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/tests/test_lifespan.py +0 -0
  72. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/tests/test_log.py +0 -0
  73. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/tests/test_middlewares.py +0 -0
  74. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/tests/test_migrate.py +0 -0
  75. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/tests/test_model_base.py +0 -0
  76. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/tests/test_openapi.py +0 -0
  77. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/tests/test_schemas.py +0 -0
  78. {fastapi_augment-0.1.1 → fastapi_augment-0.1.2}/tests/test_settings.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastapi-augment
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: FastAPI 通用代码工具包,跨项目复用
5
5
  Author-email: zarkhan <hanguangzheng@qq.com>
6
6
  License-Expression: MIT
@@ -0,0 +1 @@
1
+ 0.1.2
@@ -77,9 +77,9 @@ include = ["fastapi_augment*"]
77
77
  [tool.setuptools.package-data]
78
78
  fastapi_augment = [
79
79
  "py.typed",
80
- "db/sqlalchemy/migrations/*.py",
81
- "db/sqlalchemy/migrations/*.mako",
82
- "db/sqlalchemy/migrations/README",
80
+ "db/sqlalchemy/alembic/*.py",
81
+ "db/sqlalchemy/alembic/*.mako",
82
+ "db/sqlalchemy/alembic/README",
83
83
  ]
84
84
 
85
85
  [tool.setuptools.dynamic]
@@ -0,0 +1,32 @@
1
+ """
2
+ @Author : hangu
3
+ @CreateDate : 2026/9/4
4
+ @Description :
5
+ """
6
+ from .paths import get_root_dir
7
+ from .strings import (
8
+ SupportsWriteStr,
9
+ SupportsReadBytes,
10
+ camel_to_snake,
11
+ snake_to_camel,
12
+ random_string,
13
+ json_dumps,
14
+ json_dump,
15
+ json_loads,
16
+ json_load
17
+ )
18
+
19
+ __all__ = [
20
+ # paths
21
+ 'get_root_dir',
22
+ # strings
23
+ 'SupportsWriteStr',
24
+ 'SupportsReadBytes',
25
+ 'camel_to_snake',
26
+ 'snake_to_camel',
27
+ 'random_string',
28
+ 'json_dumps',
29
+ 'json_dump',
30
+ 'json_loads',
31
+ 'json_load'
32
+ ]
@@ -0,0 +1,36 @@
1
+ """
2
+ @Author : hangu
3
+ @CreateDate : 2026/9/9
4
+ @Description :
5
+ """
6
+ import sys
7
+ from pathlib import Path
8
+
9
+
10
+ # 获取项目根目录路径
11
+ def get_root_dir(reference_path: str | Path, parent_index: int) -> Path:
12
+ """
13
+ 动态获取项目根目录路径,兼容源码开发环境与 PyInstaller/Nuitka 打包二进制环境。
14
+
15
+ 源码模式:以传入的参考路径为基准,向上回溯 parent_index 层目录得到项目根;
16
+ 打包 frozen 模式:自动返回可执行文件(.exe/二进制)所在目录,忽略 reference_path、parent_index。
17
+
18
+ Args:
19
+ reference_path: 锚点参考路径,业务调用一般直接传入 __file__
20
+ parent_index: 源码环境向上回溯层级下标
21
+
22
+ Returns:
23
+ 项目根目录绝对路径
24
+
25
+ Notes:
26
+ parent_index >= 0;根据当前文件物理位置调整下标
27
+ """
28
+ if parent_index < 0:
29
+ raise ValueError("parent_index 不能是负数")
30
+
31
+ if getattr(sys, "frozen", False):
32
+ path = Path(sys.executable).parent
33
+ else:
34
+ path = Path(reference_path).parents[parent_index]
35
+
36
+ return path.resolve()
@@ -0,0 +1 @@
1
+ Generic single-database configuration.
@@ -0,0 +1,28 @@
1
+ """${message}
2
+
3
+ Revision ID: ${up_revision}
4
+ Revises: ${down_revision | comma,n}
5
+ Create Date: ${create_date}
6
+
7
+ """
8
+ from typing import Sequence, Union
9
+
10
+ from alembic import op
11
+ import sqlalchemy as sa
12
+ ${imports if imports else ""}
13
+
14
+ # revision identifiers, used by Alembic.
15
+ revision: str = ${repr(up_revision)}
16
+ down_revision: Union[str, Sequence[str], None] = ${repr(down_revision)}
17
+ branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
18
+ depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
19
+
20
+
21
+ def upgrade() -> None:
22
+ """Upgrade schema."""
23
+ ${upgrades if upgrades else "pass"}
24
+
25
+
26
+ def downgrade() -> None:
27
+ """Downgrade schema."""
28
+ ${downgrades if downgrades else "pass"}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastapi-augment
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: FastAPI 通用代码工具包,跨项目复用
5
5
  Author-email: zarkhan <hanguangzheng@qq.com>
6
6
  License-Expression: MIT
@@ -17,6 +17,7 @@ src/fastapi_augment/common/constants.py
17
17
  src/fastapi_augment/common/exception_handlers.py
18
18
  src/fastapi_augment/common/exceptions.py
19
19
  src/fastapi_augment/common/utils/__init__.py
20
+ src/fastapi_augment/common/utils/paths.py
20
21
  src/fastapi_augment/common/utils/strings.py
21
22
  src/fastapi_augment/config/__init__.py
22
23
  src/fastapi_augment/config/settings.py
@@ -28,8 +29,10 @@ src/fastapi_augment/db/sqlalchemy/migrate.py
28
29
  src/fastapi_augment/db/sqlalchemy/model_base.py
29
30
  src/fastapi_augment/db/sqlalchemy/repository_base.py
30
31
  src/fastapi_augment/db/sqlalchemy/session.py
32
+ src/fastapi_augment/db/sqlalchemy/alembic/README
31
33
  src/fastapi_augment/db/sqlalchemy/alembic/__init__.py
32
34
  src/fastapi_augment/db/sqlalchemy/alembic/env.py
35
+ src/fastapi_augment/db/sqlalchemy/alembic/script.py.mako
33
36
  src/fastapi_augment/db/sqlalchemy/mixins/__init__.py
34
37
  src/fastapi_augment/db/sqlalchemy/mixins/audit.py
35
38
  src/fastapi_augment/db/sqlalchemy/mixins/soft_delete.py
@@ -1 +0,0 @@
1
- 0.1.1
@@ -1,5 +0,0 @@
1
- """
2
- @Author : hangu
3
- @CreateDate : 2026/9/4
4
- @Description :
5
- """