fubon-cli 0.1.3__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 (50) hide show
  1. fubon_cli-0.1.3/.editorconfig +27 -0
  2. fubon_cli-0.1.3/.flake8 +25 -0
  3. fubon_cli-0.1.3/.github/workflows/ci.yml +143 -0
  4. fubon_cli-0.1.3/.github/workflows/release.yml +159 -0
  5. fubon_cli-0.1.3/.gitignore +62 -0
  6. fubon_cli-0.1.3/.gitignore_extra +14 -0
  7. fubon_cli-0.1.3/.mypy.ini +15 -0
  8. fubon_cli-0.1.3/.pre-commit-config.yaml +38 -0
  9. fubon_cli-0.1.3/CHANGELOG.md +39 -0
  10. fubon_cli-0.1.3/CI_CD_STATUS.md +248 -0
  11. fubon_cli-0.1.3/CONTRIBUTING.md +87 -0
  12. fubon_cli-0.1.3/Fubon.md +420 -0
  13. fubon_cli-0.1.3/LICENSE +21 -0
  14. fubon_cli-0.1.3/MANIFEST.in +12 -0
  15. fubon_cli-0.1.3/PKG-INFO +280 -0
  16. fubon_cli-0.1.3/README.md +226 -0
  17. fubon_cli-0.1.3/RELEASE_GUIDE.md +168 -0
  18. fubon_cli-0.1.3/SETUP_COMPLETE.md +273 -0
  19. fubon_cli-0.1.3/fubon_cli/__init__.py +12 -0
  20. fubon_cli-0.1.3/fubon_cli/_version.py +34 -0
  21. fubon_cli-0.1.3/fubon_cli/commands/__init__.py +1 -0
  22. fubon_cli-0.1.3/fubon_cli/commands/account.py +106 -0
  23. fubon_cli-0.1.3/fubon_cli/commands/auth.py +96 -0
  24. fubon_cli-0.1.3/fubon_cli/commands/market.py +299 -0
  25. fubon_cli-0.1.3/fubon_cli/commands/realtime.py +125 -0
  26. fubon_cli-0.1.3/fubon_cli/commands/stock.py +304 -0
  27. fubon_cli-0.1.3/fubon_cli/core.py +221 -0
  28. fubon_cli-0.1.3/fubon_cli/main.py +32 -0
  29. fubon_cli-0.1.3/fubon_cli.egg-info/PKG-INFO +280 -0
  30. fubon_cli-0.1.3/fubon_cli.egg-info/SOURCES.txt +48 -0
  31. fubon_cli-0.1.3/fubon_cli.egg-info/dependency_links.txt +1 -0
  32. fubon_cli-0.1.3/fubon_cli.egg-info/entry_points.txt +2 -0
  33. fubon_cli-0.1.3/fubon_cli.egg-info/requires.txt +25 -0
  34. fubon_cli-0.1.3/fubon_cli.egg-info/top_level.txt +1 -0
  35. fubon_cli-0.1.3/pyproject.toml +158 -0
  36. fubon_cli-0.1.3/pytest.ini +29 -0
  37. fubon_cli-0.1.3/scripts/README.md +87 -0
  38. fubon_cli-0.1.3/scripts/quick_check.ps1 +72 -0
  39. fubon_cli-0.1.3/scripts/release.ps1 +264 -0
  40. fubon_cli-0.1.3/scripts/update_version.ps1 +41 -0
  41. fubon_cli-0.1.3/scripts/version_config.json +26 -0
  42. fubon_cli-0.1.3/setup.cfg +4 -0
  43. fubon_cli-0.1.3/tests/__init__.py +5 -0
  44. fubon_cli-0.1.3/tests/test_cli.py +32 -0
  45. fubon_cli-0.1.3/tests/test_core.py +19 -0
  46. fubon_cli-0.1.3/wheels/README.md +79 -0
  47. fubon_cli-0.1.3/wheels/fubon_neo-2.2.8-cp37-abi3-macosx_10_12_x86_64.whl +0 -0
  48. fubon_cli-0.1.3/wheels/fubon_neo-2.2.8-cp37-abi3-macosx_11_0_arm64.whl +0 -0
  49. fubon_cli-0.1.3/wheels/fubon_neo-2.2.8-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl +0 -0
  50. fubon_cli-0.1.3/wheels/fubon_neo-2.2.8-cp37-abi3-win_amd64.whl +0 -0
