reportify-cli 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 (41) hide show
  1. reportify_cli-0.1.0/.dockerignore +4 -0
  2. reportify_cli-0.1.0/.git +1 -0
  3. reportify_cli-0.1.0/.gitignore +133 -0
  4. reportify_cli-0.1.0/.gitlab-ci.yml +104 -0
  5. reportify_cli-0.1.0/Dockerfile +10 -0
  6. reportify_cli-0.1.0/Dockerfile.base +10 -0
  7. reportify_cli-0.1.0/Dockerfile.dev +10 -0
  8. reportify_cli-0.1.0/Makefile +118 -0
  9. reportify_cli-0.1.0/PKG-INFO +191 -0
  10. reportify_cli-0.1.0/README.md +161 -0
  11. reportify_cli-0.1.0/pip.conf +10 -0
  12. reportify_cli-0.1.0/pyproject.toml +101 -0
  13. reportify_cli-0.1.0/scripts/README.md +143 -0
  14. reportify_cli-0.1.0/scripts/bump_version.sh +119 -0
  15. reportify_cli-0.1.0/scripts/publish.sh +183 -0
  16. reportify_cli-0.1.0/skills/reportify-cli/SKILL.md +143 -0
  17. reportify_cli-0.1.0/skills/reportify-cli/references/API_REFERENCE.md +111 -0
  18. reportify_cli-0.1.0/skills/reportify-cli/references/COMMANDS.md +86 -0
  19. reportify_cli-0.1.0/src/__init__.py +3 -0
  20. reportify_cli-0.1.0/src/client.py +20 -0
  21. reportify_cli-0.1.0/src/commands/__init__.py +1 -0
  22. reportify_cli-0.1.0/src/commands/channels.py +137 -0
  23. reportify_cli-0.1.0/src/commands/concepts.py +54 -0
  24. reportify_cli-0.1.0/src/commands/docs.py +370 -0
  25. reportify_cli-0.1.0/src/commands/kb.py +36 -0
  26. reportify_cli-0.1.0/src/commands/quant.py +195 -0
  27. reportify_cli-0.1.0/src/commands/search.py +223 -0
  28. reportify_cli-0.1.0/src/commands/stock.py +314 -0
  29. reportify_cli-0.1.0/src/commands/timeline.py +118 -0
  30. reportify_cli-0.1.0/src/commands/user.py +33 -0
  31. reportify_cli-0.1.0/src/main.py +43 -0
  32. reportify_cli-0.1.0/src/output.py +84 -0
  33. reportify_cli-0.1.0/src/params.py +430 -0
  34. reportify_cli-0.1.0/src/settings.py +30 -0
  35. reportify_cli-0.1.0/src/utils.py +66 -0
  36. reportify_cli-0.1.0/tests/__init__.py +0 -0
  37. reportify_cli-0.1.0/tests/integration/test_docs_integration.py +122 -0
  38. reportify_cli-0.1.0/tests/integration/test_stock_integration.py +187 -0
  39. reportify_cli-0.1.0/tests/test_commands/__init__.py +0 -0
  40. reportify_cli-0.1.0/tests/test_commands/test_docs.py +129 -0
  41. reportify_cli-0.1.0/uv.lock +422 -0
