parq-cli 0.0.1__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.
- parq_cli-0.0.1/.github/workflows/publish.yml +45 -0
- parq_cli-0.0.1/.github/workflows/test.yml +48 -0
- parq_cli-0.0.1/.gitignore +210 -0
- parq_cli-0.0.1/.python-version +1 -0
- parq_cli-0.0.1/LICENSE +21 -0
- parq_cli-0.0.1/PKG-INFO +226 -0
- parq_cli-0.0.1/QUICKSTART.md +165 -0
- parq_cli-0.0.1/README.md +193 -0
- parq_cli-0.0.1/data/test.parquet +0 -0
- parq_cli-0.0.1/examples/README.md +104 -0
- parq_cli-0.0.1/examples/create_sample_data.py +82 -0
- parq_cli-0.0.1/parq/__init__.py +10 -0
- parq_cli-0.0.1/parq/__main__.py +15 -0
- parq_cli-0.0.1/parq/cli.py +130 -0
- parq_cli-0.0.1/parq/output.py +176 -0
- parq_cli-0.0.1/parq/reader.py +164 -0
- parq_cli-0.0.1/pyproject.toml +60 -0
- parq_cli-0.0.1/scripts/publish.sh +105 -0
- parq_cli-0.0.1/tests/__init__.py +1 -0
- parq_cli-0.0.1/tests/conftest.py +35 -0
- parq_cli-0.0.1/tests/test_cli.py +65 -0
- parq_cli-0.0.1/tests/test_reader.py +94 -0
- parq_cli-0.0.1/uv.lock +900 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*' # 当推送 v 开头的 tag 时触发(如 v0.1.0, v1.0.0)
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build-and-publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- name: 📥 Checkout code
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: 🐍 Set up Python
|
|
17
|
+
uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: '3.11'
|
|
20
|
+
|
|
21
|
+
- name: 📦 Install build dependencies
|
|
22
|
+
run: |
|
|
23
|
+
python -m pip install --upgrade pip
|
|
24
|
+
pip install build twine
|
|
25
|
+
|
|
26
|
+
- name: 🔨 Build package
|
|
27
|
+
run: python -m build
|
|
28
|
+
|
|
29
|
+
- name: 🔍 Check package
|
|
30
|
+
run: twine check dist/*
|
|
31
|
+
|
|
32
|
+
- name: 🚀 Publish to PyPI
|
|
33
|
+
env:
|
|
34
|
+
TWINE_USERNAME: __token__
|
|
35
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
36
|
+
run: twine upload dist/*
|
|
37
|
+
|
|
38
|
+
- name: 📝 Create GitHub Release
|
|
39
|
+
uses: softprops/action-gh-release@v1
|
|
40
|
+
with:
|
|
41
|
+
files: dist/*
|
|
42
|
+
generate_release_notes: true
|
|
43
|
+
env:
|
|
44
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
45
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, develop ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
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.9', '3.10', '3.11', '3.12', '3.13']
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: 📥 Checkout code
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: 🐍 Set up Python ${{ matrix.python-version }}
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: 📦 Install dependencies
|
|
27
|
+
run: |
|
|
28
|
+
python -m pip install --upgrade pip
|
|
29
|
+
pip install -e ".[dev]"
|
|
30
|
+
pip install pandas # Ensure pandas is installed for tests
|
|
31
|
+
|
|
32
|
+
- name: 🧪 Run tests
|
|
33
|
+
run: pytest --cov=parq --cov-report=xml
|
|
34
|
+
|
|
35
|
+
- name: 📊 Upload coverage
|
|
36
|
+
uses: codecov/codecov-action@v4
|
|
37
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
|
|
38
|
+
with:
|
|
39
|
+
file: ./coverage.xml
|
|
40
|
+
fail_ci_if_error: false
|
|
41
|
+
|
|
42
|
+
- name: 🔍 Code quality check
|
|
43
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
|
|
44
|
+
run: |
|
|
45
|
+
pip install black ruff
|
|
46
|
+
black --check parq tests
|
|
47
|
+
ruff check parq tests
|
|
48
|
+
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
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
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
|
208
|
+
|
|
209
|
+
project_document/
|
|
210
|
+
.history/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11
|
parq_cli-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Jinfeng Sun
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
parq_cli-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: parq-cli
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A powerful command-line tool for inspecting and analyzing Apache Parquet files
|
|
5
|
+
Project-URL: Homepage, https://github.com/Tendo33/parq-cli
|
|
6
|
+
Project-URL: Repository, https://github.com/Tendo33/parq-cli
|
|
7
|
+
Project-URL: Issues, https://github.com/Tendo33/parq-cli/issues
|
|
8
|
+
Project-URL: Documentation, https://github.com/Tendo33/parq-cli#readme
|
|
9
|
+
Author-email: SimonSun <sjf19981112@gmail.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: analytics,apache-parquet,cli,data,data-tools,parquet
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Requires-Dist: pandas>=2.0.0
|
|
24
|
+
Requires-Dist: pyarrow>=18.0.0
|
|
25
|
+
Requires-Dist: rich>=13.0.0
|
|
26
|
+
Requires-Dist: typer>=0.15.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: black>=24.0.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff>=0.7.0; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# parq-cli
|
|
35
|
+
|
|
36
|
+
[](https://www.python.org/downloads/)
|
|
37
|
+
[](LICENSE)
|
|
38
|
+
|
|
39
|
+
一个强大的 Apache Parquet 文件命令行工具 🚀
|
|
40
|
+
|
|
41
|
+
## ✨ 特性
|
|
42
|
+
|
|
43
|
+
- 📊 **元数据查看**: 快速查看 Parquet 文件的元数据信息
|
|
44
|
+
- 📋 **Schema 展示**: 美观地展示文件的列结构和数据类型
|
|
45
|
+
- 👀 **数据预览**: 支持查看文件的前 N 行或后 N 行
|
|
46
|
+
- 🔢 **行数统计**: 快速获取文件的总行数
|
|
47
|
+
- 🎨 **美观输出**: 使用 Rich 库提供彩色、格式化的终端输出
|
|
48
|
+
|
|
49
|
+
## 📦 安装
|
|
50
|
+
|
|
51
|
+
### 从源码安装
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
git clone https://github.com/yourusername/parq-cli.git
|
|
55
|
+
cd parq-cli
|
|
56
|
+
pip install -e .
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 使用 pip 安装(即将支持)
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install parq-cli
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## 🚀 快速开始
|
|
66
|
+
|
|
67
|
+
### 基本用法
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# 查看文件元数据
|
|
71
|
+
parq data.parquet
|
|
72
|
+
|
|
73
|
+
# 显示 schema 信息
|
|
74
|
+
parq data.parquet --schema
|
|
75
|
+
|
|
76
|
+
# 显示前 10 行
|
|
77
|
+
parq data.parquet --head 10
|
|
78
|
+
|
|
79
|
+
# 显示后 5 行
|
|
80
|
+
parq data.parquet --tail 5
|
|
81
|
+
|
|
82
|
+
# 显示总行数
|
|
83
|
+
parq data.parquet --count
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 组合使用
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# 同时显示 schema 和行数
|
|
90
|
+
parq data.parquet --schema --count
|
|
91
|
+
|
|
92
|
+
# 显示前 5 行和 schema
|
|
93
|
+
parq data.parquet --head 5 --schema
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## 📖 命令参考
|
|
97
|
+
|
|
98
|
+
### 主命令
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
parq [OPTIONS] FILE
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**参数:**
|
|
105
|
+
- `FILE`: Parquet 文件路径(必需)
|
|
106
|
+
|
|
107
|
+
**选项:**
|
|
108
|
+
- `--schema, -s`: 显示 schema 信息
|
|
109
|
+
- `--head N`: 显示前 N 行
|
|
110
|
+
- `--tail N`: 显示后 N 行
|
|
111
|
+
- `--count, -c`: 显示总行数
|
|
112
|
+
- `--help`: 显示帮助信息
|
|
113
|
+
|
|
114
|
+
### 版本信息
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
parq version
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## 🎨 输出示例
|
|
121
|
+
|
|
122
|
+
### 元数据展示
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
╭─────────────────────── 📊 Parquet File Metadata ───────────────────────╮
|
|
126
|
+
│ file_path: /path/to/data.parquet │
|
|
127
|
+
│ num_rows: 1000 │
|
|
128
|
+
│ num_columns: 5 │
|
|
129
|
+
│ num_row_groups: 1 │
|
|
130
|
+
│ format_version: 2.6 │
|
|
131
|
+
│ serialized_size: 2048 │
|
|
132
|
+
│ created_by: parquet-cpp-arrow version 18.0.0 │
|
|
133
|
+
╰────────────────────────────────────────────────────────────────────────╯
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Schema 展示
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
📋 Schema Information
|
|
140
|
+
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━┓
|
|
141
|
+
┃ Column Name ┃ Data Type ┃ Nullable ┃
|
|
142
|
+
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━┩
|
|
143
|
+
│ id │ int64 │ ✗ │
|
|
144
|
+
│ name │ string │ ✓ │
|
|
145
|
+
│ age │ int64 │ ✓ │
|
|
146
|
+
│ city │ string │ ✓ │
|
|
147
|
+
│ salary │ double │ ✓ │
|
|
148
|
+
└─────────────┴───────────────┴──────────┘
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## 🛠️ 技术栈
|
|
152
|
+
|
|
153
|
+
- **[PyArrow](https://arrow.apache.org/docs/python/)**: 高性能的 Parquet 读取引擎
|
|
154
|
+
- **[Typer](https://typer.tiangolo.com/)**: 现代化的 CLI 框架
|
|
155
|
+
- **[Rich](https://rich.readthedocs.io/)**: 美观的终端输出
|
|
156
|
+
|
|
157
|
+
## 🧪 开发
|
|
158
|
+
|
|
159
|
+
### 安装开发依赖
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
pip install -e ".[dev]"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 运行测试
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
pytest
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### 运行测试(带覆盖率)
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
pytest --cov=parq --cov-report=html
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### 代码格式化
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# 使用 Black
|
|
181
|
+
black parq tests
|
|
182
|
+
|
|
183
|
+
# 使用 Ruff 检查
|
|
184
|
+
ruff check parq tests
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## 🗺️ 路线图
|
|
188
|
+
|
|
189
|
+
- [x] 基础元数据查看
|
|
190
|
+
- [x] Schema 展示
|
|
191
|
+
- [x] 数据预览(head/tail)
|
|
192
|
+
- [x] 行数统计
|
|
193
|
+
- [ ] SQL 查询支持
|
|
194
|
+
- [ ] 数据统计分析
|
|
195
|
+
- [ ] 格式转换(CSV, JSON, Excel)
|
|
196
|
+
- [ ] 文件对比
|
|
197
|
+
- [ ] 云存储支持(S3, GCS, Azure)
|
|
198
|
+
|
|
199
|
+
## 🤝 贡献
|
|
200
|
+
|
|
201
|
+
欢迎提交 Issue 和 Pull Request!
|
|
202
|
+
|
|
203
|
+
1. Fork 本仓库
|
|
204
|
+
2. 创建特性分支 (`git checkout -b feature/AmazingFeature`)
|
|
205
|
+
3. 提交更改 (`git commit -m 'Add some AmazingFeature'`)
|
|
206
|
+
4. 推送到分支 (`git push origin feature/AmazingFeature`)
|
|
207
|
+
5. 开启 Pull Request
|
|
208
|
+
|
|
209
|
+
## 📄 许可证
|
|
210
|
+
|
|
211
|
+
本项目采用 MIT 许可证 - 详见 [LICENSE](LICENSE) 文件
|
|
212
|
+
|
|
213
|
+
## 🙏 致谢
|
|
214
|
+
|
|
215
|
+
- 灵感来源于 [parquet-cli](https://github.com/chhantyal/parquet-cli)
|
|
216
|
+
- 感谢 Apache Arrow 团队提供强大的 Parquet 支持
|
|
217
|
+
- 感谢 Rich 库为终端输出增添色彩
|
|
218
|
+
|
|
219
|
+
## 📮 联系方式
|
|
220
|
+
|
|
221
|
+
- 作者: Jinfeng Sun
|
|
222
|
+
- 项目地址: https://github.com/Tendo33/parq-cli
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
**⭐ 如果这个项目对你有帮助,请给个 Star!**
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# 快速开始指南
|
|
2
|
+
|
|
3
|
+
## 📦 安装
|
|
4
|
+
|
|
5
|
+
### 1. 克隆项目
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone <your-repo-url>
|
|
9
|
+
cd parq-cli
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### 2. 安装依赖
|
|
13
|
+
|
|
14
|
+
#### 使用 pip(推荐开发环境)
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# 安装开发模式(可编辑安装)
|
|
18
|
+
pip install -e .
|
|
19
|
+
|
|
20
|
+
# 或安装开发依赖
|
|
21
|
+
pip install -e ".[dev]"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
#### 使用 uv(更快)
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
uv pip install -e .
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 3. 验证安装
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
parq --help
|
|
34
|
+
parq version
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 🚀 快速使用
|
|
38
|
+
|
|
39
|
+
### 生成测试数据
|
|
40
|
+
|
|
41
|
+
首先,生成一些示例 Parquet 文件用于测试:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
python examples/create_sample_data.py
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 基础命令
|
|
48
|
+
|
|
49
|
+
#### 1. 查看文件元数据(默认行为)
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
parq examples/simple.parquet
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
#### 2. 显示 Schema
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
parq examples/simple.parquet --schema
|
|
59
|
+
# 或使用短选项
|
|
60
|
+
parq examples/simple.parquet -s
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### 3. 预览数据
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# 显示前 10 行
|
|
67
|
+
parq examples/simple.parquet --head 10
|
|
68
|
+
|
|
69
|
+
# 显示后 5 行
|
|
70
|
+
parq examples/simple.parquet --tail 5
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### 4. 统计行数
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
parq examples/simple.parquet --count
|
|
77
|
+
# 或使用短选项
|
|
78
|
+
parq examples/simple.parquet -c
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
#### 5. 组合使用
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# 同时显示多个信息
|
|
85
|
+
parq examples/simple.parquet --schema --count --head 5
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## 🧪 运行测试
|
|
89
|
+
|
|
90
|
+
### 运行所有测试
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pytest
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 运行特定测试
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# 测试 CLI
|
|
100
|
+
pytest tests/test_cli.py
|
|
101
|
+
|
|
102
|
+
# 测试 Reader
|
|
103
|
+
pytest tests/test_reader.py
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 查看测试覆盖率
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pytest --cov=parq --cov-report=html
|
|
110
|
+
# 然后打开 htmlcov/index.html 查看详细报告
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## 🛠️ 开发
|
|
114
|
+
|
|
115
|
+
### 代码格式化
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# 使用 Black 格式化代码
|
|
119
|
+
black parq tests
|
|
120
|
+
|
|
121
|
+
# 使用 Ruff 检查
|
|
122
|
+
ruff check parq tests
|
|
123
|
+
|
|
124
|
+
# 自动修复
|
|
125
|
+
ruff check --fix parq tests
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 类型检查(可选)
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
pip install mypy
|
|
132
|
+
mypy parq
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## 📋 常见问题
|
|
136
|
+
|
|
137
|
+
### Q: 如何处理大文件?
|
|
138
|
+
|
|
139
|
+
A: parq-cli 会自动处理大文件,使用流式读取避免内存溢出。
|
|
140
|
+
|
|
141
|
+
### Q: 支持哪些 Parquet 版本?
|
|
142
|
+
|
|
143
|
+
A: 支持所有 PyArrow 支持的 Parquet 版本(1.0 和 2.x)。
|
|
144
|
+
|
|
145
|
+
### Q: 如何贡献代码?
|
|
146
|
+
|
|
147
|
+
A:
|
|
148
|
+
1. Fork 本仓库
|
|
149
|
+
2. 创建特性分支
|
|
150
|
+
3. 提交更改
|
|
151
|
+
4. 运行测试确保通过
|
|
152
|
+
5. 提交 Pull Request
|
|
153
|
+
|
|
154
|
+
## 🎯 下一步
|
|
155
|
+
|
|
156
|
+
- 查看完整文档:[README.md](README.md)
|
|
157
|
+
- 查看示例:[examples/README.md](examples/README.md)
|
|
158
|
+
- 查看架构设计:[project_document/parq-cli-architecture-design.md](project_document/parq-cli-architecture-design.md)
|
|
159
|
+
|
|
160
|
+
## 💡 提示
|
|
161
|
+
|
|
162
|
+
- 使用 `parq --help` 查看所有可用选项
|
|
163
|
+
- 大文件建议先用 `--count` 查看行数,再用 `--head` 预览数据
|
|
164
|
+
- 结合使用多个选项可以快速了解文件内容
|
|
165
|
+
|