icelens 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 (73) hide show
  1. icelens-0.1.0/.gitignore +26 -0
  2. icelens-0.1.0/LICENSE +202 -0
  3. icelens-0.1.0/PKG-INFO +174 -0
  4. icelens-0.1.0/README.md +136 -0
  5. icelens-0.1.0/pyproject.toml +121 -0
  6. icelens-0.1.0/src/icelens/__init__.py +0 -0
  7. icelens-0.1.0/src/icelens/app.py +1260 -0
  8. icelens-0.1.0/src/icelens/catalog.py +3517 -0
  9. icelens-0.1.0/src/icelens/cli.py +922 -0
  10. icelens-0.1.0/src/icelens/demo.py +183 -0
  11. icelens-0.1.0/src/icelens/format.py +201 -0
  12. icelens-0.1.0/src/icelens/icelens.tcss +155 -0
  13. icelens-0.1.0/src/icelens/model.py +1029 -0
  14. icelens-0.1.0/src/icelens/opaque.py +102 -0
  15. icelens-0.1.0/src/icelens/rest.py +1414 -0
  16. icelens-0.1.0/src/icelens/skills/icelens/SKILL.md +124 -0
  17. icelens-0.1.0/src/icelens/terms.py +848 -0
  18. icelens-0.1.0/src/icelens/trace.py +242 -0
  19. icelens-0.1.0/src/icelens/welcome.py +159 -0
  20. icelens-0.1.0/tests/compose/live.env +18 -0
  21. icelens-0.1.0/tests/compose/stack.yml +144 -0
  22. icelens-0.1.0/tests/conftest.py +390 -0
  23. icelens-0.1.0/tests/harness.py +54 -0
  24. icelens-0.1.0/tests/headless.py +93 -0
  25. icelens-0.1.0/tests/live.py +262 -0
  26. icelens-0.1.0/tests/offline.py +99 -0
  27. icelens-0.1.0/tests/polaris.py +218 -0
  28. icelens-0.1.0/tests/snapshots/help-end.txt +40 -0
  29. icelens-0.1.0/tests/snapshots/help.txt +40 -0
  30. icelens-0.1.0/tests/snapshots/schema-narrow.txt +20 -0
  31. icelens-0.1.0/tests/snapshots/schema.txt +34 -0
  32. icelens-0.1.0/tests/snapshots/welcome-first-run.txt +34 -0
  33. icelens-0.1.0/tests/snapshots/welcome-with-sandboxes.txt +34 -0
  34. icelens-0.1.0/tests/snapshots/welcome-without-v3.txt +34 -0
  35. icelens-0.1.0/tests/snapshots/writer.txt +34 -0
  36. icelens-0.1.0/tests/snapshots.py +54 -0
  37. icelens-0.1.0/tests/stub.py +84 -0
  38. icelens-0.1.0/tests/test_app.py +524 -0
  39. icelens-0.1.0/tests/test_app_paths.py +502 -0
  40. icelens-0.1.0/tests/test_arguments.py +555 -0
  41. icelens-0.1.0/tests/test_arrow_sql.py +261 -0
  42. icelens-0.1.0/tests/test_attach.py +432 -0
  43. icelens-0.1.0/tests/test_build_site.py +224 -0
  44. icelens-0.1.0/tests/test_catalog.py +353 -0
  45. icelens-0.1.0/tests/test_cli.py +665 -0
  46. icelens-0.1.0/tests/test_connecting.py +201 -0
  47. icelens-0.1.0/tests/test_driving.py +542 -0
  48. icelens-0.1.0/tests/test_first_run.py +353 -0
  49. icelens-0.1.0/tests/test_format.py +127 -0
  50. icelens-0.1.0/tests/test_hardening.py +670 -0
  51. icelens-0.1.0/tests/test_json_contract.py +735 -0
  52. icelens-0.1.0/tests/test_ledger.py +214 -0
  53. icelens-0.1.0/tests/test_model.py +244 -0
  54. icelens-0.1.0/tests/test_offline.py +238 -0
  55. icelens-0.1.0/tests/test_opaque.py +62 -0
  56. icelens-0.1.0/tests/test_packaging.py +204 -0
  57. icelens-0.1.0/tests/test_panes.py +222 -0
  58. icelens-0.1.0/tests/test_polaris.py +271 -0
  59. icelens-0.1.0/tests/test_properties.py +739 -0
  60. icelens-0.1.0/tests/test_rest_catalog.py +962 -0
  61. icelens-0.1.0/tests/test_routes.py +739 -0
  62. icelens-0.1.0/tests/test_sandbox.py +724 -0
  63. icelens-0.1.0/tests/test_serve.py +233 -0
  64. icelens-0.1.0/tests/test_skill.py +81 -0
  65. icelens-0.1.0/tests/test_snapshots.py +106 -0
  66. icelens-0.1.0/tests/test_terms.py +169 -0
  67. icelens-0.1.0/tests/test_trace.py +258 -0
  68. icelens-0.1.0/tests/test_v3_sandbox.py +300 -0
  69. icelens-0.1.0/tests/test_views.py +214 -0
  70. icelens-0.1.0/tests/test_walk.py +329 -0
  71. icelens-0.1.0/tests/test_walk_page.py +113 -0
  72. icelens-0.1.0/tests/walk_page.mjs +89 -0
  73. icelens-0.1.0/uv.lock +1773 -0
