minesql 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.
- minesql-0.1.0/LICENSE +21 -0
- minesql-0.1.0/PKG-INFO +163 -0
- minesql-0.1.0/README.md +129 -0
- minesql-0.1.0/minesql/__init__.py +11 -0
- minesql-0.1.0/minesql/cli.py +976 -0
- minesql-0.1.0/minesql.egg-info/PKG-INFO +163 -0
- minesql-0.1.0/minesql.egg-info/SOURCES.txt +11 -0
- minesql-0.1.0/minesql.egg-info/dependency_links.txt +1 -0
- minesql-0.1.0/minesql.egg-info/entry_points.txt +2 -0
- minesql-0.1.0/minesql.egg-info/requires.txt +7 -0
- minesql-0.1.0/minesql.egg-info/top_level.txt +1 -0
- minesql-0.1.0/pyproject.toml +52 -0
- minesql-0.1.0/setup.cfg +4 -0
minesql-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Akm Korishee Apurbo
|
|
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.
|
minesql-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: minesql
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A MySQL terminal that only suggests the NEXT SQL piece — schema-aware ghost-text autocomplete for your SQL sessions.
|
|
5
|
+
Author: IMApurbo
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/IMApurbo/minesql
|
|
8
|
+
Project-URL: Repository, https://github.com/IMApurbo/minesql
|
|
9
|
+
Project-URL: Issues, https://github.com/IMApurbo/minesql/issues
|
|
10
|
+
Keywords: mysql,sql,cli,autocomplete,repl,terminal,ghost-text,prompt_toolkit
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
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: Topic :: Database
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Topic :: Terminals
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: prompt_toolkit>=3.0
|
|
28
|
+
Requires-Dist: PyMySQL>=1.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
31
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
32
|
+
Requires-Dist: twine>=4.0; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# minesql
|
|
36
|
+
|
|
37
|
+
A MySQL terminal that only suggests the **next** SQL piece.
|
|
38
|
+
|
|
39
|
+
* Gray "ghost" text after your cursor = the current best suggestion
|
|
40
|
+
* `Tab` — accept the suggestion
|
|
41
|
+
* `Shift+Tab` — show the next-best suggestion
|
|
42
|
+
* `Ctrl+T` — toggle NEXT-piece mode ↔ FULL inline mode (whole query predicted)
|
|
43
|
+
* `Ctrl+O` — suggestions ON/OFF (OFF is the default at startup)
|
|
44
|
+
* `Ctrl+Space` — LIST mode ON/OFF: a live suggestion dropdown that stays open
|
|
45
|
+
and updates as you type until you toggle it off (works even when ghost
|
|
46
|
+
suggestions are OFF). `Alt+L` is an alias if `Ctrl+Space` is grabbed by your
|
|
47
|
+
terminal/OS.
|
|
48
|
+
* `Alt+/` — force ONE suggestion right here, right now (any cursor position)
|
|
49
|
+
* FULL mode: `Tab` accepts ONE word, `Ctrl+E` (or `Ctrl+Tab`, if your terminal
|
|
50
|
+
sends it) accepts the WHOLE suggestion
|
|
51
|
+
* `Enter` — run the query
|
|
52
|
+
* `Ctrl+D` — exit
|
|
53
|
+
|
|
54
|
+
Suggestions are schema-aware: database, table, and column names (plus sample
|
|
55
|
+
values) come straight from the live MySQL server via `information_schema`. A
|
|
56
|
+
small n-gram model learns from the queries you run (saved in
|
|
57
|
+
`~/.minesql_model.json`) and re-ranks suggestions so your habits float to
|
|
58
|
+
the top.
|
|
59
|
+
|
|
60
|
+
## Install
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install minesql
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Usage
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
minesql -H 127.0.0.1 -u root -d mydb
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
usage: minesql [-h] [-H HOST] [-P PORT] [-u USER] [-p PASSWORD] [-d DATABASE]
|
|
74
|
+
[--suggest] [--full] [--no-confirm] [--no-values]
|
|
75
|
+
|
|
76
|
+
MySQL terminal with schema-aware ghost-text SQL suggestions.
|
|
77
|
+
|
|
78
|
+
options:
|
|
79
|
+
-h, --help show this help message and exit
|
|
80
|
+
-H HOST, --host HOST
|
|
81
|
+
-P PORT, --port PORT
|
|
82
|
+
-u USER, --user USER
|
|
83
|
+
-p PASSWORD, --password PASSWORD
|
|
84
|
+
-d DATABASE, --database DATABASE
|
|
85
|
+
database to start in
|
|
86
|
+
--suggest start with suggestions ON (default is OFF)
|
|
87
|
+
--full start with FULL inline suggestions ON
|
|
88
|
+
--no-confirm don't ask before DELETE/UPDATE without WHERE, DROP, TRUNCATE
|
|
89
|
+
--no-values don't sample column values for suggestions (faster on huge tables)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Examples
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
minesql -u root -d shop
|
|
96
|
+
minesql -H db.example.com -P 3307 -u app --full
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Keys (full reference)
|
|
100
|
+
|
|
101
|
+
| Key | Action |
|
|
102
|
+
|---|---|
|
|
103
|
+
| `Tab` | accept the gray suggestion (in FULL mode: just the next word/unit) |
|
|
104
|
+
| `Ctrl+E` | accept the WHOLE suggestion (also `Ctrl+Tab` on terminals that send it, e.g. kitty, WezTerm, iTerm2, xterm with modifyOtherKeys) |
|
|
105
|
+
| `Shift+Tab` | cycle to the next-best suggestion |
|
|
106
|
+
| `Ctrl+O` | suggestions ON/OFF (OFF by default; start ON with `--suggest` or `--full`) |
|
|
107
|
+
| `Ctrl+Space` / `Alt+L` | LIST mode ON/OFF — a live dropdown of suggestions (with type labels: keyword/table/column/value/snippet) that stays open and updates as you type until toggled off. Works even while ghost suggestions are OFF. `Tab`/`Shift+Tab` move in the list, `Enter` picks the highlighted item (it does **not** run the query). |
|
|
108
|
+
| `Alt+/` | force ONE suggestion at the cursor right now (ghost at end of line, dropdown mid-line), even while OFF |
|
|
109
|
+
| `Ctrl+T` | switch suggestion mode NEXT ↔ FULL (also turns suggestions on) |
|
|
110
|
+
| Right arrow | accept without the trailing space |
|
|
111
|
+
| Up/Down | command history |
|
|
112
|
+
| `Enter` | run query |
|
|
113
|
+
| `Ctrl+C` | cancel line |
|
|
114
|
+
| `Ctrl+D` | exit |
|
|
115
|
+
|
|
116
|
+
### In-app commands
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
\help show the in-app help
|
|
120
|
+
\full toggle FULL/NEXT mode (turns suggestions on)
|
|
121
|
+
\suggest toggle suggestions ON/OFF
|
|
122
|
+
\list toggle LIST mode
|
|
123
|
+
\q / exit / quit leave
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Safety
|
|
127
|
+
|
|
128
|
+
`DELETE`/`UPDATE` without `WHERE`, `DROP`, and `TRUNCATE` ask for confirmation
|
|
129
|
+
first (disable with `--no-confirm`).
|
|
130
|
+
|
|
131
|
+
### Modes
|
|
132
|
+
|
|
133
|
+
* **NEXT** — suggests only the next keyword / table / column / value.
|
|
134
|
+
* **FULL** — chains predictions into a whole query. Optional clauses
|
|
135
|
+
(`WHERE`, `AND`, `ORDER BY`, `LIMIT`, ...) are only added once the model has
|
|
136
|
+
learned you use them after that context. Sample values are guesses — edit
|
|
137
|
+
them.
|
|
138
|
+
|
|
139
|
+
### Suggestion sources
|
|
140
|
+
|
|
141
|
+
Live schema (`SHOW DATABASES`, `information_schema`), sample column values,
|
|
142
|
+
and an n-gram model learned from your queries (`~/.minesql_model.json`).
|
|
143
|
+
|
|
144
|
+
## Requirements
|
|
145
|
+
|
|
146
|
+
* Python 3.8+
|
|
147
|
+
* [`prompt_toolkit`](https://pypi.org/project/prompt-toolkit/)
|
|
148
|
+
* [`PyMySQL`](https://pypi.org/project/PyMySQL/)
|
|
149
|
+
|
|
150
|
+
These are installed automatically with `pip install minesql`.
|
|
151
|
+
|
|
152
|
+
## Development
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
git clone https://github.com/IMApurbo/minesql.git
|
|
156
|
+
cd minesql
|
|
157
|
+
pip install -e .
|
|
158
|
+
minesql --help
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
MIT © [IMApurbo](https://github.com/IMApurbo)
|
minesql-0.1.0/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# minesql
|
|
2
|
+
|
|
3
|
+
A MySQL terminal that only suggests the **next** SQL piece.
|
|
4
|
+
|
|
5
|
+
* Gray "ghost" text after your cursor = the current best suggestion
|
|
6
|
+
* `Tab` — accept the suggestion
|
|
7
|
+
* `Shift+Tab` — show the next-best suggestion
|
|
8
|
+
* `Ctrl+T` — toggle NEXT-piece mode ↔ FULL inline mode (whole query predicted)
|
|
9
|
+
* `Ctrl+O` — suggestions ON/OFF (OFF is the default at startup)
|
|
10
|
+
* `Ctrl+Space` — LIST mode ON/OFF: a live suggestion dropdown that stays open
|
|
11
|
+
and updates as you type until you toggle it off (works even when ghost
|
|
12
|
+
suggestions are OFF). `Alt+L` is an alias if `Ctrl+Space` is grabbed by your
|
|
13
|
+
terminal/OS.
|
|
14
|
+
* `Alt+/` — force ONE suggestion right here, right now (any cursor position)
|
|
15
|
+
* FULL mode: `Tab` accepts ONE word, `Ctrl+E` (or `Ctrl+Tab`, if your terminal
|
|
16
|
+
sends it) accepts the WHOLE suggestion
|
|
17
|
+
* `Enter` — run the query
|
|
18
|
+
* `Ctrl+D` — exit
|
|
19
|
+
|
|
20
|
+
Suggestions are schema-aware: database, table, and column names (plus sample
|
|
21
|
+
values) come straight from the live MySQL server via `information_schema`. A
|
|
22
|
+
small n-gram model learns from the queries you run (saved in
|
|
23
|
+
`~/.minesql_model.json`) and re-ranks suggestions so your habits float to
|
|
24
|
+
the top.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install minesql
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
minesql -H 127.0.0.1 -u root -d mydb
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
usage: minesql [-h] [-H HOST] [-P PORT] [-u USER] [-p PASSWORD] [-d DATABASE]
|
|
40
|
+
[--suggest] [--full] [--no-confirm] [--no-values]
|
|
41
|
+
|
|
42
|
+
MySQL terminal with schema-aware ghost-text SQL suggestions.
|
|
43
|
+
|
|
44
|
+
options:
|
|
45
|
+
-h, --help show this help message and exit
|
|
46
|
+
-H HOST, --host HOST
|
|
47
|
+
-P PORT, --port PORT
|
|
48
|
+
-u USER, --user USER
|
|
49
|
+
-p PASSWORD, --password PASSWORD
|
|
50
|
+
-d DATABASE, --database DATABASE
|
|
51
|
+
database to start in
|
|
52
|
+
--suggest start with suggestions ON (default is OFF)
|
|
53
|
+
--full start with FULL inline suggestions ON
|
|
54
|
+
--no-confirm don't ask before DELETE/UPDATE without WHERE, DROP, TRUNCATE
|
|
55
|
+
--no-values don't sample column values for suggestions (faster on huge tables)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Examples
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
minesql -u root -d shop
|
|
62
|
+
minesql -H db.example.com -P 3307 -u app --full
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Keys (full reference)
|
|
66
|
+
|
|
67
|
+
| Key | Action |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `Tab` | accept the gray suggestion (in FULL mode: just the next word/unit) |
|
|
70
|
+
| `Ctrl+E` | accept the WHOLE suggestion (also `Ctrl+Tab` on terminals that send it, e.g. kitty, WezTerm, iTerm2, xterm with modifyOtherKeys) |
|
|
71
|
+
| `Shift+Tab` | cycle to the next-best suggestion |
|
|
72
|
+
| `Ctrl+O` | suggestions ON/OFF (OFF by default; start ON with `--suggest` or `--full`) |
|
|
73
|
+
| `Ctrl+Space` / `Alt+L` | LIST mode ON/OFF — a live dropdown of suggestions (with type labels: keyword/table/column/value/snippet) that stays open and updates as you type until toggled off. Works even while ghost suggestions are OFF. `Tab`/`Shift+Tab` move in the list, `Enter` picks the highlighted item (it does **not** run the query). |
|
|
74
|
+
| `Alt+/` | force ONE suggestion at the cursor right now (ghost at end of line, dropdown mid-line), even while OFF |
|
|
75
|
+
| `Ctrl+T` | switch suggestion mode NEXT ↔ FULL (also turns suggestions on) |
|
|
76
|
+
| Right arrow | accept without the trailing space |
|
|
77
|
+
| Up/Down | command history |
|
|
78
|
+
| `Enter` | run query |
|
|
79
|
+
| `Ctrl+C` | cancel line |
|
|
80
|
+
| `Ctrl+D` | exit |
|
|
81
|
+
|
|
82
|
+
### In-app commands
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
\help show the in-app help
|
|
86
|
+
\full toggle FULL/NEXT mode (turns suggestions on)
|
|
87
|
+
\suggest toggle suggestions ON/OFF
|
|
88
|
+
\list toggle LIST mode
|
|
89
|
+
\q / exit / quit leave
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Safety
|
|
93
|
+
|
|
94
|
+
`DELETE`/`UPDATE` without `WHERE`, `DROP`, and `TRUNCATE` ask for confirmation
|
|
95
|
+
first (disable with `--no-confirm`).
|
|
96
|
+
|
|
97
|
+
### Modes
|
|
98
|
+
|
|
99
|
+
* **NEXT** — suggests only the next keyword / table / column / value.
|
|
100
|
+
* **FULL** — chains predictions into a whole query. Optional clauses
|
|
101
|
+
(`WHERE`, `AND`, `ORDER BY`, `LIMIT`, ...) are only added once the model has
|
|
102
|
+
learned you use them after that context. Sample values are guesses — edit
|
|
103
|
+
them.
|
|
104
|
+
|
|
105
|
+
### Suggestion sources
|
|
106
|
+
|
|
107
|
+
Live schema (`SHOW DATABASES`, `information_schema`), sample column values,
|
|
108
|
+
and an n-gram model learned from your queries (`~/.minesql_model.json`).
|
|
109
|
+
|
|
110
|
+
## Requirements
|
|
111
|
+
|
|
112
|
+
* Python 3.8+
|
|
113
|
+
* [`prompt_toolkit`](https://pypi.org/project/prompt-toolkit/)
|
|
114
|
+
* [`PyMySQL`](https://pypi.org/project/PyMySQL/)
|
|
115
|
+
|
|
116
|
+
These are installed automatically with `pip install minesql`.
|
|
117
|
+
|
|
118
|
+
## Development
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
git clone https://github.com/IMApurbo/minesql.git
|
|
122
|
+
cd minesql
|
|
123
|
+
pip install -e .
|
|
124
|
+
minesql --help
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT © [IMApurbo](https://github.com/IMApurbo)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""
|
|
2
|
+
minesql - a MySQL terminal that only suggests the NEXT SQL piece.
|
|
3
|
+
|
|
4
|
+
Schema-aware ghost-text SQL suggestions for your MySQL CLI sessions,
|
|
5
|
+
with a tiny learned n-gram model that adapts to how you write queries.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .cli import main
|
|
9
|
+
|
|
10
|
+
__version__ = "0.1.0"
|
|
11
|
+
__all__ = ["main"]
|