parqx 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.
- parqx-0.1.0/LICENSE +21 -0
- parqx-0.1.0/PKG-INFO +52 -0
- parqx-0.1.0/README.md +39 -0
- parqx-0.1.0/pyproject.toml +78 -0
- parqx-0.1.0/src/parqx/__init__.py +1 -0
- parqx-0.1.0/src/parqx/__main__.py +5 -0
- parqx-0.1.0/src/parqx/cli.py +63 -0
- parqx-0.1.0/src/parqx/logger.py +76 -0
- parqx-0.1.0/src/parqx/py.typed +0 -0
- parqx-0.1.0/src/parqx/tui/__init__.py +1 -0
- parqx-0.1.0/src/parqx/tui/app.py +25 -0
- parqx-0.1.0/src/parqx/tui/widgets/__init__.py +5 -0
- parqx-0.1.0/src/parqx/tui/widgets/arrow_table.py +2006 -0
parqx-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Senyu Xie
|
|
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.
|
parqx-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: parqx
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Parquet TUI inspector
|
|
5
|
+
Author: Senyu Xie
|
|
6
|
+
Author-email: Senyu Xie <senyuxie@qq.com>
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: pyarrow>=24.0.0
|
|
9
|
+
Requires-Dist: textual>=8.2.7
|
|
10
|
+
Requires-Dist: typer>=0.26.7
|
|
11
|
+
Requires-Python: >=3.12
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# Parqx
|
|
15
|
+
|
|
16
|
+
Parqx is a lightweight terminal UI for inspecting Apache Parquet files.
|
|
17
|
+
|
|
18
|
+
It opens a local Parquet file directly in your terminal and displays it as an interactive, scrollable table backed by PyArrow and Textual.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
Parqx requires Python 3.12 or newer.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install parqx
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
Open a Parquet file:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
parqx data/weather.parquet
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Navigation
|
|
37
|
+
|
|
38
|
+
| Key | Action |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| `↑` / `↓` | Move the cursor up or down |
|
|
41
|
+
| `←` / `→` | Move the cursor left or right |
|
|
42
|
+
| `PageUp` / `PageDown` | Move one page up or down |
|
|
43
|
+
| `Home` | Move to the leftmost column |
|
|
44
|
+
| `End` | Move to the rightmost column |
|
|
45
|
+
| `Ctrl+Home` | Move to the first row |
|
|
46
|
+
| `Ctrl+End` | Move to the last row |
|
|
47
|
+
| `Enter` | Select the current cell |
|
|
48
|
+
| `Ctrl+Q` | Quit |
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
Parqx is licensed under the MIT License. See [LICENSE](LICENSE) for details.
|
parqx-0.1.0/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Parqx
|
|
2
|
+
|
|
3
|
+
Parqx is a lightweight terminal UI for inspecting Apache Parquet files.
|
|
4
|
+
|
|
5
|
+
It opens a local Parquet file directly in your terminal and displays it as an interactive, scrollable table backed by PyArrow and Textual.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Parqx requires Python 3.12 or newer.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install parqx
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
Open a Parquet file:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
parqx data/weather.parquet
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Navigation
|
|
24
|
+
|
|
25
|
+
| Key | Action |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| `↑` / `↓` | Move the cursor up or down |
|
|
28
|
+
| `←` / `→` | Move the cursor left or right |
|
|
29
|
+
| `PageUp` / `PageDown` | Move one page up or down |
|
|
30
|
+
| `Home` | Move to the leftmost column |
|
|
31
|
+
| `End` | Move to the rightmost column |
|
|
32
|
+
| `Ctrl+Home` | Move to the first row |
|
|
33
|
+
| `Ctrl+End` | Move to the last row |
|
|
34
|
+
| `Enter` | Select the current cell |
|
|
35
|
+
| `Ctrl+Q` | Quit |
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
Parqx is licensed under the MIT License. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "parqx"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Parquet TUI inspector"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license-files = ["LICENSE"]
|
|
7
|
+
authors = [
|
|
8
|
+
{ name = "Senyu Xie", email = "senyuxie@qq.com" }
|
|
9
|
+
]
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"pyarrow>=24.0.0",
|
|
13
|
+
"textual>=8.2.7",
|
|
14
|
+
"typer>=0.26.7",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[project.scripts]
|
|
18
|
+
parqx = "parqx.cli:app"
|
|
19
|
+
|
|
20
|
+
[build-system]
|
|
21
|
+
requires = ["uv_build>=0.11.21,<0.12.0"]
|
|
22
|
+
build-backend = "uv_build"
|
|
23
|
+
|
|
24
|
+
[dependency-groups]
|
|
25
|
+
dev = [
|
|
26
|
+
"mypy>=2.1.0",
|
|
27
|
+
"pyright>=1.1.410",
|
|
28
|
+
"pytest>=9.1.0",
|
|
29
|
+
"ruff>=0.15.17",
|
|
30
|
+
"textual-dev>=1.8.0",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[tool.mypy]
|
|
34
|
+
strict = true
|
|
35
|
+
python_version = "3.12"
|
|
36
|
+
|
|
37
|
+
[tool.pyright]
|
|
38
|
+
typeCheckingMode = "strict"
|
|
39
|
+
|
|
40
|
+
[tool.ruff]
|
|
41
|
+
target-version = "py312"
|
|
42
|
+
|
|
43
|
+
[tool.ruff.format]
|
|
44
|
+
docstring-code-format = true
|
|
45
|
+
skip-magic-trailing-comma = true
|
|
46
|
+
|
|
47
|
+
[tool.ruff.lint]
|
|
48
|
+
select = [
|
|
49
|
+
"B",
|
|
50
|
+
"C4",
|
|
51
|
+
"D",
|
|
52
|
+
"E4",
|
|
53
|
+
"E7",
|
|
54
|
+
"E9",
|
|
55
|
+
"F",
|
|
56
|
+
"G",
|
|
57
|
+
"I",
|
|
58
|
+
"LOG",
|
|
59
|
+
"N",
|
|
60
|
+
"PERF",
|
|
61
|
+
"PT",
|
|
62
|
+
"PTH",
|
|
63
|
+
"RET",
|
|
64
|
+
"RUF",
|
|
65
|
+
"S",
|
|
66
|
+
"SIM",
|
|
67
|
+
"TID",
|
|
68
|
+
"UP",
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
[tool.ruff.lint.per-file-ignores]
|
|
72
|
+
"tests/**" = ["S", "D"]
|
|
73
|
+
|
|
74
|
+
[tool.ruff.lint.isort]
|
|
75
|
+
split-on-trailing-comma = false
|
|
76
|
+
|
|
77
|
+
[tool.ruff.lint.pydocstyle]
|
|
78
|
+
convention = "google"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""The Parqx package."""
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""The Parqx CLI entrypoint."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
from importlib import metadata
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Annotated
|
|
7
|
+
|
|
8
|
+
import pyarrow.parquet as pq
|
|
9
|
+
import typer
|
|
10
|
+
|
|
11
|
+
from parqx.logger import setup_logging
|
|
12
|
+
from parqx.tui.app import ParqxApp
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger(__name__)
|
|
15
|
+
|
|
16
|
+
app = typer.Typer(help="Parqx: A Parquet TUI inspector.")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def version_callback(value: bool) -> None:
|
|
20
|
+
"""Parqx version callback."""
|
|
21
|
+
if value:
|
|
22
|
+
print(f"parqx {metadata.version('parqx')}")
|
|
23
|
+
raise typer.Exit()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@app.command()
|
|
27
|
+
def main(
|
|
28
|
+
path: Annotated[
|
|
29
|
+
Path,
|
|
30
|
+
typer.Argument(
|
|
31
|
+
exists=True,
|
|
32
|
+
file_okay=True,
|
|
33
|
+
dir_okay=False,
|
|
34
|
+
readable=True,
|
|
35
|
+
help="Parquet file to inspect.",
|
|
36
|
+
),
|
|
37
|
+
],
|
|
38
|
+
verbose: Annotated[
|
|
39
|
+
int,
|
|
40
|
+
typer.Option(
|
|
41
|
+
"--verbose",
|
|
42
|
+
"-v",
|
|
43
|
+
count=True,
|
|
44
|
+
help="Enable verbose logging (or `-vv` for more verbose output).",
|
|
45
|
+
),
|
|
46
|
+
] = 0,
|
|
47
|
+
version: Annotated[
|
|
48
|
+
bool | None,
|
|
49
|
+
typer.Option(
|
|
50
|
+
"--version",
|
|
51
|
+
callback=version_callback,
|
|
52
|
+
is_eager=True,
|
|
53
|
+
help="Show the version and exit.",
|
|
54
|
+
),
|
|
55
|
+
] = None,
|
|
56
|
+
) -> None:
|
|
57
|
+
"""Parqx: A Parquet TUI inspector."""
|
|
58
|
+
_ = version
|
|
59
|
+
|
|
60
|
+
setup_logging(verbose)
|
|
61
|
+
|
|
62
|
+
table = pq.read_table(path) # type: ignore
|
|
63
|
+
ParqxApp(table).run()
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""The Parqx logging configuration."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
from logging.handlers import RotatingFileHandler
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from platformdirs import user_log_dir
|
|
8
|
+
from textual.logging import TextualHandler
|
|
9
|
+
|
|
10
|
+
_LOGGER_NAME = "parqx"
|
|
11
|
+
_LOG_FILE_NAME = "parqx.log"
|
|
12
|
+
_LOG_FILE_MAX_BYTES = 5 * 1024 * 1024 # 5 MiB
|
|
13
|
+
_LOG_FILE_BACKUP_COUNT = 3
|
|
14
|
+
_FILE_FORMAT = "%(asctime)s %(levelname)-8s %(name)s:%(lineno)d %(message)s"
|
|
15
|
+
_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _verbosity_to_level(verbose: int) -> int:
|
|
19
|
+
"""Map the `--verbose` count to a `logging` level."""
|
|
20
|
+
if verbose <= 0:
|
|
21
|
+
return logging.WARNING
|
|
22
|
+
if verbose == 1:
|
|
23
|
+
return logging.INFO
|
|
24
|
+
return logging.DEBUG
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _log_file_path() -> Path:
|
|
28
|
+
"""Return the rotating log file path under the platform user log directory."""
|
|
29
|
+
log_dir = Path(user_log_dir("parqx", appauthor=False, ensure_exists=True))
|
|
30
|
+
return log_dir / _LOG_FILE_NAME
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def setup_logging(verbose: int = 0) -> None:
|
|
34
|
+
r"""Configure logging for the Parqx application.
|
|
35
|
+
|
|
36
|
+
A TUI takes over the terminal, so log records must never reach `stdout` or
|
|
37
|
+
`stderr` while the app is running. This function installs two handlers on
|
|
38
|
+
the `parqx` logger:
|
|
39
|
+
|
|
40
|
+
- A `RotatingFileHandler` writing detailed records to a log file under
|
|
41
|
+
the platform user log directory (e.g. `%LOCALAPPDATA%\\parqx\\Logs\\parqx.log`
|
|
42
|
+
on Windows, `~/.local/state/parqx/log/parqx.log` on Linux).
|
|
43
|
+
- A `TextualHandler` so `logger.*` calls are also visible in `textual console`
|
|
44
|
+
during development.
|
|
45
|
+
|
|
46
|
+
Propagation to the root logger is disabled so records can't accidentally
|
|
47
|
+
leak to `stderr` and corrupt the TUI. The function is idempotent - calling
|
|
48
|
+
it again replaces the previously installed handlers.
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
verbose: Verbosity count from the CLI (`-v` once, `-vv` twice, ...).
|
|
52
|
+
0 maps to `WARNING`, 1 to `INFO`, 2+ to `DEBUG`.
|
|
53
|
+
"""
|
|
54
|
+
level = _verbosity_to_level(verbose)
|
|
55
|
+
log_file = _log_file_path()
|
|
56
|
+
|
|
57
|
+
logger = logging.getLogger(_LOGGER_NAME)
|
|
58
|
+
logger.setLevel(level)
|
|
59
|
+
logger.propagate = False
|
|
60
|
+
|
|
61
|
+
for existing in logger.handlers:
|
|
62
|
+
logger.removeHandler(existing)
|
|
63
|
+
existing.close()
|
|
64
|
+
|
|
65
|
+
file_handler = RotatingFileHandler(
|
|
66
|
+
log_file,
|
|
67
|
+
maxBytes=_LOG_FILE_MAX_BYTES,
|
|
68
|
+
backupCount=_LOG_FILE_BACKUP_COUNT,
|
|
69
|
+
encoding="utf-8",
|
|
70
|
+
delay=True,
|
|
71
|
+
)
|
|
72
|
+
file_handler.setLevel(level)
|
|
73
|
+
file_handler.setFormatter(logging.Formatter(_FILE_FORMAT, datefmt=_DATE_FORMAT))
|
|
74
|
+
logger.addHandler(file_handler)
|
|
75
|
+
|
|
76
|
+
logger.addHandler(TextualHandler())
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""The Parqx TUI package."""
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""The Parqx Textual App."""
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
import pyarrow as pa
|
|
6
|
+
from textual.app import App, ComposeResult
|
|
7
|
+
|
|
8
|
+
from parqx.tui.widgets import ArrowTable
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ParqxApp(App[Any]):
|
|
12
|
+
"""A Textual App for Parqx."""
|
|
13
|
+
|
|
14
|
+
def __init__(self, table: pa.Table) -> None:
|
|
15
|
+
"""Initialize the app with an Arrow table to inspect.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
table: Arrow table displayed by the main table widget.
|
|
19
|
+
"""
|
|
20
|
+
super().__init__()
|
|
21
|
+
self._table = table
|
|
22
|
+
|
|
23
|
+
def compose(self) -> ComposeResult:
|
|
24
|
+
"""Yield child widgets for the app."""
|
|
25
|
+
yield ArrowTable(self._table)
|