@@ -0,0 +1,27 @@
1
+ # Encoding declaration
2
+ # ----- Editor/IDE Configuration -----
3
+
4
+ [*]
5
+ charset = utf-8
6
+ end_of_line = lf
7
+ insert_final_newline = true
8
+ trim_trailing_whitespace = true
9
+
10
+ # Python files
11
+ [*.py]
12
+ indent_style = space
13
+ indent_size = 4
14
+
15
+ # JSON files
16
+ [*.json]
17
+ indent_style = space
18
+ indent_size = 2
19
+
20
+ # YAML files
21
+ [*.{yml,yaml}]
22
+ indent_style = space
23
+ indent_size = 2
24
+
25
+ # Markdown
26
+ [*.md]
27
+ trim_trailing_whitespace = false
@@ -0,0 +1,25 @@
1
+ [flake8]
2
+ max-line-length = 100
3
+ max-complexity = 10
4
+ exclude =
5
+ .git,
6
+ __pycache__,
7
+ .venv,
8
+ venv,
9
+ .pytest_cache,
10
+ .mypy_cache,
11
+ build,
12
+ dist,
13
+ *.egg-info,
14
+ .github
15
+
16
+ ignore =
17
+ E203,
18
+ E501,
19
+ W503,
20
+ W504
21
+
22
+ per-file-ignores =
23
+ __init__.py:F401,F403
24
+ tests/*:D100,D101,D104
25
+
@@ -0,0 +1,143 @@
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
+ runs-on: ${{ matrix.os }}
12
+ strategy:
13
+ matrix:
14
+ os: [ubuntu-latest, windows-latest, macos-latest]
15
+ python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
16
+ fail-fast: false
17
+
18
+ name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ with:
23
+ fetch-depth: 0
24
+
25
+ - name: Set up Python ${{ matrix.python-version }}
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ python-version: ${{ matrix.python-version }}
29
+
30
+ - name: Install fubon_neo (Linux)
31
+ if: matrix.os == 'ubuntu-latest'
32
+ run: |
33
+ python -m pip install --upgrade pip
34
+ pip install setuptools-scm
35
+ pip install ./wheels/fubon_neo-2.2.8-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
36
+
37
+ - name: Install fubon_neo (Windows)
38
+ if: matrix.os == 'windows-latest'
39
+ run: |
40
+ python -m pip install --upgrade pip
41
+ pip install setuptools-scm
42
+ pip install ./wheels/fubon_neo-2.2.8-cp37-abi3-win_amd64.whl
43
+
44
+ - name: Install fubon_neo (macOS)
45
+ if: matrix.os == 'macos-latest'
46
+ run: |
47
+ python -m pip install --upgrade pip
48
+ pip install setuptools-scm
49
+ # Try ARM first, fall back to x86_64
50
+ pip install ./wheels/fubon_neo-2.2.8-cp37-abi3-macosx_11_0_arm64.whl || \
51
+ pip install ./wheels/fubon_neo-2.2.8-cp37-abi3-macosx_10_12_x86_64.whl
52
+
53
+ - name: Install project dependencies
54
+ run: |
55
+ pip install -e ".[dev]"
56
+
57
+ - name: Lint with flake8
58
+ run: |
59
+ # Stop the build if there are Python syntax errors or undefined names
60
+ flake8 fubon_cli --count --select=E9,F63,F7,F82 --show-source --statistics
61
+ # Exit-zero treats all errors as warnings
62
+ flake8 fubon_cli --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics
63
+ continue-on-error: true
64
+
65
+ - name: Type check with mypy
66
+ run: |
67
+ mypy fubon_cli || true
68
+ continue-on-error: true
69
+
70
+ - name: Test with pytest
71
+ run: |
72
+ pytest -v --tb=short --cov=fubon_cli --cov-report=xml --cov-report=term-missing
73
+
74
+ - name: Upload coverage to Codecov
75
+ uses: codecov/codecov-action@v3
76
+ with:
77
+ files: ./coverage.xml
78
+ flags: unittests
79
+ name: codecov-umbrella
80
+ fail_ci_if_error: false
81
+
82
+ code-quality:
83
+ runs-on: ubuntu-latest
84
+ name: Code Quality Checks
85
+
86
+ steps:
87
+ - uses: actions/checkout@v4
88
+
89
+ - name: Set up Python
90
+ uses: actions/setup-python@v5
91
+ with:
92
+ python-version: '3.11'
93
+
94
+ - name: Install dependencies
95
+ run: |
96
+ python -m pip install --upgrade pip
97
+ pip install black isort ruff bandit safety
98
+
99
+ - name: Check code formatting with Black
100
+ run: black --check fubon_cli tests || true
101
+
102
+ - name: Check import ordering with isort
103
+ run: isort --check-only fubon_cli tests || true
104
+
105
+ - name: Run Ruff linter
106
+ run: ruff check fubon_cli || true
107
+
108
+ - name: Security check with Bandit
109
+ run: bandit -r fubon_cli -f json -o bandit-report.json || true
110
+
111
+ - name: Check dependencies with Safety
112
+ run: safety check --json || true
113
+
114
+ build:
115
+ needs: [test, code-quality]
116
+ runs-on: ubuntu-latest
117
+ name: Build Package
118
+
119
+ steps:
120
+ - uses: actions/checkout@v4
121
+ with:
122
+ fetch-depth: 0
123
+
124
+ - name: Set up Python
125
+ uses: actions/setup-python@v5
126
+ with:
127
+ python-version: '3.11'
128
+
129
+ - name: Install build dependencies
130
+ run: |
131
+ python -m pip install --upgrade pip
132
+ pip install build setuptools-scm
133
+
134
+ - name: Build package
135
+ run: |
136
+ python -m build
137
+
138
+ - name: Upload build artifacts
139
+ uses: actions/upload-artifact@v4
140
+ with:
141
+ name: dist
142
+ path: dist/
143
+ retention-days: 5
@@ -0,0 +1,159 @@
1
+ name: Release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+ inputs:
8
+ version:
9
+ description: 'Release version'
10
+ required: true
11
+ default: 'patch'
12
+ type: choice
13
+ options:
14
+ - patch
15
+ - minor
16
+ - major
17
+
18
+ jobs:
19
+ # 版本管理和標籤建立
20
+ version:
21
+ runs-on: ubuntu-latest
22
+ permissions:
23
+ contents: write
24
+ outputs:
25
+ tag: ${{ steps.version_output.outputs.tag }}
26
+ version: ${{ steps.version_output.outputs.version }}
27
+
28
+ steps:
29
+ - uses: actions/checkout@v6
30
+ with:
31
+ fetch-depth: 0
32
+
33
+ - name: Set up Python
34
+ uses: actions/setup-python@v6
35
+ with:
36
+ python-version: "3.11"
37
+
38
+ - name: Install setuptools-scm
39
+ run: |
40
+ python -m pip install --upgrade pip
41
+ pip install setuptools-scm
42
+
43
+ - name: Get version from tag
44
+ if: github.event_name == 'release'
45
+ id: get_version_tag
46
+ run: |
47
+ VERSION=${GITHUB_REF#refs/tags/v}
48
+ echo "VERSION=$VERSION" >> $GITHUB_ENV
49
+ echo "TAG_VERSION=v$VERSION" >> $GITHUB_ENV
50
+
51
+ - name: Bump version and create tag
52
+ if: github.event_name == 'workflow_dispatch'
53
+ id: bump_version
54
+ run: |
55
+ git config --local user.email "action@github.com"
56
+ git config --local user.name "GitHub Action"
57
+
58
+ # Get current version from setuptools-scm
59
+ CURRENT_VERSION=$(python -c "import setuptools_scm; print(setuptools_scm.get_version().split('+')[0])")
60
+ echo "Current version: $CURRENT_VERSION"
61
+
62
+ # Extract version parts
63
+ IFS='.' read -r major minor patch <<< "$CURRENT_VERSION"
64
+ patch=${patch%%-*} # Remove suffix like -dev0
65
+
66
+ # Bump version based on input
67
+ if [ "${{ github.event.inputs.version }}" = "major" ]; then
68
+ NEW_VERSION="$((major + 1)).0.0"
69
+ elif [ "${{ github.event.inputs.version }}" = "minor" ]; then
70
+ NEW_VERSION="$major.$((minor + 1)).0"
71
+ else
72
+ NEW_VERSION="$major.$minor.$((patch + 1))"
73
+ fi
74
+
75
+ echo "New version: $NEW_VERSION"
76
+ echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
77
+ echo "TAG_VERSION=v$NEW_VERSION" >> $GITHUB_ENV
78
+
79
+ # Create and push tag
80
+ git tag "v$NEW_VERSION"
81
+ git push origin "v$NEW_VERSION"
82
+
83
+ - name: Set version output
84
+ id: version_output
85
+ run: |
86
+ echo "tag=${{ env.TAG_VERSION }}" >> $GITHUB_OUTPUT
87
+ echo "version=${{ env.VERSION }}" >> $GITHUB_OUTPUT
88
+
89
+ # 發布到 PyPI
90
+ pypi-release:
91
+ needs: version
92
+ runs-on: ubuntu-latest
93
+ environment: release
94
+ permissions:
95
+ id-token: write
96
+ contents: read
97
+
98
+ steps:
99
+ - uses: actions/checkout@v6
100
+ with:
101
+ ref: ${{ needs.version.outputs.tag }}
102
+ fetch-depth: 0
103
+
104
+ - name: Set up Python
105
+ uses: actions/setup-python@v6
106
+ with:
107
+ python-version: "3.11"
108
+
109
+ - name: Install build dependencies
110
+ run: |
111
+ python -m pip install --upgrade pip
112
+ pip install build twine setuptools-scm
113
+
114
+ - name: Build package
115
+ run: python -m build
116
+
117
+ - name: Check package
118
+ run: twine check dist/*
119
+
120
+ - name: Publish to PyPI
121
+ uses: pypa/gh-action-pypi-publish@release/v1
122
+ with:
123
+ password: ${{ secrets.PYPI_API_TOKEN }}
124
+ print-hash: true
125
+
126
+ # 建立 GitHub Release
127
+ github-release:
128
+ needs: [version, pypi-release]
129
+ runs-on: ubuntu-latest
130
+ if: github.event_name == 'workflow_dispatch'
131
+ permissions:
132
+ contents: write
133
+
134
+ steps:
135
+ - uses: actions/checkout@v6
136
+ with:
137
+ ref: ${{ needs.version.outputs.tag }}
138
+
139
+ - name: Download artifacts
140
+ uses: actions/download-artifact@v4
141
+ with:
142
+ name: dist
143
+ path: dist/
144
+ continue-on-error: true
145
+
146
+ - name: Create Release Notes
147
+ run: |
148
+ echo "## Release ${{ needs.version.outputs.version }}" > release_notes.md
149
+ echo "" >> release_notes.md
150
+ echo "Published to [PyPI](https://pypi.org/project/fubon-cli/${{ needs.version.outputs.version }}/)" >> release_notes.md
151
+
152
+ - name: Create GitHub Release
153
+ uses: softprops/action-gh-release@v1
154
+ with:
155
+ tag_name: ${{ needs.version.outputs.tag }}
156
+ body_path: release_notes.md
157
+ files: dist/*
158
+ env:
159
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,62 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ # *.whl
8
+ .env
9
+ *.pem
10
+ *.pfx
11
+ *.p12
12
+ *.cert
13
+ _whl_extract/
14
+ .session.json
15
+ venv/
16
+ .venv/
17
+ log/
18
+
19
+ # Testing
20
+ .pytest_cache/
21
+ .coverage
22
+ coverage.xml
23
+ htmlcov/
24
+ .mypy_cache/
25
+ .dmypy.json
26
+ dmypy.json
27
+
28
+ # IDE
29
+ .vscode/
30
+ .idea/
31
+ *.swp
32
+ *.swo
33
+ *~
34
+ .DS_Store
35
+
36
+ # Version
37
+ fubon_cli/_version.py
38
+
39
+ # Build artifacts
40
+ *.egg-info/
41
+ eggs/
42
+ .eggs/
43
+ lib/
44
+ lib64/
45
+ parts/
46
+ sdist/
47
+ var/
48
+ # wheels/
49
+ pip-wheel-metadata/
50
+ share/python-wheels/
51
+
52
+ # Development
53
+ .ruff_cache/
54
+ .pre-commit-config.yaml.bak
55
+ bandit-report.json
56
+
57
+ # Temporary files
58
+ *.tmp
59
+ *.temp
60
+ *.backup
61
+ *.bak
62
+
@@ -0,0 +1,14 @@
1
+ exclude: |
2
+ (?x)^(
3
+ \.venv/|
4
+ venv/|
5
+ __pycache__/|
6
+ \.pytest_cache/|
7
+ \.mypy_cache/|
8
+ \.git/|
9
+ build/|
10
+ dist/|
11
+ .*\.egg-info/|
12
+ htmlcov/|
13
+ coverage.xml
14
+ )
@@ -0,0 +1,15 @@
1
+ [mypy]
2
+ python_version = 3.8
3
+ check_untyped_defs = True
4
+ warn_return_any = True
5
+ warn_unused_configs = True
6
+ warn_redundant_casts = True
7
+ warn_unused_ignores = True
8
+ disallow_untyped_defs = False
9
+ ignore_missing_imports = True
10
+
11
+ [mypy-tests.*]
12
+ ignore_errors = True
13
+
14
+ [mypy-setuptools_scm]
15
+ ignore_missing_imports = True
@@ -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-merge-conflict
12
+ - id: check-toml
13
+
14
+ - repo: https://github.com/psf/black
15
+ rev: 23.12.0
16
+ hooks:
17
+ - id: black
18
+ language_version: python3
19
+
20
+ - repo: https://github.com/PyCQA/isort
21
+ rev: 5.13.2
22
+ hooks:
23
+ - id: isort
24
+ args: ["--profile", "black"]
25
+
26
+ - repo: https://github.com/PyCQA/flake8
27
+ rev: 6.1.0
28
+ hooks:
29
+ - id: flake8
30
+ args: ["--max-line-length=100"]
31
+ additional_dependencies: []
32
+
33
+ - repo: https://github.com/pre-commit/mirrors-mypy
34
+ rev: v1.7.1
35
+ hooks:
36
+ - id: mypy
37
+ additional_dependencies: ["types-all"]
38
+ args: ["--ignore-missing-imports"]
@@ -0,0 +1,39 @@
1
+ # Changelog
2
+
3
+ 所有對此項目的重大更改都將記錄在此文件中。
4
+
5
+ 該項目遵循 [Semantic Versioning](https://semver.org/)。
6
+
7
+ ## [Unreleased]
8
+
9
+ ### Added
10
+ - 初始版本發布
11
+ - CLI 基本命令框架
12
+ - 版本管理機制
13
+
14
+ ### Changed
15
+ - 完整的項目配置
16
+ - GitHub Actions CI/CD
17
+
18
+ ### Fixed
19
+ - N/A
20
+
21
+ ### Deprecated
22
+ - N/A
23
+
24
+ ### Removed
25
+ - N/A
26
+
27
+ ### Security
28
+ - N/A
29
+
30
+ ## [0.1.0] - 2026-02-26
31
+
32
+ ### Added
33
+ - 初始項目設置
34
+ - 基本 CLI 框架
35
+ - 測試環境配置
36
+ - 發布自動化腳本
37
+
38
+ [Unreleased]: https://github.com/mofesto/fubon-cli/compare/v0.1.0...HEAD
39
+ [0.1.0]: https://github.com/mofesto/fubon-cli/releases/tag/v0.1.0