@@ -0,0 +1,4 @@
1
+ .git
2
+ data
3
+ logs
4
+ *.log
@@ -0,0 +1 @@
1
+ gitdir: ../../.git/modules/modules/cli
@@ -0,0 +1,133 @@
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
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Sphinx documentation
55
+ docs/_build/
56
+
57
+ # PyBuilder
58
+ target/
59
+
60
+ # Jupyter Notebook
61
+ .ipynb_checkpoints
62
+
63
+ # IPython
64
+ profile_default/
65
+ ipython_config.py
66
+
67
+ # pyenv
68
+ .python-version
69
+
70
+ # pipenv
71
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
72
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
73
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
74
+ # install all needed dependencies.
75
+ #Pipfile.lock
76
+
77
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
78
+ __pypackages__/
79
+
80
+ # Celery stuff
81
+ celerybeat-schedule
82
+ celerybeat.pid
83
+
84
+ # SageMath parsed files
85
+ *.sage.py
86
+
87
+ # Environments
88
+ .env
89
+ .venv
90
+ env/
91
+ venv/
92
+ ENV/
93
+ env.bak/
94
+ venv.bak/
95
+ .conda/
96
+ example.env
97
+ *.env
98
+ dev.env
99
+ qa.env
100
+
101
+ # Spyder project settings
102
+ .spyderproject
103
+ .spyproject
104
+
105
+ # Rope project settings
106
+ .ropeproject
107
+
108
+ # mkdocs documentation
109
+ /site
110
+
111
+ # mypy
112
+ .mypy_cache/
113
+ .dmypy.json
114
+ dmypy.json
115
+
116
+ # Pyre type checker
117
+ .pyre/
118
+ .idea
119
+ .DS_Store
120
+ logs/
121
+ tmp_code_*.py
122
+ *.tmp
123
+ .vscode
124
+
125
+ .ruff_cache
126
+
127
+ tmp/
128
+ temp/
129
+ reportify-doc/
130
+
131
+ # PyPI configuration (contains API tokens)
132
+ .pypirc
133
+
@@ -0,0 +1,104 @@
1
+ image: harbor.xiaobangtouzi.com/base/docker:kube-istio-jdk11
2
+
3
+ stages:
4
+ - pre_build
5
+ - build
6
+ - push_image
7
+
8
+ variables:
9
+ DOCKER_DRIVER: overlay2
10
+
11
+ cache:
12
+ paths:
13
+ - .m2/repository
14
+ - .sonar/cache
15
+
16
+ build base images:
17
+ stage: pre_build
18
+ tags:
19
+ - arm
20
+ only:
21
+ refs:
22
+ - production@backend/reportify-api-cli
23
+ changes:
24
+ - pyproject.toml
25
+ - uv.lock
26
+ - Dockerfile.base
27
+ - pip.conf
28
+ script:
29
+ - build_base_image
30
+
31
+ build image:
32
+ stage: build
33
+ when: on_success
34
+ tags:
35
+ - arm
36
+ only:
37
+ - production@backend/reportify-api-cli
38
+ script:
39
+ - build_image
40
+
41
+ push image to volc:
42
+ stage: push_image
43
+ when: manual
44
+ tags:
45
+ - arm
46
+ only:
47
+ - production@backend/reportify-api-cli
48
+ script:
49
+ - push_to_volc
50
+
51
+ .auto_devops: &auto_devops |
52
+ # Auto DevOps variables and functions
53
+ [[ "$TRACE" ]] && set -x
54
+ export CI_REGISTRY='harbor.xiaobangtouzi.com'
55
+ export CI_IMAGE_TAG=${CI_COMMIT_SHA:0:10}
56
+ export VOLC_IMAGE_NAME=harbror-cn-beijing.cr.volces.com/backend/reportify-api-cli:$CI_IMAGE_TAG
57
+ # TODO rm "reportify-api-cli"
58
+ export SERVICES=( "reportify-api-cli" )
59
+
60
+ function registry_login() {
61
+ if [[ -n "$CI_REGISTRY_USER" ]]; then
62
+ echo "Logging to Harbor Registry with CI credentials..."
63
+ echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
64
+ fi
65
+ }
66
+
67
+ function build_base_image() {
68
+ registry_login
69
+ echo "Build Python Base Image"
70
+ image_name=$CI_REGISTRY/base/reportify-api-cli-base-sandbox-$CI_COMMIT_REF_NAME:$CI_IMAGE_TAG
71
+ image_name_tag=$CI_REGISTRY/base/reportify-api-cli-base-sandbox-$CI_COMMIT_REF_NAME:latest
72
+ docker build -t ${image_name} -t ${image_name_tag} -f Dockerfile.base .
73
+ docker push ${image_name}
74
+ docker push ${image_name_tag}
75
+ docker rmi ${image_name}
76
+ docker rmi ${image_name_tag}
77
+ }
78
+
79
+ function build_image() {
80
+ registry_login
81
+
82
+ BASE_IMAGE=$CI_REGISTRY/base/reportify-api-cli-base-sandbox-$CI_COMMIT_REF_NAME:latest
83
+ echo "BASE IMAGE $BASE_IMAGE"
84
+
85
+ # build service image
86
+ for service in "${SERVICES[@]}"
87
+ do
88
+ CI_IMAGE_NAME=$CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/$service/$CI_COMMIT_REF_NAME:$CI_IMAGE_TAG
89
+
90
+ echo "Build $CI_IMAGE_NAME for branch $CI_COMMIT_REF_NAME"
91
+ echo "CURRENT PATH `pwd`"
92
+ docker pull $BASE_IMAGE
93
+ docker build --tag $CI_IMAGE_NAME --tag $VOLC_IMAGE_NAME --build-arg base_image=$BASE_IMAGE -f Dockerfile .
94
+ docker push $CI_IMAGE_NAME
95
+ docker rmi $CI_IMAGE_NAME
96
+ done
97
+ }
98
+
99
+ function push_to_volc() {
100
+ docker push $VOLC_IMAGE_NAME
101
+ }
102
+
103
+ before_script:
104
+ - *auto_devops
@@ -0,0 +1,10 @@
1
+ ARG base_image
2
+ FROM $base_image
3
+
4
+ WORKDIR /reportify-api-cli
5
+
6
+ ADD src /reportify-api-cli/src
7
+
8
+ RUN uv sync
9
+ RUN ln -s /reportify-api-cli/.venv/bin/reportify-api-cli /usr/local/bin/reportify-api-cli
10
+
@@ -0,0 +1,10 @@
1
+ FROM harbor.xiaobangtouzi.com/thirdpart/vefaas-public/all-in-one-sandbox:latest AS builder
2
+
3
+ WORKDIR /reportify-api-cli
4
+
5
+ ADD pyproject.toml /reportify-api-cli/pyproject.toml
6
+ ADD uv.lock /code/uv.lock
7
+
8
+ RUN uv sync
9
+
10
+ RUN pip install --no-cache-dir --upgrade reportify-sdk
@@ -0,0 +1,10 @@
1
+ FROM enterprise-public-cn-beijing.cr.volces.com/vefaas-public/all-in-one-sandbox:latest AS builder
2
+
3
+ WORKDIR /reportify-api-cli
4
+
5
+ ADD src /reportify-api-cli/src
6
+ ADD pyproject.toml /reportify-api-cli/pyproject.toml
7
+
8
+ RUN uv sync
9
+ RUN ln -s /reportify-api-cli/.venv/bin/reportify-api-cli /usr/local/bin/reportify-api-cli
10
+
@@ -0,0 +1,118 @@
1
+ .PHONY: help install dev-install test test-unit test-integration clean lint format run build uninstall reinstall publish-test publish-prod publish-dry-run bump-major bump-minor bump-patch version
2
+
3
+ # Default target
4
+ help:
5
+ @echo "Available commands:"
6
+ @echo ""
7
+ @echo "Development:"
8
+ @echo " make install - Install the package in editable mode"
9
+ @echo " make dev-install - Install package with dev dependencies"
10
+ @echo " make test - Run all tests"
11
+ @echo " make test-unit - Run unit tests only"
12
+ @echo " make test-integration - Run integration tests only"
13
+ @echo " make lint - Run linter (ruff check)"
14
+ @echo " make fix - Fix linter issues automatically"
15
+ @echo " make format - Format code (ruff format)"
16
+ @echo " make clean - Clean up cache and build files"
17
+ @echo " make build - Build the package"
18
+ @echo " make reinstall - Reinstall the package"
19
+ @echo " make run - Run CLI with --help"
20
+ @echo ""
21
+ @echo "Publishing:"
22
+ @echo " make version - Show current version"
23
+ @echo " make bump-patch - Bump patch version (0.1.0 -> 0.1.1)"
24
+ @echo " make bump-minor - Bump minor version (0.1.0 -> 0.2.0)"
25
+ @echo " make bump-major - Bump major version (0.1.0 -> 1.0.0)"
26
+ @echo " make publish-dry-run - Dry run of publishing (no actual upload)"
27
+ @echo " make publish-test - Publish to Test PyPI"
28
+ @echo " make publish-prod - Publish to Production PyPI"
29
+
30
+ # Install package in editable mode
31
+ install:
32
+ uv sync
33
+
34
+ # Install with dev dependencies
35
+ dev-install:
36
+ uv sync --group dev
37
+
38
+ # Run all tests
39
+ test:
40
+ uv run pytest tests/ -v
41
+
42
+ # Run unit tests only
43
+ test-unit:
44
+ uv run pytest tests/test_commands/ -v
45
+
46
+ # Run integration tests only (requires REPORTIFY_API_KEY)
47
+ test-integration:
48
+ uv run pytest tests/integration/ -v
49
+
50
+ # Run linter
51
+ lint:
52
+ uv run ruff check src/ tests/
53
+
54
+ fix:
55
+ uv run ruff check src/ tests/ --fix
56
+
57
+ # Format code
58
+ format:
59
+ uv run ruff format src/ tests/
60
+
61
+ # Clean cache and build files
62
+ clean:
63
+ rm -rf __pycache__
64
+ rm -rf src/__pycache__
65
+ rm -rf src/commands/__pycache__
66
+ rm -rf tests/__pycache__
67
+ rm -rf tests/test_commands/__pycache__
68
+ rm -rf tests/integration/__pycache__
69
+ rm -rf .pytest_cache
70
+ rm -rf .ruff_cache
71
+ rm -rf build/
72
+ rm -rf dist/
73
+ rm -rf *.egg-info
74
+ rm -rf reportify_api_cli.egg-info
75
+ find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
76
+ find . -type f -name "*.pyc" -delete
77
+
78
+ # Build the package
79
+ build:
80
+ uv build
81
+
82
+ # Reinstall the package (clean sync)
83
+ reinstall:
84
+ uv sync --reinstall
85
+
86
+ # Run CLI with --help
87
+ run:
88
+ uv run reportify-cli --help
89
+
90
+ # Show current version
91
+ version:
92
+ @grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/'
93
+
94
+ # Bump patch version (0.1.0 -> 0.1.1)
95
+ bump-patch:
96
+ @./scripts/bump_version.sh patch
97
+
98
+ # Bump minor version (0.1.0 -> 0.2.0)
99
+ bump-minor:
100
+ @./scripts/bump_version.sh minor
101
+
102
+ # Bump major version (0.1.0 -> 1.0.0)
103
+ bump-major:
104
+ @./scripts/bump_version.sh major
105
+
106
+ # Dry run of publishing (no actual upload)
107
+ publish-dry-run:
108
+ @./scripts/publish.sh test dry-run
109
+
110
+ # Publish to Test PyPI
111
+ publish-test:
112
+ @./scripts/publish.sh test
113
+
114
+ # Publish to Production PyPI
115
+ publish-prod:
116
+ @./scripts/publish.sh prod
117
+
118
+
@@ -0,0 +1,191 @@
1
+ Metadata-Version: 2.4
2
+ Name: reportify-cli
3
+ Version: 0.1.0
4
+ Summary: CLI wrapper for Reportify SDK - Access Reportify API through command line
5
+ Project-URL: Homepage, https://reportify.ai
6
+ Project-URL: Documentation, https://docs.reportify.ai
7
+ Project-URL: Repository, https://github.com/reportify/reportify-cli
8
+ Project-URL: Issues, https://github.com/reportify/reportify-cli/issues
9
+ Author-email: Reportify Team <support@reportify.ai>
10
+ License: MIT
11
+ Keywords: api,cli,finance,reportify,research,stock
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Financial and Insurance Industry
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Office/Business :: Financial
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Requires-Python: >=3.12
24
+ Requires-Dist: pandas>=2.0.0
25
+ Requires-Dist: python-dotenv>=1.2.1
26
+ Requires-Dist: reportify-sdk>=0.3.9
27
+ Requires-Dist: tabulate>=0.9.0
28
+ Requires-Dist: typer>=0.21.1
29
+ Description-Content-Type: text/markdown
30
+
31
+ # Reportify API CLI
32
+
33
+ 通过命令行访问 [Reportify SDK](https://github.com/reportify-ai/reportify-doc/tree/main/sdks) 的所有功能。
34
+
35
+ ## 特性
36
+
37
+ - 🚀 **完整功能** - 支持 Reportify SDK 的所有 8 个模块、44+ 个方法
38
+ - 📊 **多种输出格式** - JSON、Table、CSV、Markdown
39
+ - 🎯 **简单易用** - 统一的 JSON 输入格式,清晰的帮助文档
40
+ - 🤖 **AI 友好** - 专为 AI Agent 设计,提供详细的参数说明
41
+
42
+ ## 安装
43
+
44
+ ```bash
45
+ # 安装依赖并安装 CLI
46
+ make install
47
+
48
+ # 或使用 uv 直接安装
49
+ uv pip install -e .
50
+ ```
51
+
52
+ ## 配置
53
+
54
+ 设置 API Key(必需):
55
+
56
+ ```bash
57
+ # 方式 1: 环境变量
58
+ export REPORTIFY_API_KEY='your-api-key'
59
+
60
+ # 方式 2: .env 文件
61
+ echo "REPORTIFY_API_KEY=your-api-key" > .env
62
+ ```
63
+
64
+ ## 快速开始
65
+
66
+ ```bash
67
+ # 查看帮助
68
+ reportify-cli --help
69
+ reportify-cli -h
70
+
71
+ # 查看模块帮助
72
+ reportify-cli docs --help
73
+
74
+ # 查看命令帮助
75
+ reportify-cli docs get --help
76
+
77
+ # 获取文档详情(JSON 格式)
78
+ reportify-cli docs get --input '{"doc_id": "1214713494948155392"}'
79
+
80
+ # 获取股票行情(Table 格式)
81
+ reportify-cli stock quote --input '{"symbol": "600519"}' --format table
82
+
83
+ # 获取财务数据(Markdown 格式)
84
+ reportify-cli stock income_statement \
85
+ --input '{"symbol": "600519", "period": "annual"}' \
86
+ --format markdown
87
+ ```
88
+
89
+ ## 可用模块
90
+
91
+ | 模块 | 说明 | 命令数 |
92
+ |------|------|--------|
93
+ | `search` | 文档搜索功能 | 9 |
94
+ | `docs` | 文档内容功能 | 4 |
95
+ | `stock` | 股票数据功能 | 14 |
96
+ | `timeline` | 时间线功能 | 5 |
97
+ | `kb` | 知识库功能 | 1 |
98
+ | `user` | 用户数据功能 | 1 |
99
+ | `quant` | 量化分析功能 | 8 |
100
+ | `concepts` | 概念动态功能 | 2 |
101
+
102
+ ## 输出格式
103
+
104
+ 支持 4 种输出格式:
105
+
106
+ - `--format json` - JSON 格式(默认)
107
+ - `--format table` - 表格格式
108
+ - `--format csv` - CSV 格式
109
+ - `--format markdown` 或 `--format md` - Markdown 表格
110
+
111
+ ## 开发
112
+
113
+ ```bash
114
+ # 查看所有可用命令
115
+ make help
116
+
117
+ # 运行测试
118
+ make test
119
+
120
+ # 运行单元测试
121
+ make test-unit
122
+
123
+ # 运行集成测试(需要 API Key)
124
+ make test-integration
125
+
126
+ # 代码格式化
127
+ make format
128
+
129
+ # 代码检查
130
+ make lint
131
+
132
+ # 清理缓存
133
+ make clean
134
+
135
+ # 重新安装
136
+ make reinstall
137
+ ```
138
+
139
+ ## 项目结构
140
+
141
+ ```
142
+ reportify-cli/
143
+ ├── src/ # 源代码
144
+ │ ├── main.py # CLI 入口
145
+ │ ├── commands/ # 命令模块
146
+ │ ├── client.py # SDK 客户端
147
+ │ ├── output.py # 输出格式化
148
+ │ ├── params.py # 参数定义
149
+ │ ├── settings.py # 配置管理
150
+ │ └── utils.py # 工具函数
151
+ ├── tests/ # 测试
152
+ │ ├── test_commands/ # 单元测试
153
+ │ └── integration/ # 集成测试
154
+ ├── Makefile # 开发命令
155
+ ├── pyproject.toml # 项目配置
156
+ └── README.md # 项目文档
157
+ ```
158
+
159
+ ## 示例
160
+
161
+ ### 搜索文档
162
+
163
+ ```bash
164
+ reportify-cli search query \
165
+ --input '{"query": "茅台", "limit": 10}'
166
+ ```
167
+
168
+ ### 获取股票数据
169
+
170
+ ```bash
171
+ # 公司概览
172
+ reportify-cli stock overview --input '{"symbol": "600519"}'
173
+
174
+ # 财务报表
175
+ reportify-cli stock income_statement \
176
+ --input '{"symbol": "600519", "period": "annual"}'
177
+
178
+ # 股价数据
179
+ reportify-cli stock prices \
180
+ --input '{"symbol": "600519", "start_date": "2024-01-01", "end_date": "2024-12-31"}'
181
+ ```
182
+
183
+ ### 量化分析
184
+
185
+ ```bash
186
+ # 计算技术指标
187
+ reportify-cli quant indicators_compute \
188
+ --input '{"symbols": ["600519"], "formula": "RSI(14)"}' \
189
+ --format table
190
+ ```
191
+