qdata-adapter-kd-cosmic 0.1.0__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 (38) hide show
  1. qdata_adapter_kd_cosmic-0.1.0/.env.example +47 -0
  2. qdata_adapter_kd_cosmic-0.1.0/.github/workflows/ci.yml +103 -0
  3. qdata_adapter_kd_cosmic-0.1.0/.github/workflows/publish.yml +61 -0
  4. qdata_adapter_kd_cosmic-0.1.0/.gitignore +159 -0
  5. qdata_adapter_kd_cosmic-0.1.0/.pre-commit-config.yaml +38 -0
  6. qdata_adapter_kd_cosmic-0.1.0/CHANGELOG.md +24 -0
  7. qdata_adapter_kd_cosmic-0.1.0/CONTRIBUTING.md +104 -0
  8. qdata_adapter_kd_cosmic-0.1.0/DEVELOPMENT.md +396 -0
  9. qdata_adapter_kd_cosmic-0.1.0/LICENSE +22 -0
  10. qdata_adapter_kd_cosmic-0.1.0/Makefile +167 -0
  11. qdata_adapter_kd_cosmic-0.1.0/PKG-INFO +277 -0
  12. qdata_adapter_kd_cosmic-0.1.0/QUICKSTART.md +266 -0
  13. qdata_adapter_kd_cosmic-0.1.0/README.md +226 -0
  14. qdata_adapter_kd_cosmic-0.1.0/api-docs/README.md +72 -0
  15. qdata_adapter_kd_cosmic-0.1.0/docs/prompt.md +282 -0
  16. qdata_adapter_kd_cosmic-0.1.0/examples/README.md +80 -0
  17. qdata_adapter_kd_cosmic-0.1.0/examples/quickstart.py +107 -0
  18. qdata_adapter_kd_cosmic-0.1.0/pyproject.toml +208 -0
  19. qdata_adapter_kd_cosmic-0.1.0/reference/.gitignore +4 -0
  20. qdata_adapter_kd_cosmic-0.1.0/requirements-dev.txt +24 -0
  21. qdata_adapter_kd_cosmic-0.1.0/requirements.txt +8 -0
  22. qdata_adapter_kd_cosmic-0.1.0/setup.cfg +4 -0
  23. qdata_adapter_kd_cosmic-0.1.0/src/qdata_adapter_kd_cosmic/__init__.py +21 -0
  24. qdata_adapter_kd_cosmic-0.1.0/src/qdata_adapter_kd_cosmic/adapter.py +301 -0
  25. qdata_adapter_kd_cosmic-0.1.0/src/qdata_adapter_kd_cosmic/exceptions.py +67 -0
  26. qdata_adapter_kd_cosmic-0.1.0/src/qdata_adapter_kd_cosmic/interfaces/base.py +236 -0
  27. qdata_adapter_kd_cosmic-0.1.0/src/qdata_adapter_kd_cosmic/interfaces/enterprise.py +67 -0
  28. qdata_adapter_kd_cosmic-0.1.0/src/qdata_adapter_kd_cosmic/interfaces/standard.py +705 -0
  29. qdata_adapter_kd_cosmic-0.1.0/src/qdata_adapter_kd_cosmic/py.typed +0 -0
  30. qdata_adapter_kd_cosmic-0.1.0/src/qdata_adapter_kd_cosmic.egg-info/PKG-INFO +277 -0
  31. qdata_adapter_kd_cosmic-0.1.0/src/qdata_adapter_kd_cosmic.egg-info/SOURCES.txt +36 -0
  32. qdata_adapter_kd_cosmic-0.1.0/src/qdata_adapter_kd_cosmic.egg-info/dependency_links.txt +1 -0
  33. qdata_adapter_kd_cosmic-0.1.0/src/qdata_adapter_kd_cosmic.egg-info/entry_points.txt +2 -0
  34. qdata_adapter_kd_cosmic-0.1.0/src/qdata_adapter_kd_cosmic.egg-info/requires.txt +26 -0
  35. qdata_adapter_kd_cosmic-0.1.0/src/qdata_adapter_kd_cosmic.egg-info/top_level.txt +1 -0
  36. qdata_adapter_kd_cosmic-0.1.0/tests/conftest.py +169 -0
  37. qdata_adapter_kd_cosmic-0.1.0/tests/data/README.md +31 -0
  38. qdata_adapter_kd_cosmic-0.1.0/tests/test_adapter.py +668 -0
