bk-resource 0.4.1__tar.gz → 0.4.2b0__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.
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/PKG-INFO +3 -6
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/viewsets.py +10 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource.egg-info/PKG-INFO +3 -6
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource.egg-info/SOURCES.txt +1 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource.egg-info/requires.txt +1 -1
- bk_resource-0.4.2b0/readme.md +78 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/setup.py +2 -2
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/LICENSE.txt +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/MANIFEST.in +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/__init__.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/apps.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/base.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/conf/__init__.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/conf/app_template/__init__.py-tpl +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/conf/app_template/admin.py-tpl +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/conf/app_template/apps.py-tpl +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/conf/app_template/migrations/__init__.py-tpl +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/conf/app_template/models.py-tpl +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/conf/app_template/resources.py-tpl +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/conf/app_template/serializers.py-tpl +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/conf/app_template/urls.py-tpl +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/conf/app_template/views.py-tpl +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/contrib/__init__.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/contrib/api.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/contrib/bk_api.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/contrib/cache.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/contrib/model.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/exceptions.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/locale/en/LC_MESSAGES/django.mo +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/locale/en/LC_MESSAGES/django.po +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/locale/zh_CN/LC_MESSAGES/django.mo +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/locale/zh_CN/LC_MESSAGES/django.po +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/management/__init__.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/management/commands/__init__.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/management/commands/generate_resource_stub_file.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/management/commands/start_resource.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/management/exceptions.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/management/finder.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/management/root.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/management/stub_file_generator.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/routers.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/serializers.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/settings.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/tasks.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/tools.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/utils/__init__.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/utils/cache.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/utils/common_utils.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/utils/factory.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/utils/generators.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/utils/inspectors.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/utils/local.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/utils/logger.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/utils/request.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/utils/request_log.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/utils/text.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/utils/thread_backend.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/utils/time_tools.py +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource.egg-info/dependency_links.txt +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource.egg-info/top_level.txt +0 -0
- {bk_resource-0.4.1 → bk_resource-0.4.2b0}/setup.cfg +0 -0
@@ -1,13 +1,10 @@
|
|
1
|
-
Metadata-Version:
|
1
|
+
Metadata-Version: 1.0
|
2
2
|
Name: bk_resource
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.2b0
|
4
4
|
Summary: Bk Resource
|
5
5
|
Home-page: https://bk.tencent.com
|
6
6
|
Author: blueking
|
7
7
|
Author-email: blueking@tencent.com
|
8
8
|
License: UNKNOWN
|
9
|
+
Description: UNKNOWN
|
9
10
|
Platform: UNKNOWN
|
10
|
-
License-File: LICENSE.txt
|
11
|
-
|
12
|
-
UNKNOWN
|
13
|
-
|
@@ -94,6 +94,7 @@ class ResourceViewSet(viewsets.GenericViewSet):
|
|
94
94
|
# 用于执行请求的Resource类
|
95
95
|
resource_routes: List[ResourceRoute] = []
|
96
96
|
filter_backends = []
|
97
|
+
resource_mapping = {}
|
97
98
|
|
98
99
|
# swagger
|
99
100
|
if bk_resource_settings.DEFAULT_SWAGGER_SCHEMA_CLASS is not None:
|
@@ -126,6 +127,8 @@ class ResourceViewSet(viewsets.GenericViewSet):
|
|
126
127
|
|
127
128
|
@classmethod
|
128
129
|
def generate_endpoint(cls):
|
130
|
+
view_set_path = f"{cls.__module__}.{cls.__name__}"
|
131
|
+
|
129
132
|
for resource_route in cls.resource_routes:
|
130
133
|
# 生成方法模版
|
131
134
|
function = cls._generate_function_template(resource_route)
|
@@ -202,6 +205,10 @@ class ResourceViewSet(viewsets.GenericViewSet):
|
|
202
205
|
setattr(cls, cls.EMPTY_ENDPOINT_METHODS[resource_route.method], function)
|
203
206
|
else:
|
204
207
|
raise AssertionError(gettext("不支持的请求方法: %s,请确认resource_routes配置是否正确!") % resource_route.method)
|
208
|
+
|
209
|
+
cls.resource_mapping[
|
210
|
+
(resource_route.method, f"{view_set_path}.{cls.EMPTY_ENDPOINT_METHODS[resource_route.method]}")
|
211
|
+
] = resource_route.resource_class
|
205
212
|
else:
|
206
213
|
function = method_decorator(cache_control(max_age=0, private=True))(function)
|
207
214
|
function.__name__ = resource_route.endpoint
|
@@ -216,6 +223,9 @@ class ResourceViewSet(viewsets.GenericViewSet):
|
|
216
223
|
|
217
224
|
function = decorator_function(function)
|
218
225
|
setattr(cls, resource_route.endpoint, function)
|
226
|
+
cls.resource_mapping[
|
227
|
+
(resource_route.method, f"{view_set_path}.{resource_route.endpoint}")
|
228
|
+
] = resource_route.resource_class
|
219
229
|
|
220
230
|
@classmethod
|
221
231
|
def _generate_function_template(cls, resource_route: ResourceRoute):
|
@@ -1,13 +1,10 @@
|
|
1
|
-
Metadata-Version:
|
1
|
+
Metadata-Version: 1.0
|
2
2
|
Name: bk-resource
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.2b0
|
4
4
|
Summary: Bk Resource
|
5
5
|
Home-page: https://bk.tencent.com
|
6
6
|
Author: blueking
|
7
7
|
Author-email: blueking@tencent.com
|
8
8
|
License: UNKNOWN
|
9
|
+
Description: UNKNOWN
|
9
10
|
Platform: UNKNOWN
|
10
|
-
License-File: LICENSE.txt
|
11
|
-
|
12
|
-
UNKNOWN
|
13
|
-
|
@@ -0,0 +1,78 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
[](https://github.com/TencentBlueKing/bk-resource/blob/main/LICENSE.txt)
|
4
|
+
[](https://github.com/TencentBlueKing/bk-resource/releases)
|
5
|
+
[](https://github.com/TencentBlueKing/bk-resource/pulls)
|
6
|
+
[](https://codecov.io/gh/TencentBlueKing/bk-resource)
|
7
|
+
[](https://github.com/TencentBlueKing/bk-resource/actions/workflows/unittest.yml)
|
8
|
+
|
9
|
+
[(English Documents Available)](readme_en.md)
|
10
|
+
|
11
|
+
## Overview
|
12
|
+
|
13
|
+
`bk_resource` 是一个基于 [Blueapps](https://github.com/TencentBlueKing/blueapps) 和 [Django Rest Framework](https://github.com/encode/django-rest-framework) 的脚手架,
|
14
|
+
旨在帮助开发人员快速生成符合 [`12-factor`](https://12factor.net/) 规范的 WEB SaaS,并在`DDD`开发实践中方便地创建可扩展的领域服务
|
15
|
+
|
16
|
+
## Features
|
17
|
+
|
18
|
+
- [Basic] 基于 `Django` 进行封装,生成标准 `swagger API`
|
19
|
+
- [Basic] 基于 `django-environ` 适配环境变量与 `.env` 配置
|
20
|
+
- [Basic] 支持基于 `PEP-621` 的全工具链 (mypy\isort\flake8\black) 配置方案
|
21
|
+
- [Basic] 支持代码规范类工具整合:`pre-commit`、`code-cc`
|
22
|
+
- [Resource] 集成 `bk_resource` 组织工程目录结构,通过 `Resource` 的方式声明业务逻辑
|
23
|
+
- [Resource] 支持 `ApiResource` / `BkApiResource` 调用第三方 `API` 接口
|
24
|
+
|
25
|
+
## Getting started
|
26
|
+
|
27
|
+
### Installation
|
28
|
+
|
29
|
+
```bash
|
30
|
+
$ pip install cookiecutter
|
31
|
+
$ cookiecutter https://github.com/TencentBlueKing/bk-resource.git --checkout main --directory template
|
32
|
+
```
|
33
|
+
|
34
|
+
### Usage
|
35
|
+
|
36
|
+
- [快速开始](template/readme.md)
|
37
|
+
- [使用文档](docs/usage.md)
|
38
|
+
|
39
|
+
### Domain Driven Design 开发实践
|
40
|
+
|
41
|
+

|
42
|
+
|
43
|
+
- Api 交互层
|
44
|
+
通过 UI Api 或者 Open Api 将服务暴露给用户,由对应的 Api 负责对应的业务逻辑串联。
|
45
|
+
- Scene 场景层
|
46
|
+
在通过 Api 访问后端时,实际访问的是由 Resource 暴露的一个场景服务,通过场景服务串联领域层的业务逻辑。
|
47
|
+
- Domain 领域层
|
48
|
+
领域层聚焦对应的细分模块,负责处理模块的具体业务逻辑,例如,在用户模块中,处理用户注册、登录、修改密码、重置密码等逻辑。
|
49
|
+
- Model 模型层
|
50
|
+
在 MVC 框架中 (如 Django),将代码架构划分为 Model (模型),View (视图),Controller (控制器) 三层,View 用于界面展示,在前后端分离开发部署的实践中,已经不再由后端处理,后端只需要处理 Model & Controller。
|
51
|
+
|
52
|
+
## Roadmap
|
53
|
+
|
54
|
+
- [版本日志](release.md)
|
55
|
+
|
56
|
+
## Support
|
57
|
+
|
58
|
+
- [蓝鲸论坛](https://bk.tencent.com/s-mart/community)
|
59
|
+
- [蓝鲸 DevOps 在线视频教程](https://bk.tencent.com/s-mart/video/)
|
60
|
+
- [蓝鲸社区版交流群](https://jq.qq.com/?_wv=1027&k=5zk8F7G)
|
61
|
+
|
62
|
+
## BlueKing Community
|
63
|
+
|
64
|
+
- [BK-CMDB](https://github.com/Tencent/bk-cmdb):蓝鲸配置平台(蓝鲸 CMDB)是一个面向资产及应用的企业级配置管理平台。
|
65
|
+
- [BK-CI](https://github.com/Tencent/bk-ci):蓝鲸持续集成平台是一个开源的持续集成和持续交付系统,可以轻松将你的研发流程呈现到你面前。
|
66
|
+
- [BK-BCS](https://github.com/Tencent/bk-bcs):蓝鲸容器管理平台是以容器技术为基础,为微服务业务提供编排管理的基础服务平台。
|
67
|
+
- [BK-PaaS](https://github.com/Tencent/bk-paas):蓝鲸 PaaS 平台是一个开放式的开发平台,让开发者可以方便快捷地创建、开发、部署和管理 SaaS 应用。
|
68
|
+
- [BK-SOPS](https://github.com/Tencent/bk-sops):标准运维(SOPS)是通过可视化的图形界面进行任务流程编排和执行的系统,是蓝鲸体系中一款轻量级的调度编排类 SaaS 产品。
|
69
|
+
- [BK-JOB](https://github.com/Tencent/bk-job) 蓝鲸作业平台(Job)是一套运维脚本管理系统,具备海量任务并发处理能力。
|
70
|
+
|
71
|
+
## Contributing
|
72
|
+
|
73
|
+
如果你有好的意见或建议,欢迎给我们提 Issues 或 Pull Requests,为蓝鲸开源社区贡献力量。
|
74
|
+
[腾讯开源激励计划](https://opensource.tencent.com/contribution) 鼓励开发者的参与和贡献,期待你的加入。
|
75
|
+
|
76
|
+
## License
|
77
|
+
|
78
|
+
基于 MIT 协议, 详细请参考 [LICENSE](LICENSE.txt)
|
@@ -20,7 +20,7 @@ from setuptools import setup
|
|
20
20
|
|
21
21
|
setup(
|
22
22
|
name="bk_resource",
|
23
|
-
version="0.4.
|
23
|
+
version="0.4.2b0",
|
24
24
|
author="blueking",
|
25
25
|
url="https://bk.tencent.com",
|
26
26
|
author_email="blueking@tencent.com",
|
@@ -34,7 +34,7 @@ setup(
|
|
34
34
|
"bk_resource.utils",
|
35
35
|
],
|
36
36
|
install_requires=[
|
37
|
-
"blueapps==4.7.
|
37
|
+
"blueapps==4.7.1rc0",
|
38
38
|
"django>=3.2.18",
|
39
39
|
"djangorestframework>=3.12.0",
|
40
40
|
"drf-yasg>=1.20.0",
|
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
|
{bk_resource-0.4.1 → bk_resource-0.4.2b0}/bk_resource/conf/app_template/migrations/__init__.py-tpl
RENAMED
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
|