bithub 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,51 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" data-theme="dark">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>bithub</title>
7
+ <link rel="stylesheet" href="/static/style.css">
8
+ </head>
9
+ <body>
10
+ <nav class="sidebar">
11
+ <div class="sidebar-brand">
12
+ <h1>bithub</h1>
13
+ <span class="version">v0.1.0</span>
14
+ </div>
15
+ <ul class="nav-links">
16
+ <li><a href="#/" class="nav-link active" data-page="chat">Chat</a></li>
17
+ <li><a href="#/models" class="nav-link" data-page="models">Models</a></li>
18
+ <li><a href="#/server" class="nav-link" data-page="server">Server</a></li>
19
+ <li><a href="#/settings" class="nav-link" data-page="settings">Settings</a></li>
20
+ </ul>
21
+ </nav>
22
+ <main class="content">
23
+ <div id="page-chat" class="page active">
24
+ <div class="chat-header">
25
+ <select id="model-select" class="model-select"></select>
26
+ <div class="chat-controls">
27
+ <button id="clear-chat" class="btn btn-sm">Clear</button>
28
+ </div>
29
+ </div>
30
+ <div id="chat-messages" class="chat-messages"></div>
31
+ <div class="chat-input-area">
32
+ <textarea id="chat-input" placeholder="Type a message..." rows="1"></textarea>
33
+ <button id="send-btn" class="btn btn-primary">Send</button>
34
+ </div>
35
+ </div>
36
+ <div id="page-models" class="page">
37
+ <h2>Models</h2>
38
+ <div id="models-list" class="models-grid"></div>
39
+ </div>
40
+ <div id="page-server" class="page">
41
+ <h2>Server</h2>
42
+ <div id="server-stats" class="stats-grid"></div>
43
+ </div>
44
+ <div id="page-settings" class="page">
45
+ <h2>Settings</h2>
46
+ <div id="settings-form" class="settings-form"></div>
47
+ </div>
48
+ </main>
49
+ <script src="/static/app.js"></script>
50
+ </body>
51
+ </html>
@@ -0,0 +1,72 @@
1
+ :root {
2
+ --bg-primary: #0d1117;
3
+ --bg-secondary: #161b22;
4
+ --bg-tertiary: #21262d;
5
+ --text-primary: #e6edf3;
6
+ --text-secondary: #8b949e;
7
+ --text-muted: #484f58;
8
+ --accent: #58a6ff;
9
+ --accent-hover: #79c0ff;
10
+ --success: #3fb950;
11
+ --warning: #d29922;
12
+ --error: #f85149;
13
+ --border: #30363d;
14
+ --sidebar-width: 220px;
15
+ --radius: 8px;
16
+ --font-mono: 'SF Mono', 'Fira Code', monospace;
17
+ --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
18
+ }
19
+ [data-theme="light"] {
20
+ --bg-primary: #ffffff; --bg-secondary: #f6f8fa; --bg-tertiary: #eaeef2;
21
+ --text-primary: #1f2328; --text-secondary: #656d76; --text-muted: #8b949e;
22
+ --accent: #0969da; --accent-hover: #0550ae; --success: #1a7f37;
23
+ --warning: #9a6700; --error: #cf222e; --border: #d0d7de;
24
+ }
25
+ * { margin: 0; padding: 0; box-sizing: border-box; }
26
+ body { font-family: var(--font-sans); background: var(--bg-primary); color: var(--text-primary); display: flex; height: 100vh; overflow: hidden; }
27
+ .sidebar { width: var(--sidebar-width); background: var(--bg-secondary); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
28
+ .sidebar-brand { padding: 20px; border-bottom: 1px solid var(--border); }
29
+ .sidebar-brand h1 { font-size: 1.4rem; font-weight: 700; color: var(--accent); }
30
+ .sidebar-brand .version { font-size: 0.75rem; color: var(--text-muted); }
31
+ .nav-links { list-style: none; padding: 12px 0; }
32
+ .nav-link { display: block; padding: 10px 20px; color: var(--text-secondary); text-decoration: none; font-size: 0.9rem; transition: all 0.15s; }
33
+ .nav-link:hover { color: var(--text-primary); background: var(--bg-tertiary); }
34
+ .nav-link.active { color: var(--accent); background: var(--bg-tertiary); border-right: 2px solid var(--accent); }
35
+ .content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
36
+ .page { display: none; flex: 1; flex-direction: column; padding: 24px; }
37
+ .page.active { display: flex; }
38
+ .chat-header { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
39
+ .model-select { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; font-size: 0.9rem; cursor: pointer; }
40
+ .chat-controls { margin-left: auto; }
41
+ .chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 8px 0; }
42
+ .message { display: flex; gap: 12px; max-width: 85%; }
43
+ .message.user { align-self: flex-end; flex-direction: row-reverse; }
44
+ .message.assistant { align-self: flex-start; }
45
+ .message-role { font-size: 0.7rem; text-transform: uppercase; color: var(--text-muted); font-weight: 600; letter-spacing: 0.05em; flex-shrink: 0; padding-top: 4px; }
46
+ .message-content { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; font-size: 0.9rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
47
+ .message.user .message-content { background: var(--accent); color: #fff; border-color: var(--accent); }
48
+ .chat-input-area { display: flex; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); margin-top: auto; }
49
+ #chat-input { flex: 1; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; color: var(--text-primary); font-family: var(--font-sans); font-size: 0.9rem; resize: none; outline: none; }
50
+ #chat-input:focus { border-color: var(--accent); }
51
+ .btn { padding: 8px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-tertiary); color: var(--text-primary); cursor: pointer; font-size: 0.85rem; transition: all 0.15s; }
52
+ .btn:hover { background: var(--border); }
53
+ .btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
54
+ .btn-primary:hover { background: var(--accent-hover); }
55
+ .btn-sm { padding: 4px 10px; font-size: 0.8rem; }
56
+ .btn-danger { background: var(--error); color: #fff; border-color: var(--error); }
57
+ .models-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
58
+ .model-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
59
+ .model-card h3 { color: var(--accent); margin-bottom: 8px; }
60
+ .model-card .meta { color: var(--text-secondary); font-size: 0.85rem; }
61
+ .model-card .status { margin-top: 12px; }
62
+ .status-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
63
+ .status-loaded { background: rgba(63, 185, 80, 0.2); color: var(--success); }
64
+ .status-available { background: rgba(139, 148, 158, 0.2); color: var(--text-secondary); }
65
+ .stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 16px; }
66
+ .stat-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; }
67
+ .stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--accent); }
68
+ .stat-card .stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }
69
+ .settings-form { max-width: 500px; margin-top: 16px; }
70
+ .form-group { margin-bottom: 20px; }
71
+ .form-group label { display: block; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 6px; }
72
+ .form-group input, .form-group select { width: 100%; padding: 8px 12px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-primary); font-size: 0.9rem; }
@@ -0,0 +1,175 @@
1
+ Metadata-Version: 2.4
2
+ Name: bithub
3
+ Version: 0.1.0
4
+ Summary: The missing friendly interface for BitNet inference. Ollama for 1-bit LLMs.
5
+ License: MIT
6
+ Project-URL: Homepage, https://github.com/sagarjhaa/bithub
7
+ Project-URL: Issues, https://github.com/sagarjhaa/bithub/issues
8
+ Requires-Python: >=3.9
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: click>=8.0
12
+ Requires-Dist: rich>=13.0
13
+ Requires-Dist: huggingface-hub>=0.20.0
14
+ Requires-Dist: fastapi>=0.100.0
15
+ Requires-Dist: uvicorn>=0.20.0
16
+ Requires-Dist: httpx>=0.24.0
17
+ Requires-Dist: prompt-toolkit>=3.0
18
+ Requires-Dist: tomli>=2.0; python_version < "3.11"
19
+ Provides-Extra: dev
20
+ Requires-Dist: pytest>=7.0; extra == "dev"
21
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
22
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
23
+ Requires-Dist: mypy>=1.0; extra == "dev"
24
+ Requires-Dist: ruff>=0.4; extra == "dev"
25
+ Dynamic: license-file
26
+
27
+ # bithub
28
+
29
+ The missing friendly interface for [BitNet](https://github.com/microsoft/BitNet) inference. Think of it as **Ollama for 1-bit LLMs**.
30
+
31
+ BitNet models are incredibly efficient — a 2B parameter model fits in ~800MB of RAM and runs fast on a plain CPU. But there's no easy way to download, manage, and serve them. **bithub** fixes that.
32
+
33
+ ## What it does
34
+
35
+ ```bash
36
+ bithub setup # One-time: build the inference engine
37
+ bithub pull 2B-4T # Download a BitNet model from HuggingFace
38
+ bithub models # See all available models
39
+ bithub list # See what's installed
40
+ bithub serve 2B-4T # Start an OpenAI-compatible API server
41
+ bithub run 2B-4T # Chat in your terminal
42
+ bithub rm 2B-4T # Remove a model
43
+ bithub status # Check engine and model state
44
+ ```
45
+
46
+ Once the server is running, any app that speaks the OpenAI API can connect — Open WebUI, Cursor, your own scripts:
47
+
48
+ ```python
49
+ import openai
50
+ client = openai.OpenAI(base_url="http://localhost:8080/v1", api_key="not-needed")
51
+ response = client.chat.completions.create(
52
+ model="2B-4T",
53
+ messages=[{"role": "user", "content": "Hello!"}]
54
+ )
55
+ ```
56
+
57
+ ## Available Models
58
+
59
+ | Name | Parameters | Size | Description |
60
+ |---|---|---|---|
61
+ | **2B-4T** | 2.4B | ~1.8 GB | Microsoft's official BitNet, trained on 4T tokens |
62
+ | **700M** | 0.7B | ~500 MB | Community 700M model — great for testing |
63
+ | **3B** | 3.3B | ~2.5 GB | Community 3.3B model |
64
+ | **8B** | 8.0B | ~5 GB | Llama3 architecture in 1.58-bit |
65
+ | **falcon3-1B** | 1B | ~700 MB | Falcon3 1B instruction-tuned |
66
+ | **falcon3-3B** | 3B | ~2 GB | Falcon3 3B instruction-tuned |
67
+ | **falcon3-7B** | 7B | ~4.5 GB | Falcon3 7B instruction-tuned |
68
+ | **falcon3-10B** | 10B | ~6.5 GB | Falcon3 10B instruction-tuned |
69
+
70
+ ## Why bithub?
71
+
72
+ | | Ollama | bithub |
73
+ |---|---|---|
74
+ | Engine | llama.cpp | bitnet.cpp |
75
+ | Model weights | 4-bit / 8-bit quantized | Native 1.58-bit (ternary) |
76
+ | RAM for 2B model | ~2-4 GB | ~800 MB |
77
+ | Speed on CPU | Good | 2-6x faster |
78
+ | Energy usage | Normal | 55-82% less |
79
+ | Model ecosystem | Thousands of models | Growing (~10 models) |
80
+
81
+ ## API Endpoints
82
+
83
+ When you run `bithub serve`, you get a full OpenAI-compatible API:
84
+
85
+ | Method | Endpoint | Description |
86
+ |---|---|---|
87
+ | `POST` | `/v1/chat/completions` | Chat completion (streaming + non-streaming) |
88
+ | `GET` | `/v1/models` | List available models |
89
+ | `GET` | `/health` | Server health check |
90
+
91
+ This means bithub works out of the box with Open WebUI, Cursor, Continue, and any tool that supports custom OpenAI endpoints.
92
+
93
+ ## Quick Start
94
+
95
+ ```bash
96
+ # Install (downloads pre-built binaries — no compiler needed)
97
+ curl -fsSL https://raw.githubusercontent.com/sagarjhaa/bithub/main/install.sh | bash
98
+
99
+ # Pull a model and chat
100
+ bithub pull 2B-4T
101
+ bithub run 2B-4T
102
+ ```
103
+
104
+ That's it. No cmake, no clang, no compiling.
105
+
106
+ ## Installation
107
+
108
+ ### Quick Install (recommended)
109
+
110
+ ```bash
111
+ curl -fsSL https://raw.githubusercontent.com/sagarjhaa/bithub/main/install.sh | bash
112
+ ```
113
+
114
+ Downloads the `bithub` CLI and pre-built bitnet.cpp binaries for your platform (macOS/Linux, x86_64/arm64). Requires Python 3.9+.
115
+
116
+ ### pip
117
+
118
+ ```bash
119
+ pip install bithub
120
+ bithub setup # compiles bitnet.cpp (requires cmake + clang)
121
+ ```
122
+
123
+ ### Docker
124
+
125
+ ```bash
126
+ docker run -p 8080:8080 -v ~/.bithub:/root/.bithub ghcr.io/sagarjhaa/bithub pull 2B-4T
127
+ docker run -p 8080:8080 -v ~/.bithub:/root/.bithub ghcr.io/sagarjhaa/bithub serve 2B-4T
128
+ ```
129
+
130
+ Open `http://localhost:8080` for the built-in web dashboard.
131
+
132
+ ### From Source
133
+
134
+ ```bash
135
+ git clone https://github.com/sagarjhaa/bithub.git
136
+ cd bithub
137
+ pip install -e ".[dev]"
138
+ bithub setup # requires cmake + clang
139
+ ```
140
+
141
+ ## Features
142
+
143
+ - **Interactive REPL** — `bithub run` with markdown rendering, history, and `/commands`
144
+ - **OpenAI-compatible API** — `bithub serve` works with Open WebUI, Cursor, any OpenAI client
145
+ - **Web Dashboard** — chat, model management, server stats at `http://localhost:8080`
146
+ - **Multi-model serving** — `bithub serve 2B-4T falcon3-3B` with model routing
147
+ - **Direct HuggingFace pull** — `bithub pull hf:org/repo` for any GGUF model
148
+ - **Lazy loading** — `bithub serve --lazy` starts backends on first request
149
+
150
+ ## Roadmap
151
+
152
+ - [x] CLI with model registry (8 BitNet models)
153
+ - [x] HuggingFace downloader + bitnet.cpp builder
154
+ - [x] OpenAI-compatible API server
155
+ - [x] Test suite (140+ tests), CI/CD, structured logging
156
+ - [x] Docker, install script, GitHub Releases
157
+ - [x] Interactive REPL with slash commands
158
+ - [x] Multi-model serving with lazy loading
159
+ - [x] Web dashboard (chat, models, server, settings)
160
+ - [ ] Performance benchmarks (`bithub bench`)
161
+ - [ ] Homebrew formula
162
+
163
+ ## Contributing
164
+
165
+ This project is in early development and contributions are very welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
166
+
167
+ ## License
168
+
169
+ MIT — see [LICENSE](LICENSE) for details.
170
+
171
+ ## Acknowledgements
172
+
173
+ - [Microsoft BitNet](https://github.com/microsoft/BitNet) — the inference engine this project wraps
174
+ - [Ollama](https://github.com/ollama/ollama) — the UX inspiration
175
+ - [llama.cpp](https://github.com/ggerganov/llama.cpp) — the foundation BitNet is built on
@@ -0,0 +1,22 @@
1
+ bithub/__init__.py,sha256=Vqhw4gtSQBVS7lDRGbbRIdMnJCxrzlG6fBgoICTdCjw,63
2
+ bithub/api.py,sha256=6N8XiRqwElax_GlxO52MhoI3JBJ4GPv3Ooul-CZzrKY,10828
3
+ bithub/builder.py,sha256=VA7p8Z9F5sWc70-YzY14kYNzgpgWG3P4ludvKhgjD_E,7145
4
+ bithub/cli.py,sha256=AirXUBWb4HksKhAXDi84fg9RVy-9usDYg_LU5g30tcg,14595
5
+ bithub/config.py,sha256=2zZBkU93DE17N26l2m8xPreZLanZZza0NdybawlZoCo,2816
6
+ bithub/dashboard_api.py,sha256=g3_uyRn_h40f_eFy4jni_BqzH9czlmPjDIyaFtW5HYc,1243
7
+ bithub/downloader.py,sha256=UDYZaq1Czyh7ZgGBzWcGwLoKuIb0Xc52jFYWy9Te4Y4,11555
8
+ bithub/logging_setup.py,sha256=SHpGPl2wj6YRqY-SyuigBGuhDEZnalteuU4Wp_6OMds,1470
9
+ bithub/model_manager.py,sha256=-BKgcVQs-d882pIyiwdqIrG-Xq8VXyp4MlnRZ_Sd1WY,6899
10
+ bithub/registry.json,sha256=Bo8sIp_3ZaSJrasY75J48q3HW0OnW2qcenDNMOHykUQ,2087
11
+ bithub/registry.py,sha256=Fa6_ae5BknR_sOZJzZzPHnJkATcMkmyQupW0cAlKY5U,1643
12
+ bithub/repl.py,sha256=WZCKRIOZH02ZiL9LX9_5Z55xRCMRsu9hBAhcNugFiaI,6996
13
+ bithub/server.py,sha256=8y4mrsScImpTuZoA6sYRuUS7So1cSNBjV1vOGMnERe8,6890
14
+ bithub/static/app.js,sha256=fqVlUWgKG59yyDdDq5wf0lMlZHAX3IaVyD6ozwusb14,8670
15
+ bithub/static/index.html,sha256=qxA9-0o3G_6thytdhLjM8kAjIdEWK1ZO16yzqAPHX44,2000
16
+ bithub/static/style.css,sha256=t8BgEtefyZ87jELCn7IqzsxEnWB4H23posARQBATmTU,5674
17
+ bithub-0.1.0.dist-info/licenses/LICENSE,sha256=DvrqM5YkL3MSwUnWHGFIy289JQsd01bKU92rPlSKQos,1080
18
+ bithub-0.1.0.dist-info/METADATA,sha256=kD8aKw5pwp9KChIgU1y4XS3dbNAvhKdrSjGkJNhFwRQ,6029
19
+ bithub-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
20
+ bithub-0.1.0.dist-info/entry_points.txt,sha256=vBjL1kofPTq1ZtcgQ_twHVOMty2WOtrSDk9QGiC5JYc,42
21
+ bithub-0.1.0.dist-info/top_level.txt,sha256=NX6BkXJxeIUE_ClzKaEDOKkUlHSGjCstdE34ScOiTKI,7
22
+ bithub-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ bithub = bithub.cli:cli
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 bitnet-hub 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 @@
1
+ bithub