termchat-client 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.
- termchat_client-0.1.0/LICENSE +21 -0
- termchat_client-0.1.0/MANIFEST.in +3 -0
- termchat_client-0.1.0/PKG-INFO +211 -0
- termchat_client-0.1.0/README.md +169 -0
- termchat_client-0.1.0/pyproject.toml +74 -0
- termchat_client-0.1.0/setup.cfg +4 -0
- termchat_client-0.1.0/termchat/__init__.py +10 -0
- termchat_client-0.1.0/termchat/__main__.py +8 -0
- termchat_client-0.1.0/termchat/cli.py +97 -0
- termchat_client-0.1.0/termchat/client.py +251 -0
- termchat_client-0.1.0/termchat/config.py +113 -0
- termchat_client-0.1.0/termchat/viewer.py +93 -0
- termchat_client-0.1.0/termchat_client.egg-info/PKG-INFO +211 -0
- termchat_client-0.1.0/termchat_client.egg-info/SOURCES.txt +20 -0
- termchat_client-0.1.0/termchat_client.egg-info/dependency_links.txt +1 -0
- termchat_client-0.1.0/termchat_client.egg-info/entry_points.txt +2 -0
- termchat_client-0.1.0/termchat_client.egg-info/requires.txt +11 -0
- termchat_client-0.1.0/termchat_client.egg-info/top_level.txt +1 -0
- termchat_client-0.1.0/tests/test_cli.py +15 -0
- termchat_client-0.1.0/tests/test_config.py +25 -0
- termchat_client-0.1.0/tests/test_server.py +76 -0
- termchat_client-0.1.0/tests/test_viewer.py +16 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 TermChat Contributors
|
|
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,211 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: termchat-client
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Lightweight, non-intrusive terminal chat client connecting to an online chat server with real-time text and image support.
|
|
5
|
+
Author-email: TermChat Team <info@termchat.dev>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/your-username/termchat
|
|
8
|
+
Project-URL: Repository, https://github.com/your-username/termchat
|
|
9
|
+
Project-URL: Issues, https://github.com/your-username/termchat/issues
|
|
10
|
+
Keywords: chat,terminal,cli,websocket,raspberry-pi,linux,windows,render,image-chat
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Operating System :: MacOS
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
26
|
+
Classifier: Topic :: Communications :: Chat
|
|
27
|
+
Classifier: Topic :: Terminals
|
|
28
|
+
Requires-Python: >=3.8
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: websockets>=12.0
|
|
32
|
+
Requires-Dist: prompt_toolkit>=3.0.0
|
|
33
|
+
Requires-Dist: pillow>=9.0.0
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: httpx>=0.24.0; extra == "dev"
|
|
37
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: twine>=4.0.0; extra == "dev"
|
|
39
|
+
Requires-Dist: fastapi>=0.100.0; extra == "dev"
|
|
40
|
+
Requires-Dist: python-multipart>=0.0.6; extra == "dev"
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
|
|
43
|
+
# termchat-client 💬🖼️
|
|
44
|
+
|
|
45
|
+
[](https://pypi.org/project/termchat-client/)
|
|
46
|
+
[](https://pypi.org/project/termchat-client/)
|
|
47
|
+
[](https://opensource.org/licenses/MIT)
|
|
48
|
+
[](https://pypi.org/project/termchat-client/)
|
|
49
|
+
|
|
50
|
+
**termchat-client** is a lightweight, non-intrusive terminal chat client packaged for Python. It connects directly to an online chat server (running on **Render** or any cloud host), allowing you to chat seamlessly between your **terminal** and an **online HTML web page** viewed by others.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 💡 How It Works
|
|
55
|
+
|
|
56
|
+
- **Standard Terminal Interaction**: It does **not** change or take over your terminal UI. No fullscreen ncurses/curses screens. Just a normal, standard prompt line where you type text and press Enter.
|
|
57
|
+
- **Bi-Directional Messaging**:
|
|
58
|
+
- You type text in your terminal ➔ It appears instantly on the web page.
|
|
59
|
+
- Web users type replies ➔ They print right into your terminal: `[🌐 WebUser]: Hello from Chrome!`
|
|
60
|
+
- **Image Support to Terminal**:
|
|
61
|
+
- Web users can click the image picker, drag & drop images, or **press `Ctrl+V` to paste screenshots directly from their clipboard**!
|
|
62
|
+
- When an image is sent from the web, your terminal automatically:
|
|
63
|
+
1. Downloads the image locally into `./downloads/`
|
|
64
|
+
2. Prints the image URL and filename
|
|
65
|
+
3. Renders a compact **ANSI 24-bit color block thumbnail preview** directly inside your terminal!
|
|
66
|
+
4. Can auto-open the image in your OS default image viewer with `--open` or `/open`.
|
|
67
|
+
- **Works on Any OS**: Windows (PowerShell / CMD / Windows Terminal), Linux (Debian, Ubuntu, Arch), **Raspberry Pi** (ARMv7 / aarch64), and macOS.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 🏛️ System Architecture
|
|
72
|
+
|
|
73
|
+
```text
|
|
74
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
75
|
+
│ Online Server on Render │
|
|
76
|
+
│ (FastAPI + WebSockets + Image Upload API) │
|
|
77
|
+
│ https://my-chat.onrender.com │
|
|
78
|
+
└──────────────▲───────────────────────────────▲──────────────┘
|
|
79
|
+
│ │
|
|
80
|
+
WebSocket │ WebSocket │ + HTTP Web UI
|
|
81
|
+
Connection │ Connection │ (HTML5 / CSS / JS)
|
|
82
|
+
│ │
|
|
83
|
+
┌─────────────┴──────────┐ ┌─────────────┴─────────────┐
|
|
84
|
+
│ termchat-client (CLI) │ │ Web Client (HTML) │
|
|
85
|
+
│ • Linux / Raspberry Pi│ │ • Desktop Browsers │
|
|
86
|
+
│ • Windows CMD / PS │ │ • Mobile Browsers (iOS) │
|
|
87
|
+
│ • macOS Terminal │ │ • Paste Images (Ctrl+V) │
|
|
88
|
+
│ (Just text in & out) │ │ • Drag & Drop Images │
|
|
89
|
+
└────────────────────────┘ └───────────────────────────┘
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## 📦 Installation
|
|
95
|
+
|
|
96
|
+
Install the client package on any machine:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
pip install termchat-client
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 🚀 Terminal Client Usage
|
|
105
|
+
|
|
106
|
+
### 1. Run via CLI
|
|
107
|
+
```bash
|
|
108
|
+
termchat --server https://my-chat.onrender.com --name Alice
|
|
109
|
+
```
|
|
110
|
+
Or via Python module:
|
|
111
|
+
```bash
|
|
112
|
+
python -m termchat --server https://my-chat.onrender.com --name Alice
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 2. Save Your Server Once
|
|
116
|
+
Save your online server URL so you never need to type it again:
|
|
117
|
+
```bash
|
|
118
|
+
termchat --set-server https://my-chat.onrender.com
|
|
119
|
+
termchat --set-name Alice
|
|
120
|
+
```
|
|
121
|
+
Once saved, simply run:
|
|
122
|
+
```bash
|
|
123
|
+
termchat
|
|
124
|
+
```
|
|
125
|
+
or:
|
|
126
|
+
```bash
|
|
127
|
+
python -m termchat
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 3. What It Looks Like in Your Terminal:
|
|
131
|
+
```text
|
|
132
|
+
--- termchat connected ---
|
|
133
|
+
User: Alice
|
|
134
|
+
Server: https://my-chat.onrender.com
|
|
135
|
+
Web UI: https://my-chat.onrender.com
|
|
136
|
+
Commands: /help, /open (view last image), /quit
|
|
137
|
+
---------------------------
|
|
138
|
+
|
|
139
|
+
Connected! Start typing text below (Press Enter to send):
|
|
140
|
+
|
|
141
|
+
> Hello from my Raspberry Pi terminal!
|
|
142
|
+
|
|
143
|
+
[🌐 Web] Bob: Hey Alice! Check out this screenshot:
|
|
144
|
+
[🌐 Web] Bob 📷 Sent an image: dashboard.png
|
|
145
|
+
URL: https://my-chat.onrender.com/uploads/dashboard.png
|
|
146
|
+
Saved locally: C:\projects\terminal-chat\downloads\dashboard.png
|
|
147
|
+
|
|
148
|
+
[ANSI Image Thumbnail rendered here]
|
|
149
|
+
|
|
150
|
+
>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### In-Terminal Commands:
|
|
154
|
+
- `/open` — Opens the last received image in your OS default image viewer (Photos, Preview, or `xdg-open`).
|
|
155
|
+
- `/web` — Prints the Web UI link.
|
|
156
|
+
- `/help` — Lists available commands.
|
|
157
|
+
- `/quit` (or `Ctrl+C`) — Safely exits.
|
|
158
|
+
|
|
159
|
+
### Optional Flags:
|
|
160
|
+
- `--open`: Automatically opens any received image in your OS default image viewer.
|
|
161
|
+
- `--no-thumb`: Disables terminal ANSI thumbnail previews (prints URL and saved path only).
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 🌐 Deploying the Server to Render (Free)
|
|
166
|
+
|
|
167
|
+
The server code lives in the `server/` directory and can be deployed to [Render](https://render.com) in 2 minutes for free.
|
|
168
|
+
|
|
169
|
+
See [DEPLOY_RENDER.md](DEPLOY_RENDER.md) for full instructions:
|
|
170
|
+
1. Push this repository to GitHub.
|
|
171
|
+
2. In Render, click **New + > Web Service** and connect your GitHub repo.
|
|
172
|
+
3. Set **Root Directory** to `server`.
|
|
173
|
+
4. Set **Start Command** to `uvicorn main:app --host 0.0.0.0 --port $PORT`.
|
|
174
|
+
5. Deploy! Render gives you a live HTTPS and WebSocket URL like `https://my-chat.onrender.com`.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## 📤 Publishing to PyPI
|
|
179
|
+
|
|
180
|
+
The package is packaged using modern PEP 517 / PEP 621 (`pyproject.toml`).
|
|
181
|
+
|
|
182
|
+
1. Build distributions:
|
|
183
|
+
```bash
|
|
184
|
+
python -m build
|
|
185
|
+
```
|
|
186
|
+
2. Verify with Twine:
|
|
187
|
+
```bash
|
|
188
|
+
twine check dist/*
|
|
189
|
+
```
|
|
190
|
+
3. Upload to PyPI:
|
|
191
|
+
```bash
|
|
192
|
+
twine upload dist/*
|
|
193
|
+
```
|
|
194
|
+
*(Or run the included interactive helper: `python publish.py`)*
|
|
195
|
+
|
|
196
|
+
See [PUBLISHING.md](PUBLISHING.md) for step-by-step instructions.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## 🧪 Testing
|
|
201
|
+
|
|
202
|
+
Run the automated test suite:
|
|
203
|
+
```bash
|
|
204
|
+
python -m pytest -v
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## 📄 License
|
|
210
|
+
|
|
211
|
+
MIT License. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# termchat-client 💬🖼️
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/termchat-client/)
|
|
4
|
+
[](https://pypi.org/project/termchat-client/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://pypi.org/project/termchat-client/)
|
|
7
|
+
|
|
8
|
+
**termchat-client** is a lightweight, non-intrusive terminal chat client packaged for Python. It connects directly to an online chat server (running on **Render** or any cloud host), allowing you to chat seamlessly between your **terminal** and an **online HTML web page** viewed by others.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 💡 How It Works
|
|
13
|
+
|
|
14
|
+
- **Standard Terminal Interaction**: It does **not** change or take over your terminal UI. No fullscreen ncurses/curses screens. Just a normal, standard prompt line where you type text and press Enter.
|
|
15
|
+
- **Bi-Directional Messaging**:
|
|
16
|
+
- You type text in your terminal ➔ It appears instantly on the web page.
|
|
17
|
+
- Web users type replies ➔ They print right into your terminal: `[🌐 WebUser]: Hello from Chrome!`
|
|
18
|
+
- **Image Support to Terminal**:
|
|
19
|
+
- Web users can click the image picker, drag & drop images, or **press `Ctrl+V` to paste screenshots directly from their clipboard**!
|
|
20
|
+
- When an image is sent from the web, your terminal automatically:
|
|
21
|
+
1. Downloads the image locally into `./downloads/`
|
|
22
|
+
2. Prints the image URL and filename
|
|
23
|
+
3. Renders a compact **ANSI 24-bit color block thumbnail preview** directly inside your terminal!
|
|
24
|
+
4. Can auto-open the image in your OS default image viewer with `--open` or `/open`.
|
|
25
|
+
- **Works on Any OS**: Windows (PowerShell / CMD / Windows Terminal), Linux (Debian, Ubuntu, Arch), **Raspberry Pi** (ARMv7 / aarch64), and macOS.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 🏛️ System Architecture
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
33
|
+
│ Online Server on Render │
|
|
34
|
+
│ (FastAPI + WebSockets + Image Upload API) │
|
|
35
|
+
│ https://my-chat.onrender.com │
|
|
36
|
+
└──────────────▲───────────────────────────────▲──────────────┘
|
|
37
|
+
│ │
|
|
38
|
+
WebSocket │ WebSocket │ + HTTP Web UI
|
|
39
|
+
Connection │ Connection │ (HTML5 / CSS / JS)
|
|
40
|
+
│ │
|
|
41
|
+
┌─────────────┴──────────┐ ┌─────────────┴─────────────┐
|
|
42
|
+
│ termchat-client (CLI) │ │ Web Client (HTML) │
|
|
43
|
+
│ • Linux / Raspberry Pi│ │ • Desktop Browsers │
|
|
44
|
+
│ • Windows CMD / PS │ │ • Mobile Browsers (iOS) │
|
|
45
|
+
│ • macOS Terminal │ │ • Paste Images (Ctrl+V) │
|
|
46
|
+
│ (Just text in & out) │ │ • Drag & Drop Images │
|
|
47
|
+
└────────────────────────┘ └───────────────────────────┘
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 📦 Installation
|
|
53
|
+
|
|
54
|
+
Install the client package on any machine:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install termchat-client
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 🚀 Terminal Client Usage
|
|
63
|
+
|
|
64
|
+
### 1. Run via CLI
|
|
65
|
+
```bash
|
|
66
|
+
termchat --server https://my-chat.onrender.com --name Alice
|
|
67
|
+
```
|
|
68
|
+
Or via Python module:
|
|
69
|
+
```bash
|
|
70
|
+
python -m termchat --server https://my-chat.onrender.com --name Alice
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 2. Save Your Server Once
|
|
74
|
+
Save your online server URL so you never need to type it again:
|
|
75
|
+
```bash
|
|
76
|
+
termchat --set-server https://my-chat.onrender.com
|
|
77
|
+
termchat --set-name Alice
|
|
78
|
+
```
|
|
79
|
+
Once saved, simply run:
|
|
80
|
+
```bash
|
|
81
|
+
termchat
|
|
82
|
+
```
|
|
83
|
+
or:
|
|
84
|
+
```bash
|
|
85
|
+
python -m termchat
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 3. What It Looks Like in Your Terminal:
|
|
89
|
+
```text
|
|
90
|
+
--- termchat connected ---
|
|
91
|
+
User: Alice
|
|
92
|
+
Server: https://my-chat.onrender.com
|
|
93
|
+
Web UI: https://my-chat.onrender.com
|
|
94
|
+
Commands: /help, /open (view last image), /quit
|
|
95
|
+
---------------------------
|
|
96
|
+
|
|
97
|
+
Connected! Start typing text below (Press Enter to send):
|
|
98
|
+
|
|
99
|
+
> Hello from my Raspberry Pi terminal!
|
|
100
|
+
|
|
101
|
+
[🌐 Web] Bob: Hey Alice! Check out this screenshot:
|
|
102
|
+
[🌐 Web] Bob 📷 Sent an image: dashboard.png
|
|
103
|
+
URL: https://my-chat.onrender.com/uploads/dashboard.png
|
|
104
|
+
Saved locally: C:\projects\terminal-chat\downloads\dashboard.png
|
|
105
|
+
|
|
106
|
+
[ANSI Image Thumbnail rendered here]
|
|
107
|
+
|
|
108
|
+
>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### In-Terminal Commands:
|
|
112
|
+
- `/open` — Opens the last received image in your OS default image viewer (Photos, Preview, or `xdg-open`).
|
|
113
|
+
- `/web` — Prints the Web UI link.
|
|
114
|
+
- `/help` — Lists available commands.
|
|
115
|
+
- `/quit` (or `Ctrl+C`) — Safely exits.
|
|
116
|
+
|
|
117
|
+
### Optional Flags:
|
|
118
|
+
- `--open`: Automatically opens any received image in your OS default image viewer.
|
|
119
|
+
- `--no-thumb`: Disables terminal ANSI thumbnail previews (prints URL and saved path only).
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 🌐 Deploying the Server to Render (Free)
|
|
124
|
+
|
|
125
|
+
The server code lives in the `server/` directory and can be deployed to [Render](https://render.com) in 2 minutes for free.
|
|
126
|
+
|
|
127
|
+
See [DEPLOY_RENDER.md](DEPLOY_RENDER.md) for full instructions:
|
|
128
|
+
1. Push this repository to GitHub.
|
|
129
|
+
2. In Render, click **New + > Web Service** and connect your GitHub repo.
|
|
130
|
+
3. Set **Root Directory** to `server`.
|
|
131
|
+
4. Set **Start Command** to `uvicorn main:app --host 0.0.0.0 --port $PORT`.
|
|
132
|
+
5. Deploy! Render gives you a live HTTPS and WebSocket URL like `https://my-chat.onrender.com`.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 📤 Publishing to PyPI
|
|
137
|
+
|
|
138
|
+
The package is packaged using modern PEP 517 / PEP 621 (`pyproject.toml`).
|
|
139
|
+
|
|
140
|
+
1. Build distributions:
|
|
141
|
+
```bash
|
|
142
|
+
python -m build
|
|
143
|
+
```
|
|
144
|
+
2. Verify with Twine:
|
|
145
|
+
```bash
|
|
146
|
+
twine check dist/*
|
|
147
|
+
```
|
|
148
|
+
3. Upload to PyPI:
|
|
149
|
+
```bash
|
|
150
|
+
twine upload dist/*
|
|
151
|
+
```
|
|
152
|
+
*(Or run the included interactive helper: `python publish.py`)*
|
|
153
|
+
|
|
154
|
+
See [PUBLISHING.md](PUBLISHING.md) for step-by-step instructions.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## 🧪 Testing
|
|
159
|
+
|
|
160
|
+
Run the automated test suite:
|
|
161
|
+
```bash
|
|
162
|
+
python -m pytest -v
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## 📄 License
|
|
168
|
+
|
|
169
|
+
MIT License. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "termchat-client"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Lightweight, non-intrusive terminal chat client connecting to an online chat server with real-time text and image support."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{ name = "TermChat Team", email = "info@termchat.dev" }
|
|
12
|
+
]
|
|
13
|
+
license = "MIT"
|
|
14
|
+
license-files = ["LICENSE"]
|
|
15
|
+
requires-python = ">=3.8"
|
|
16
|
+
keywords = [
|
|
17
|
+
"chat",
|
|
18
|
+
"terminal",
|
|
19
|
+
"cli",
|
|
20
|
+
"websocket",
|
|
21
|
+
"raspberry-pi",
|
|
22
|
+
"linux",
|
|
23
|
+
"windows",
|
|
24
|
+
"render",
|
|
25
|
+
"image-chat"
|
|
26
|
+
]
|
|
27
|
+
classifiers = [
|
|
28
|
+
"Development Status :: 4 - Beta",
|
|
29
|
+
"Environment :: Console",
|
|
30
|
+
"Intended Audience :: Developers",
|
|
31
|
+
"Intended Audience :: End Users/Desktop",
|
|
32
|
+
"Operating System :: OS Independent",
|
|
33
|
+
"Operating System :: Microsoft :: Windows",
|
|
34
|
+
"Operating System :: POSIX :: Linux",
|
|
35
|
+
"Operating System :: MacOS",
|
|
36
|
+
"Programming Language :: Python :: 3",
|
|
37
|
+
"Programming Language :: Python :: 3.8",
|
|
38
|
+
"Programming Language :: Python :: 3.9",
|
|
39
|
+
"Programming Language :: Python :: 3.10",
|
|
40
|
+
"Programming Language :: Python :: 3.11",
|
|
41
|
+
"Programming Language :: Python :: 3.12",
|
|
42
|
+
"Programming Language :: Python :: 3.13",
|
|
43
|
+
"Topic :: Communications :: Chat",
|
|
44
|
+
"Topic :: Terminals",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
dependencies = [
|
|
48
|
+
"websockets>=12.0",
|
|
49
|
+
"prompt_toolkit>=3.0.0",
|
|
50
|
+
"pillow>=9.0.0",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[project.optional-dependencies]
|
|
54
|
+
dev = [
|
|
55
|
+
"pytest>=7.0.0",
|
|
56
|
+
"httpx>=0.24.0",
|
|
57
|
+
"build>=1.0.0",
|
|
58
|
+
"twine>=4.0.0",
|
|
59
|
+
"fastapi>=0.100.0",
|
|
60
|
+
"python-multipart>=0.0.6",
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
[project.scripts]
|
|
64
|
+
termchat = "termchat.cli:main"
|
|
65
|
+
|
|
66
|
+
[project.urls]
|
|
67
|
+
Homepage = "https://github.com/your-username/termchat"
|
|
68
|
+
Repository = "https://github.com/your-username/termchat"
|
|
69
|
+
Issues = "https://github.com/your-username/termchat/issues"
|
|
70
|
+
|
|
71
|
+
[tool.setuptools.packages.find]
|
|
72
|
+
where = ["."]
|
|
73
|
+
include = ["termchat*"]
|
|
74
|
+
exclude = ["termchat.__pycache__*", "tests*", "server*"]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""
|
|
2
|
+
termchat - Lightweight, non-intrusive terminal chat client.
|
|
3
|
+
Connects standard terminal input to your online Render/cloud server and receives text & images.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
__version__ = "0.1.0"
|
|
7
|
+
__author__ = "TermChat Contributors"
|
|
8
|
+
__license__ = "MIT"
|
|
9
|
+
|
|
10
|
+
__all__ = ["__version__"]
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CLI interface for termchat client.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
|
|
9
|
+
from termchat import __version__
|
|
10
|
+
from termchat.client import start
|
|
11
|
+
from termchat.config import (
|
|
12
|
+
get_saved_server_url,
|
|
13
|
+
get_saved_username,
|
|
14
|
+
set_saved_server_url,
|
|
15
|
+
set_saved_username,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def main():
|
|
20
|
+
parser = argparse.ArgumentParser(
|
|
21
|
+
prog="termchat",
|
|
22
|
+
description="Non-intrusive terminal chat client connecting to your online Render/cloud server.",
|
|
23
|
+
)
|
|
24
|
+
parser.add_argument("-v", "--version", action="version", version=f"termchat {__version__}")
|
|
25
|
+
parser.add_argument(
|
|
26
|
+
"-s",
|
|
27
|
+
"--server",
|
|
28
|
+
help="Online server URL (e.g. https://my-chat.onrender.com). Overrides saved config.",
|
|
29
|
+
)
|
|
30
|
+
parser.add_argument(
|
|
31
|
+
"-n",
|
|
32
|
+
"--name",
|
|
33
|
+
help="Chat username. Overrides saved config.",
|
|
34
|
+
)
|
|
35
|
+
parser.add_argument(
|
|
36
|
+
"--set-server",
|
|
37
|
+
help="Save a default online server URL to ~/.termchat.json and exit.",
|
|
38
|
+
)
|
|
39
|
+
parser.add_argument(
|
|
40
|
+
"--set-name",
|
|
41
|
+
help="Save a default username to ~/.termchat.json and exit.",
|
|
42
|
+
)
|
|
43
|
+
parser.add_argument(
|
|
44
|
+
"--open",
|
|
45
|
+
action="store_true",
|
|
46
|
+
help="Automatically open received images in your OS default image viewer.",
|
|
47
|
+
)
|
|
48
|
+
parser.add_argument(
|
|
49
|
+
"--no-thumb",
|
|
50
|
+
action="store_true",
|
|
51
|
+
help="Disable ANSI image thumbnail previews in the terminal.",
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
args = parser.parse_args()
|
|
55
|
+
|
|
56
|
+
# Handle configuration saving
|
|
57
|
+
if args.set_server:
|
|
58
|
+
set_saved_server_url(args.set_server)
|
|
59
|
+
print(f"[OK] Default server saved: {args.set_server}")
|
|
60
|
+
sys.exit(0)
|
|
61
|
+
|
|
62
|
+
if args.set_name:
|
|
63
|
+
set_saved_username(args.set_name)
|
|
64
|
+
print(f"[OK] Default username saved: {args.set_name}")
|
|
65
|
+
sys.exit(0)
|
|
66
|
+
|
|
67
|
+
# Determine server URL
|
|
68
|
+
server_url = args.server or get_saved_server_url()
|
|
69
|
+
if not server_url:
|
|
70
|
+
print("Welcome to termchat!")
|
|
71
|
+
try:
|
|
72
|
+
val = input("Enter your online chat server URL (e.g. https://my-app.onrender.com): ").strip()
|
|
73
|
+
except (KeyboardInterrupt, EOFError):
|
|
74
|
+
print("\nAborted.")
|
|
75
|
+
sys.exit(0)
|
|
76
|
+
|
|
77
|
+
if not val:
|
|
78
|
+
print("Error: A server URL is required.")
|
|
79
|
+
sys.exit(1)
|
|
80
|
+
|
|
81
|
+
set_saved_server_url(val)
|
|
82
|
+
server_url = val
|
|
83
|
+
print(f"Server saved to ~/.termchat.json. Next time you can just type 'termchat'!\n")
|
|
84
|
+
|
|
85
|
+
# Determine username
|
|
86
|
+
username = args.name or get_saved_username()
|
|
87
|
+
|
|
88
|
+
start(
|
|
89
|
+
server_url=server_url,
|
|
90
|
+
username=username,
|
|
91
|
+
auto_open=args.open,
|
|
92
|
+
no_thumb=args.no_thumb,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
if __name__ == "__main__":
|
|
97
|
+
main()
|