csvsql 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.
csvsql-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Markus Kim
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.
@@ -0,0 +1,3 @@
1
+ include LICENSE
2
+ include README.md
3
+ recursive-include csvsql/static *
csvsql-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,75 @@
1
+ Metadata-Version: 2.4
2
+ Name: csvsql
3
+ Version: 0.1.0
4
+ Summary: A browser-based CSV database with SQL query support
5
+ Author: Markus Kim
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/markuskimius/csvsql
8
+ Project-URL: Repository, https://github.com/markuskimius/csvsql
9
+ Keywords: csv,sql,database,browser
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Web Environment
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: End Users/Desktop
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Database
16
+ Classifier: Topic :: Utilities
17
+ Requires-Python: >=3.8
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Dynamic: license-file
21
+
22
+ # CSVSQL
23
+
24
+ A browser-based database that uses CSV files as storage. Open CSV files as tables, run SQL queries against them, and edit data inline — all in a multi-window interface with no server or build step required.
25
+
26
+ ## Features
27
+
28
+ - **CSV as database tables** — Each CSV file is a table. Open multiple files and query across them.
29
+ - **SQL queries** — Write and execute SQL from the built-in console (powered by [AlaSQL](https://github.com/AlaSQL/alasql)). Each query result opens in its own window.
30
+ - **Inline editing** — Click any cell to edit. Tab/Enter to navigate, Escape to cancel.
31
+ - **Sort and filter** — Click column headers to sort. Use the filter bar to search across all columns.
32
+ - **Multi-window workspace** — Every table and query result lives in its own draggable, resizable subwindow. Arrange them with Tile, Grid, or Cascade layouts.
33
+ - **Row management** — Add/delete rows, insert rows at any position (right-click row numbers), add new columns.
34
+ - **Save** — Export any table or query result back to CSV.
35
+
36
+ ## Getting Started
37
+
38
+ No dependencies to install. Just serve the files or open directly:
39
+
40
+ ```sh
41
+ # Option 1: any static file server
42
+ python3 -m http.server 8000
43
+ # then open http://localhost:8000
44
+
45
+ # Option 2: open directly
46
+ open index.html
47
+ ```
48
+
49
+ Use **File > Open CSV** to load a CSV file (a `sample.csv` is included), or **File > New Table** to create one from scratch.
50
+
51
+ ## SQL Console
52
+
53
+ The console sits at the bottom of the window. Type a query and press **Ctrl+Enter** (or click Run) to execute.
54
+
55
+ ```sql
56
+ -- Query a loaded table by its filename (minus extension)
57
+ SELECT * FROM sample WHERE name LIKE 'A%'
58
+
59
+ -- Aggregate queries
60
+ SELECT department, AVG(salary) as avg_salary FROM employees GROUP BY department
61
+
62
+ -- Join across tables
63
+ SELECT a.name, b.value FROM table1 a JOIN table2 b ON a.id = b.id
64
+ ```
65
+
66
+ Table names are derived from the CSV filename (e.g., `employees.csv` becomes `employees`).
67
+
68
+ ## Keyboard Shortcuts
69
+
70
+ | Key | Action |
71
+ |---|---|
72
+ | Ctrl+Enter | Execute SQL query |
73
+ | Tab / Shift+Tab | Navigate between cells in a row |
74
+ | Enter | Move to next row (same column) |
75
+ | Escape | Cancel cell edit |
csvsql-0.1.0/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # CSVSQL
2
+
3
+ A browser-based database that uses CSV files as storage. Open CSV files as tables, run SQL queries against them, and edit data inline — all in a multi-window interface with no server or build step required.
4
+
5
+ ## Features
6
+
7
+ - **CSV as database tables** — Each CSV file is a table. Open multiple files and query across them.
8
+ - **SQL queries** — Write and execute SQL from the built-in console (powered by [AlaSQL](https://github.com/AlaSQL/alasql)). Each query result opens in its own window.
9
+ - **Inline editing** — Click any cell to edit. Tab/Enter to navigate, Escape to cancel.
10
+ - **Sort and filter** — Click column headers to sort. Use the filter bar to search across all columns.
11
+ - **Multi-window workspace** — Every table and query result lives in its own draggable, resizable subwindow. Arrange them with Tile, Grid, or Cascade layouts.
12
+ - **Row management** — Add/delete rows, insert rows at any position (right-click row numbers), add new columns.
13
+ - **Save** — Export any table or query result back to CSV.
14
+
15
+ ## Getting Started
16
+
17
+ No dependencies to install. Just serve the files or open directly:
18
+
19
+ ```sh
20
+ # Option 1: any static file server
21
+ python3 -m http.server 8000
22
+ # then open http://localhost:8000
23
+
24
+ # Option 2: open directly
25
+ open index.html
26
+ ```
27
+
28
+ Use **File > Open CSV** to load a CSV file (a `sample.csv` is included), or **File > New Table** to create one from scratch.
29
+
30
+ ## SQL Console
31
+
32
+ The console sits at the bottom of the window. Type a query and press **Ctrl+Enter** (or click Run) to execute.
33
+
34
+ ```sql
35
+ -- Query a loaded table by its filename (minus extension)
36
+ SELECT * FROM sample WHERE name LIKE 'A%'
37
+
38
+ -- Aggregate queries
39
+ SELECT department, AVG(salary) as avg_salary FROM employees GROUP BY department
40
+
41
+ -- Join across tables
42
+ SELECT a.name, b.value FROM table1 a JOIN table2 b ON a.id = b.id
43
+ ```
44
+
45
+ Table names are derived from the CSV filename (e.g., `employees.csv` becomes `employees`).
46
+
47
+ ## Keyboard Shortcuts
48
+
49
+ | Key | Action |
50
+ |---|---|
51
+ | Ctrl+Enter | Execute SQL query |
52
+ | Tab / Shift+Tab | Navigate between cells in a row |
53
+ | Enter | Move to next row (same column) |
54
+ | Escape | Cancel cell edit |
@@ -0,0 +1,3 @@
1
+ """CSVSQL - A browser-based CSV database with SQL query support."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,5 @@
1
+ """Allow running as `python -m csvsql`."""
2
+
3
+ from .cli import main
4
+
5
+ main()
@@ -0,0 +1,58 @@
1
+ """CLI entry point — serves the CSVSQL web app and opens a browser."""
2
+
3
+ import argparse
4
+ import os
5
+ import signal
6
+ import sys
7
+ import threading
8
+ import webbrowser
9
+ from functools import partial
10
+ from http.server import HTTPServer, SimpleHTTPRequestHandler
11
+
12
+
13
+ def main():
14
+ parser = argparse.ArgumentParser(
15
+ prog="csvsql",
16
+ description="Browser-based CSV database with SQL query support.",
17
+ )
18
+ parser.add_argument(
19
+ "-p", "--port", type=int, default=8000, help="port to serve on (default: 8000)"
20
+ )
21
+ parser.add_argument(
22
+ "--no-browser", action="store_true", help="don't open a browser automatically"
23
+ )
24
+ parser.add_argument(
25
+ "--host", default="127.0.0.1", help="host to bind to (default: 127.0.0.1)"
26
+ )
27
+ args = parser.parse_args()
28
+
29
+ static_dir = os.path.join(os.path.dirname(__file__), "static")
30
+ handler = partial(SimpleHTTPRequestHandler, directory=static_dir)
31
+
32
+ # Try the requested port, increment if unavailable
33
+ port = args.port
34
+ for attempt in range(10):
35
+ try:
36
+ server = HTTPServer((args.host, port), handler)
37
+ break
38
+ except OSError:
39
+ port += 1
40
+ else:
41
+ print(f"Error: Could not find an available port.", file=sys.stderr)
42
+ sys.exit(1)
43
+
44
+ url = f"http://{args.host}:{port}"
45
+ print(f"Serving CSVSQL at {url}")
46
+ print("Press Ctrl+C to stop.")
47
+
48
+ if not args.no_browser:
49
+ threading.Timer(0.5, webbrowser.open, args=(url,)).start()
50
+
51
+ signal.signal(signal.SIGINT, lambda *_: sys.exit(0))
52
+
53
+ try:
54
+ server.serve_forever()
55
+ except KeyboardInterrupt:
56
+ pass
57
+ finally:
58
+ server.server_close()