@@ -0,0 +1,26 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ dist/
7
+ *.egg-info/
8
+ icelens-*.csv
9
+ .coverage
10
+ .coverage.*
11
+ coverage.xml
12
+ htmlcov/
13
+ .hypothesis/
14
+
15
+ # Each person's own agent state; the shared configuration is committed beside it.
16
+ .claude/settings.local.json
17
+ .claude/worktrees/
18
+ .aider*
19
+ !.aider.conf.yml
20
+
21
+ # The website, built by scripts/build_site.py
22
+ _site/
23
+
24
+ # A .env holds a catalog's token and keys (the guide says to keep them there); never commit one.
25
+ .env
26
+ .env.*
icelens-0.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
icelens-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,174 @@
1
+ Metadata-Version: 2.5
2
+ Name: icelens
3
+ Version: 0.1.0
4
+ Summary: Learn Apache Iceberg, and inspect your production Iceberg tables, from the terminal: snapshots, manifests, files and rows, as of any commit.
5
+ Project-URL: Homepage, https://icelens.harkanwal.nz/
6
+ Project-URL: Documentation, https://icelens.harkanwal.nz/docs/
7
+ Project-URL: Source, https://github.com/harkanwals/icelens
8
+ Project-URL: Issues, https://github.com/harkanwals/icelens/issues
9
+ Author: harkanwals
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: apache-iceberg,duckdb,iceberg,lakehouse,pyiceberg,textual,tui
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Database
24
+ Requires-Python: >=3.10
25
+ Requires-Dist: duckdb<2,>=1.5.5
26
+ Requires-Dist: pyarrow>=18
27
+ Requires-Dist: pyiceberg[pyarrow,sql-sqlite]<0.13,>=0.12
28
+ Requires-Dist: textual<9,>=8
29
+ Provides-Extra: dev
30
+ Requires-Dist: hypothesis>=6.100; extra == 'dev'
31
+ Requires-Dist: pyright[nodejs]>=1.1.400; extra == 'dev'
32
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
33
+ Requires-Dist: pytest-cov>=5; extra == 'dev'
34
+ Requires-Dist: pytest-timeout>=2.3; extra == 'dev'
35
+ Requires-Dist: pytest>=8; extra == 'dev'
36
+ Requires-Dist: ruff>=0.14; extra == 'dev'
37
+ Description-Content-Type: text/markdown
38
+
39
+ # icelens
40
+
41
+ A terminal app for Apache Iceberg tables. It shows what a table is made of - its commits
42
+ (snapshots), the manifests and data and delete files each one points at, and the rows - as of any
43
+ commit you pick. Use it for two things:
44
+
45
+ - **Learn Iceberg.** `uvx icelens --demo` opens a local table with five commits, nothing to
46
+ configure, and a guide beside every pane explains what the cursor is on.
47
+ - **Inspect your production tables.** Point it at your catalog to see why a table has the files it
48
+ has, what a commit changed, and what the rows were before it. It only reads your catalog.
49
+
50
+ ## Install
51
+
52
+ ```bash
53
+ uv tool install icelens # or: pipx install icelens
54
+ icelens --version
55
+ ```
56
+
57
+ Python 3.10 or newer. Glue, S3 Tables, Hive and DynamoDB need PyIceberg's extra for each:
58
+ `uv tool install icelens --with 'pyiceberg[glue]'` (or `[hive]`, `[dynamodb]`).
59
+
60
+ Rows are read with DuckDB's iceberg extension, which icelens fetches on first use. Without a
61
+ network the metadata panes still work and rows come from PyIceberg; the status bar always says
62
+ which engine answered.
63
+
64
+ ## Start
65
+
66
+ ```bash
67
+ icelens --demo # a local catalog with one table and five commits to explore
68
+ icelens # the catalog this directory or ~/.pyiceberg.yaml is set up for
69
+ icelens demo.orders # straight onto a table
70
+ icelens --uri http://localhost:8181/catalog --warehouse demo
71
+ ```
72
+
73
+ With nothing configured, `icelens` asks what to open instead of failing.
74
+
75
+ ## Connect to your catalog
76
+
77
+ icelens reads the same `~/.pyiceberg.yaml` PyIceberg does. One entry per catalog:
78
+
79
+ ```yaml
80
+ catalog:
81
+ lab: # icelens --catalog lab
82
+ type: rest
83
+ uri: http://localhost:8181/catalog
84
+ warehouse: analytics
85
+ glue:
86
+ type: glue
87
+ warehouse: s3://my-bucket/warehouse # credentials from the usual AWS chain
88
+ ```
89
+
90
+ `icelens --catalogs` lists them and `ctrl+o` switches between them in the app. You can also pass
91
+ `--uri`, `--warehouse` and `-p key=value` (any PyIceberg property), set `ICELENS_*` variables, or
92
+ keep the settings in a `.env`. Keep secrets out of the YAML file: use PyIceberg's environment
93
+ variables or a `.env` only you can read. icelens never prints a credential.
94
+
95
+ A REST catalog with several warehouses (Lakekeeper, Polaris) gets a picker, and `ctrl+w` switches
96
+ warehouse. Recipes for Polaris, Snowflake, Databricks and BigLake are in the
97
+ [guide](https://icelens.harkanwal.nz/docs/#oauth-catalogs-polaris-snowflake-databricks).
98
+
99
+ ## What you see
100
+
101
+ | key | pane | what it answers |
102
+ |---|---|---|
103
+ | 1 | Overview | format version, location, refs, properties |
104
+ | 2 | Schema | the schema at the viewed snapshot, with field ids |
105
+ | 3 | Data | the rows; `w` filters them, `l` shows v3 row lineage |
106
+ | 4 | Snapshots | every commit; enter pins one and every pane re-reads at it |
107
+ | 5 | Commit | the files one snapshot added and retired |
108
+ | 6 | Manifests | the manifest list, one row per manifest |
109
+ | 7 | Files | every live data and delete file |
110
+ | 8 | Partitions | partitions with file and row counts |
111
+ | 9 | Layout | the chain from table metadata down to files |
112
+ | 0 | SQL | DuckDB SQL over the catalog: `icelens."<namespace>"."<table>"` |
113
+
114
+ `u` returns to the current snapshot, `,` and `.` step through history, `g` cycles the guide rail
115
+ that explains whatever the cursor is on, and `?` shows every key. Views appear in the tree beside
116
+ the tables.
117
+
118
+ icelens only reads a real catalog: it opens the connection read-only.
119
+
120
+ ## A sandbox to write in
121
+
122
+ ```bash
123
+ icelens --sandbox # a local catalog you can write to; `e` opens the Writer pane
124
+ icelens --sandbox lesson --v3 # the same at format-version 3: deletion vectors, row lineage
125
+ icelens --demo --v3 --serve # serve it over Iceberg REST for Spark, DuckDB or PyIceberg
126
+ ```
127
+
128
+ Write `CREATE`, `INSERT` and `DELETE` statements and see what each commit did to the table. See
129
+ the [guide](https://icelens.harkanwal.nz/docs/#the-sandbox).
130
+
131
+ ## In scripts
132
+
133
+ Every pane prints, as a table, CSV or JSON:
134
+
135
+ ```bash
136
+ icelens --list demo
137
+ icelens --pane snapshots demo.orders
138
+ icelens --pane files demo.orders --json
139
+ icelens --sql 'SELECT count(*) FROM icelens."demo"."orders"'
140
+ ```
141
+
142
+ - These read the catalog you have configured. Add `--demo` to try them without one.
143
+ - `--sql` refuses anything that writes, and any table that is not the catalog's. It is still
144
+ DuckDB, which can read local files and URLs, so run only SQL you have read. The
145
+ [guide](https://icelens.harkanwal.nz/docs/#--sql) says what is checked.
146
+ - Exit codes: `0` fine, `1` refused by the catalog or the query, `2` bad usage.
147
+ - The `--json` format is in the [guide](https://icelens.harkanwal.nz/docs/#--json).
148
+
149
+ ## With a coding agent
150
+
151
+ icelens ships an [Agent Skill](https://agentskills.io) that teaches a coding agent to drive it
152
+ through the headless flags. Install it where your agent looks for skills. For Claude Code:
153
+
154
+ ```bash
155
+ mkdir -p ~/.claude/skills/icelens && icelens --skill > ~/.claude/skills/icelens/SKILL.md
156
+ ```
157
+
158
+ `icelens --skill` prints the skill for the installed version, so rerun it after an upgrade.
159
+
160
+ ## Where it works
161
+
162
+ Tested against Iceberg REST (Lakekeeper, Apache Polaris), Google BigLake and local SQL catalogs.
163
+ Snowflake, Databricks Unity, Nessie, Glue, S3 Tables and Hive are supported in code but have not
164
+ been run against a real account. Linux and macOS only for now: local catalogs do not work on
165
+ Windows yet. [Platforms](https://icelens.harkanwal.nz/docs/platforms.html) says what each needs and what has
166
+ been verified, and [Limitations](https://icelens.harkanwal.nz/docs/#limitations) lists what does not work yet.
167
+
168
+ ## More
169
+
170
+ - [The guide](https://icelens.harkanwal.nz/docs/): every pane, key and flag.
171
+ - [Platforms](https://icelens.harkanwal.nz/docs/platforms.html): connecting to each catalog, and what to do when it fails.
172
+ - [Contributing](https://github.com/harkanwals/icelens/blob/main/CONTRIBUTING.md): how icelens is built and tested.
173
+
174
+ Apache-2.0.
@@ -0,0 +1,136 @@
1
+ # icelens
2
+
3
+ A terminal app for Apache Iceberg tables. It shows what a table is made of - its commits
4
+ (snapshots), the manifests and data and delete files each one points at, and the rows - as of any
5
+ commit you pick. Use it for two things:
6
+
7
+ - **Learn Iceberg.** `uvx icelens --demo` opens a local table with five commits, nothing to
8
+ configure, and a guide beside every pane explains what the cursor is on.
9
+ - **Inspect your production tables.** Point it at your catalog to see why a table has the files it
10
+ has, what a commit changed, and what the rows were before it. It only reads your catalog.
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ uv tool install icelens # or: pipx install icelens
16
+ icelens --version
17
+ ```
18
+
19
+ Python 3.10 or newer. Glue, S3 Tables, Hive and DynamoDB need PyIceberg's extra for each:
20
+ `uv tool install icelens --with 'pyiceberg[glue]'` (or `[hive]`, `[dynamodb]`).
21
+
22
+ Rows are read with DuckDB's iceberg extension, which icelens fetches on first use. Without a
23
+ network the metadata panes still work and rows come from PyIceberg; the status bar always says
24
+ which engine answered.
25
+
26
+ ## Start
27
+
28
+ ```bash
29
+ icelens --demo # a local catalog with one table and five commits to explore
30
+ icelens # the catalog this directory or ~/.pyiceberg.yaml is set up for
31
+ icelens demo.orders # straight onto a table
32
+ icelens --uri http://localhost:8181/catalog --warehouse demo
33
+ ```
34
+
35
+ With nothing configured, `icelens` asks what to open instead of failing.
36
+
37
+ ## Connect to your catalog
38
+
39
+ icelens reads the same `~/.pyiceberg.yaml` PyIceberg does. One entry per catalog:
40
+
41
+ ```yaml
42
+ catalog:
43
+ lab: # icelens --catalog lab
44
+ type: rest
45
+ uri: http://localhost:8181/catalog
46
+ warehouse: analytics
47
+ glue:
48
+ type: glue
49
+ warehouse: s3://my-bucket/warehouse # credentials from the usual AWS chain
50
+ ```
51
+
52
+ `icelens --catalogs` lists them and `ctrl+o` switches between them in the app. You can also pass
53
+ `--uri`, `--warehouse` and `-p key=value` (any PyIceberg property), set `ICELENS_*` variables, or
54
+ keep the settings in a `.env`. Keep secrets out of the YAML file: use PyIceberg's environment
55
+ variables or a `.env` only you can read. icelens never prints a credential.
56
+
57
+ A REST catalog with several warehouses (Lakekeeper, Polaris) gets a picker, and `ctrl+w` switches
58
+ warehouse. Recipes for Polaris, Snowflake, Databricks and BigLake are in the
59
+ [guide](https://icelens.harkanwal.nz/docs/#oauth-catalogs-polaris-snowflake-databricks).
60
+
61
+ ## What you see
62
+
63
+ | key | pane | what it answers |
64
+ |---|---|---|
65
+ | 1 | Overview | format version, location, refs, properties |
66
+ | 2 | Schema | the schema at the viewed snapshot, with field ids |
67
+ | 3 | Data | the rows; `w` filters them, `l` shows v3 row lineage |
68
+ | 4 | Snapshots | every commit; enter pins one and every pane re-reads at it |
69
+ | 5 | Commit | the files one snapshot added and retired |
70
+ | 6 | Manifests | the manifest list, one row per manifest |
71
+ | 7 | Files | every live data and delete file |
72
+ | 8 | Partitions | partitions with file and row counts |
73
+ | 9 | Layout | the chain from table metadata down to files |
74
+ | 0 | SQL | DuckDB SQL over the catalog: `icelens."<namespace>"."<table>"` |
75
+
76
+ `u` returns to the current snapshot, `,` and `.` step through history, `g` cycles the guide rail
77
+ that explains whatever the cursor is on, and `?` shows every key. Views appear in the tree beside
78
+ the tables.
79
+
80
+ icelens only reads a real catalog: it opens the connection read-only.
81
+
82
+ ## A sandbox to write in
83
+
84
+ ```bash
85
+ icelens --sandbox # a local catalog you can write to; `e` opens the Writer pane
86
+ icelens --sandbox lesson --v3 # the same at format-version 3: deletion vectors, row lineage
87
+ icelens --demo --v3 --serve # serve it over Iceberg REST for Spark, DuckDB or PyIceberg
88
+ ```
89
+
90
+ Write `CREATE`, `INSERT` and `DELETE` statements and see what each commit did to the table. See
91
+ the [guide](https://icelens.harkanwal.nz/docs/#the-sandbox).
92
+
93
+ ## In scripts
94
+
95
+ Every pane prints, as a table, CSV or JSON:
96
+
97
+ ```bash
98
+ icelens --list demo
99
+ icelens --pane snapshots demo.orders
100
+ icelens --pane files demo.orders --json
101
+ icelens --sql 'SELECT count(*) FROM icelens."demo"."orders"'
102
+ ```
103
+
104
+ - These read the catalog you have configured. Add `--demo` to try them without one.
105
+ - `--sql` refuses anything that writes, and any table that is not the catalog's. It is still
106
+ DuckDB, which can read local files and URLs, so run only SQL you have read. The
107
+ [guide](https://icelens.harkanwal.nz/docs/#--sql) says what is checked.
108
+ - Exit codes: `0` fine, `1` refused by the catalog or the query, `2` bad usage.
109
+ - The `--json` format is in the [guide](https://icelens.harkanwal.nz/docs/#--json).
110
+
111
+ ## With a coding agent
112
+
113
+ icelens ships an [Agent Skill](https://agentskills.io) that teaches a coding agent to drive it
114
+ through the headless flags. Install it where your agent looks for skills. For Claude Code:
115
+
116
+ ```bash
117
+ mkdir -p ~/.claude/skills/icelens && icelens --skill > ~/.claude/skills/icelens/SKILL.md
118
+ ```
119
+
120
+ `icelens --skill` prints the skill for the installed version, so rerun it after an upgrade.
121
+
122
+ ## Where it works
123
+
124
+ Tested against Iceberg REST (Lakekeeper, Apache Polaris), Google BigLake and local SQL catalogs.
125
+ Snowflake, Databricks Unity, Nessie, Glue, S3 Tables and Hive are supported in code but have not
126
+ been run against a real account. Linux and macOS only for now: local catalogs do not work on
127
+ Windows yet. [Platforms](https://icelens.harkanwal.nz/docs/platforms.html) says what each needs and what has
128
+ been verified, and [Limitations](https://icelens.harkanwal.nz/docs/#limitations) lists what does not work yet.
129
+
130
+ ## More
131
+
132
+ - [The guide](https://icelens.harkanwal.nz/docs/): every pane, key and flag.
133
+ - [Platforms](https://icelens.harkanwal.nz/docs/platforms.html): connecting to each catalog, and what to do when it fails.
134
+ - [Contributing](https://github.com/harkanwals/icelens/blob/main/CONTRIBUTING.md): how icelens is built and tested.
135
+
136
+ Apache-2.0.
@@ -0,0 +1,121 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "icelens"
7
+ version = "0.1.0"
8
+ description = "Learn Apache Iceberg, and inspect your production Iceberg tables, from the terminal: snapshots, manifests, files and rows, as of any commit."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "Apache-2.0"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "harkanwals" }]
14
+ keywords = ["iceberg", "apache-iceberg", "tui", "textual", "duckdb", "pyiceberg", "lakehouse"]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Environment :: Console",
18
+ "Intended Audience :: Developers",
19
+ # Not "OS Independent": local catalogs and sandboxes do not work on Windows yet (docs/PLATFORMS.md).
20
+ "Operating System :: MacOS",
21
+ "Operating System :: POSIX :: Linux",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Programming Language :: Python :: 3.13",
27
+ "Topic :: Database",
28
+ ]
29
+
30
+ # Every floor here is tested: CI's `minimums` job installs exactly these lowest versions and runs
31
+ # the suite. They used to be guesses, and at the guessed floors the suite failed on its second
32
+ # test (PyIceberg 0.10's snapshots), and DuckDB 1.4 called a function NumPy 2 removed.
33
+ dependencies = [
34
+ # Textual's widget API is stable within a major version; the ceiling is narrow on purpose.
35
+ "textual>=8,<9",
36
+ # Metadata for every catalog dialect (REST, Glue, Hive, SQL), and the scan fallback
37
+ # used when DuckDB cannot attach. sql-sqlite is not optional: --sandbox builds its
38
+ # own catalog in a SQLite file, so without it the sandbox cannot open at all.
39
+ "pyiceberg[pyarrow,sql-sqlite]>=0.12,<0.13",
40
+ # Scanning, the SQL pane and every sandbox write. 1.5.5 is the release the suite and the
41
+ # v3 sandbox (deletion vectors, MERGE) were built against; the canary job tries newer ones.
42
+ # The ceiling is load-bearing: DuckDB 2.0 dropped `.arrow()` on a relation, which every
43
+ # sandbox CREATE uses, and pip, pipx and `uv tool install` ignore uv.lock. Lift it only
44
+ # once the suite passes on 2.x.
45
+ "duckdb>=1.5.5,<2",
46
+ # PyIceberg 0.12's own floor.
47
+ "pyarrow>=18",
48
+ ]
49
+
50
+ [project.optional-dependencies]
51
+ # The hermetic catalog the tests run against ships with the sandbox now, above.
52
+ # hypothesis drives the property tests over the quoting, guarding and scrubbing functions;
53
+ # pytest-cov is how CI says which branches nothing has reached; pytest-timeout turns a hang into a failure.
54
+ dev = [
55
+ "pytest>=8",
56
+ "pytest-asyncio>=0.24",
57
+ "pytest-cov>=5",
58
+ "hypothesis>=6.100",
59
+ "ruff>=0.14",
60
+ "pyright[nodejs]>=1.1.400",
61
+ "pytest-timeout>=2.3",
62
+ ]
63
+
64
+ [project.scripts]
65
+ icelens = "icelens.cli:main"
66
+
67
+ [project.urls]
68
+ Homepage = "https://icelens.harkanwal.nz/"
69
+ Documentation = "https://icelens.harkanwal.nz/docs/"
70
+ Source = "https://github.com/harkanwals/icelens"
71
+ Issues = "https://github.com/harkanwals/icelens/issues"
72
+
73
+ [tool.hatch.build.targets.wheel]
74
+ packages = ["src/icelens"]
75
+
76
+ # Only what building and testing from source needs. Without this list hatchling takes every
77
+ # file git does not ignore, so an untracked note or an agent's config folder would ship.
78
+ [tool.hatch.build.targets.sdist]
79
+ only-include = ["src", "tests", "LICENSE", "README.md", "pyproject.toml", "uv.lock"]
80
+
81
+ [tool.ruff]
82
+ line-length = 120
83
+ target-version = "py310"
84
+
85
+ [tool.ruff.lint]
86
+ select = ["E", "F", "I", "B", "UP"]
87
+ ignore = ["E501"]
88
+
89
+ [tool.pytest.ini_options]
90
+ testpaths = ["tests"]
91
+ asyncio_mode = "auto"
92
+ addopts = "--strict-markers"
93
+ # No single test takes a minute; one that blocks (a --serve that never stops, a socket that never
94
+ # answers) fails at five rather than holding CI until the runner gives up.
95
+ timeout = 300
96
+ markers = [
97
+ "duckdb_extensions: needs DuckDB's iceberg, httpfs and aws extensions; skipped when they will not load, failed instead under ICELENS_REQUIRE_DUCKDB_EXTENSIONS=1",
98
+ "slow: takes more than a few seconds; deselect with -m 'not slow'",
99
+ "packaging: builds and installs the distribution; runs only with ICELENS_TEST_PACKAGING=1",
100
+ ]
101
+
102
+ [tool.coverage.run]
103
+ branch = true
104
+ source = ["icelens"]
105
+
106
+ [tool.coverage.report]
107
+ show_missing = true
108
+ skip_covered = false
109
+ exclude_also = ["if __name__ == .__main__.:"]
110
+
111
+ [tool.pyright]
112
+ # The package and the setup script, in basic mode, with no errors allowed (CI's lint job). The
113
+ # tests are left out for now: most of what basic mode says about them is Textual's query API
114
+ # returning `Widget` and fixtures annotated with what they yield; none of it was a bug.
115
+ include = ["src", "scripts"]
116
+ pythonVersion = "3.10"
117
+ typeCheckingMode = "basic"
118
+ # The tests import their helpers (live, polaris, offline, ...) as top-level modules, as pytest does.
119
+ extraPaths = ["tests"]
120
+ venvPath = "."
121
+ venv = ".venv"
File without changes