@@ -0,0 +1,47 @@
1
+ # kd-cosmic 适配器测试环境变量
2
+ # 复制此文件为 .env 并填入真实值以进行集成测试
3
+ # 注意:.env 文件不应提交到 Git!
4
+
5
+ # =============================================================================
6
+ # 基础配置
7
+ # =============================================================================
8
+
9
+ # API 基础地址
10
+ KD_COSMIC_BASE_URL=https://api.example.com
11
+
12
+ # 环境标识 (production/sandbox/development)
13
+ KD_COSMIC_ENVIRONMENT=sandbox
14
+
15
+ # =============================================================================
16
+ # 认证配置 - standard 接口
17
+ # =============================================================================
18
+
19
+ # OAuth2 / API Key 认证
20
+ KD_COSMIC_CLIENT_ID=your-client-id
21
+ KD_COSMIC_CLIENT_SECRET=your-client-secret
22
+ KD_COSMIC_TOKEN_URL=https://api.example.com/oauth/token
23
+
24
+ # =============================================================================
25
+ # 认证配置 - enterprise 接口(如启用双接口)
26
+ # =============================================================================
27
+
28
+ # HMAC / 签名认证
29
+ KD_COSMIC_APP_KEY=your-app-key
30
+ KD_COSMIC_APP_SECRET=your-app-secret
31
+ KD_COSMIC_CUSTOMER_ID=your-customer-id
32
+
33
+ # =============================================================================
34
+ # 测试配置
35
+ # =============================================================================
36
+
37
+ # 是否录制请求/响应 (true/false)
38
+ RECORD_HTTP_TRAFFIC=true
39
+
40
+ # 测试数据目录
41
+ TEST_DATA_DIR=tests/data
42
+
43
+ # 请求超时时间(秒)
44
+ REQUEST_TIMEOUT=30
45
+
46
+ # 是否使用真实 API 进行测试 (true=真实API, false=Mock)
47
+ USE_REAL_API=false
@@ -0,0 +1,103 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main, develop]
8
+
9
+ jobs:
10
+ test:
11
+ name: "Test Python ${{ matrix.python-version }} on ${{ matrix.os }}"
12
+ runs-on: "${{ matrix.os }}"
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ os: [ubuntu-latest, macos-latest, windows-latest]
17
+ python-version: ["3.11", "3.12", "3.13"]
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+
22
+ - name: "Set up Python ${{ matrix.python-version }}"
23
+ uses: actions/setup-python@v5
24
+ with:
25
+ python-version: "${{ matrix.python-version }}"
26
+ cache: 'pip'
27
+
28
+ - name: Install dependencies
29
+ run: |
30
+ python -m pip install --upgrade pip
31
+ pip install -e ".[dev]"
32
+
33
+ - name: Run tests with coverage
34
+ run: |
35
+ pytest --cov=qdata_adapter_kd_cosmic --cov-report=xml --cov-report=term
36
+
37
+ - name: Upload coverage to Codecov
38
+ uses: codecov/codecov-action@v3
39
+ if: "matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'"
40
+ with:
41
+ file: ./coverage.xml
42
+ fail_ci_if_error: false
43
+
44
+ lint:
45
+ name: Lint and Type Check
46
+ runs-on: ubuntu-latest
47
+ steps:
48
+ - uses: actions/checkout@v4
49
+
50
+ - name: Set up Python
51
+ uses: actions/setup-python@v5
52
+ with:
53
+ python-version: "3.11"
54
+ cache: 'pip'
55
+
56
+ - name: Install dependencies
57
+ run: |
58
+ python -m pip install --upgrade pip
59
+ pip install -e ".[dev]"
60
+
61
+ - name: Run ruff
62
+ run: ruff check src tests
63
+
64
+ - name: Run black
65
+ run: black --check src tests
66
+
67
+ - name: Run isort
68
+ run: isort --check-only src tests
69
+
70
+ - name: Run mypy
71
+ run: mypy src
72
+
73
+ - name: Run bandit security check
74
+ run: bandit -r src -ll
75
+
76
+ build:
77
+ name: Build Distribution
78
+ runs-on: ubuntu-latest
79
+ needs: [test, lint]
80
+ steps:
81
+ - uses: actions/checkout@v4
82
+
83
+ - name: Set up Python
84
+ uses: actions/setup-python@v5
85
+ with:
86
+ python-version: "3.11"
87
+
88
+ - name: Install build dependencies
89
+ run: |
90
+ python -m pip install --upgrade pip
91
+ pip install build twine
92
+
93
+ - name: Build package
94
+ run: python -m build
95
+
96
+ - name: Check package
97
+ run: twine check dist/*
98
+
99
+ - name: Upload artifacts
100
+ uses: actions/upload-artifact@v4
101
+ with:
102
+ name: dist
103
+ path: dist/
@@ -0,0 +1,61 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ build:
12
+ name: Build distribution
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.11"
22
+
23
+ - name: Install build dependencies
24
+ run: |
25
+ python -m pip install --upgrade pip
26
+ pip install build twine
27
+
28
+ - name: Build package
29
+ run: python -m build
30
+
31
+ - name: Check package
32
+ run: twine check dist/*
33
+
34
+ - name: Upload artifacts
35
+ uses: actions/upload-artifact@v4
36
+ with:
37
+ name: dist
38
+ path: dist/
39
+
40
+ publish:
41
+ name: Publish to PyPI
42
+ needs: build
43
+ runs-on: ubuntu-latest
44
+ environment:
45
+ name: pypi
46
+ url: https://pypi.org/p/qdata-adapter-kd-cosmic
47
+ permissions:
48
+ id-token: write # IMPORTANT: mandatory for trusted publishing
49
+
50
+ steps:
51
+ - name: Download artifacts
52
+ uses: actions/download-artifact@v4
53
+ with:
54
+ name: dist
55
+ path: dist/
56
+
57
+ - name: Publish to PyPI
58
+ uses: pypa/gh-action-pypi-publish@release/v1
59
+ with:
60
+ skip-existing: true
61
+ verbose: true
@@ -0,0 +1,159 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ *.manifest
32
+ *.spec
33
+
34
+ # Installer logs
35
+ pip-log.txt
36
+ pip-delete-this-directory.txt
37
+
38
+ # Unit test / coverage reports
39
+ htmlcov/
40
+ .tox/
41
+ .nox/
42
+ .coverage
43
+ .coverage.*
44
+ .cache
45
+ nosetests.xml
46
+ coverage.xml
47
+ *.cover
48
+ *.py,cover
49
+ .hypothesis/
50
+ .pytest_cache/
51
+
52
+ # Translations
53
+ *.mo
54
+ *.pot
55
+
56
+ # Django stuff:
57
+ *.log
58
+ local_settings.py
59
+ db.sqlite3
60
+ db.sqlite3-journal
61
+
62
+ # Flask stuff:
63
+ instance/
64
+ .webassets-cache
65
+
66
+ # Scrapy stuff:
67
+ .scrapy
68
+
69
+ # Sphinx documentation
70
+ docs/_build/
71
+
72
+ # PyBuilder
73
+ target/
74
+
75
+ # Jupyter Notebook
76
+ .ipynb_checkpoints
77
+
78
+ # IPython
79
+ profile_default/
80
+ ipython_config.py
81
+
82
+ # pyenv
83
+ .python-version
84
+
85
+ # pipenv
86
+ Pipfile.lock
87
+
88
+ # PEP 582
89
+ __pypackages__/
90
+
91
+ # Celery stuff
92
+ celerybeat-schedule
93
+ celerybeat.pid
94
+
95
+ # SageMath parsed files
96
+ *.sage.py
97
+
98
+ # Environments
99
+ .env
100
+ .venv
101
+ env/
102
+ venv/
103
+ ENV/
104
+ env.bak/
105
+ venv.bak/
106
+
107
+ # Spyder project settings
108
+ .spyderproject
109
+ .spyproject
110
+
111
+ # Rope project settings
112
+ .ropeproject
113
+
114
+ # mkdocs documentation
115
+ /site
116
+
117
+ # mypy
118
+ .mypy_cache/
119
+ .dmypy.json
120
+ dmypy.json
121
+
122
+ # Pyre type checker
123
+ .pyre/
124
+
125
+ # IDE
126
+ .vscode/
127
+ .idea/
128
+ *.swp
129
+ *.swo
130
+ *~
131
+
132
+ # OS
133
+ .DS_Store
134
+ Thumbs.db
135
+
136
+ # Project specific
137
+ *.local
138
+ *.local.json
139
+ *.local.yaml
140
+ *.local.yml
141
+ secrets/
142
+ *.key
143
+ *.pem
144
+
145
+ # Test data and recordings (may contain sensitive info)
146
+ tests/data/recordings/
147
+ tests/data/*.log
148
+ tests/data/temp/
149
+
150
+ # Environment files with real credentials
151
+ .env
152
+ .env.local
153
+ .env.*.local
154
+ !.env.example
155
+
156
+ # API docs scraped content (may be large)
157
+ api-docs/scraped/*.html
158
+ api-docs/scraped/*.pdf
159
+ api-docs/scraped/**/*_files/
@@ -0,0 +1,38 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.5.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-added-large-files
9
+ args: ['--maxkb=1000']
10
+ - id: check-json
11
+ - id: check-toml
12
+ - id: check-merge-conflict
13
+ - id: debug-statements
14
+
15
+ - repo: https://github.com/psf/black
16
+ rev: 23.12.1
17
+ hooks:
18
+ - id: black
19
+ language_version: python3.11
20
+
21
+ - repo: https://github.com/pycqa/isort
22
+ rev: 5.13.2
23
+ hooks:
24
+ - id: isort
25
+ args: ["--profile", "black"]
26
+
27
+ - repo: https://github.com/astral-sh/ruff-pre-commit
28
+ rev: v0.1.9
29
+ hooks:
30
+ - id: ruff
31
+ args: [--fix, --exit-non-zero-on-fix]
32
+
33
+ - repo: https://github.com/pre-commit/mirrors-mypy
34
+ rev: v1.8.0
35
+ hooks:
36
+ - id: mypy
37
+ additional_dependencies: [types-all]
38
+ args: [--ignore-missing-imports]
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - Initial release of qdata-adapter-kd-cosmic
13
+ - Basic adapter structure with KdCosmicAdapter
14
+ - Authentication implementation
15
+ - Core data operations (list, get, create)
16
+ - Complete test suite with pytest
17
+
18
+ ## [0.1.0] - 2026-06-04
19
+
20
+ ### Initial Release
21
+
22
+ - Project scaffold generated
23
+ - Base adapter implementation
24
+ - CI/CD configuration
@@ -0,0 +1,104 @@
1
+ # 贡献指南
2
+
3
+ 感谢您对 qdata-adapter-kd-cosmic 项目的关注!我们欢迎各种形式的贡献。
4
+
5
+ ## 如何贡献
6
+
7
+ ### 报告问题
8
+
9
+ 如果您发现了 bug 或有功能建议,请在 [GitHub Issues](https://github.com/qeasy/qdata-adapter-kd-cosmic/issues) 中提交。
10
+
11
+ 提交问题时,请包含:
12
+
13
+ - 问题的详细描述
14
+ - 复现步骤
15
+ - 期望行为与实际行为
16
+ - 您的环境信息(Python 版本、操作系统等)
17
+
18
+ ### 提交代码
19
+
20
+ 1. **Fork 仓库**
21
+
22
+ ```bash
23
+ git clone https://github.com/qeasy/qdata-adapter-kd-cosmic.git
24
+ cd qdata-adapter-kd-cosmic
25
+ ```
26
+
27
+ 2. **创建分支**
28
+
29
+ ```bash
30
+ git checkout -b feature/your-feature-name
31
+ ```
32
+
33
+ 3. **设置开发环境**
34
+
35
+ ```bash
36
+ python -m venv venv
37
+ source venv/bin/activate # Windows: venv\Scripts\activate
38
+ pip install -e ".[dev]"
39
+ pre-commit install
40
+ ```
41
+
42
+ 4. **编写代码**
43
+
44
+ - 遵循项目代码风格
45
+ - 添加必要的测试
46
+ - 更新相关文档
47
+
48
+ 5. **运行测试**
49
+
50
+ ```bash
51
+ pytest
52
+ ```
53
+
54
+ 6. **代码检查**
55
+
56
+ ```bash
57
+ make check
58
+ ```
59
+
60
+ 7. **提交更改**
61
+
62
+ ```bash
63
+ git add .
64
+ git commit -m "feat: 添加新功能描述"
65
+ ```
66
+
67
+ 8. **推送并创建 Pull Request**
68
+
69
+ ```bash
70
+ git push origin feature/your-feature-name
71
+ ```
72
+
73
+ ## 代码规范
74
+
75
+ - 使用 [Black](https://github.com/psf/black) 进行代码格式化
76
+ - 使用 [isort](https://github.com/PyCQA/isort) 进行导入排序
77
+ - 遵循 [PEP 8](https://pep8.org/) 代码风格
78
+ - 添加类型提示
79
+ - 编写清晰的文档字符串
80
+
81
+ ## Commit 规范
82
+
83
+ 使用 [Conventional Commits](https://www.conventionalcommits.org/) 规范:
84
+
85
+ - `feat:` 新功能
86
+ - `fix:` 修复 bug
87
+ - `docs:` 文档更新
88
+ - `style:` 代码风格调整(不影响功能)
89
+ - `refactor:` 代码重构
90
+ - `test:` 测试相关
91
+ - `chore:` 构建/工具相关
92
+
93
+ ## 许可证
94
+
95
+ 您的贡献将遵循项目的 MIT 许可证。
96
+
97
+ ## 联系我们
98
+
99
+ 如有任何问题,欢迎通过以下方式联系:
100
+
101
+ - GitHub Issues: https://github.com/qeasy/qdata-adapter-kd-cosmic/issues
102
+ - 邮箱: opensource@qeasy.cloud
103
+
104
+ 感谢您的贡献! 🎉