Skip to content

Commit 33b2ebc

Browse files
committed
feat(pypi): add Python bootstrapper package and PyPI publish workflow
- python-installer/pyproject.toml: hatchling build, console entry point - techscript/__init__.py: package metadata - techscript/platform_detect.py: OS/arch/Termux detection - techscript/downloader.py: GitHub Releases asset downloader - techscript/installer.py: binary install, PATH config, verify, uninstall - techscript/launcher.py: tsc command forwarder - techscript/__main__.py: CLI (install/uninstall/version/check/run) - tests/test_installer.py: 18 unit tests (no external deps) - .github/workflows/pypi-publish.yml: Trusted Publishing on release - README.md: pip install method, PyPI badge, and link added Package size: 14 KB wheel (well under 200 KB limit)
1 parent d1128d1 commit 33b2ebc

13 files changed

Lines changed: 1324 additions & 4 deletions

File tree

.github/workflows/pypi-publish.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
id-token: write # Required for Trusted Publishing (OIDC)
10+
11+
jobs:
12+
build:
13+
name: Build Python wheel and sdist
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.12"
22+
23+
- name: Install build tools
24+
run: pip install build hatchling
25+
26+
- name: Build wheel and sdist
27+
working-directory: python-installer
28+
run: python -m build
29+
30+
- name: Verify package size is under 200 KB
31+
working-directory: python-installer
32+
run: |
33+
for f in dist/*.whl dist/*.tar.gz; do
34+
size=$(stat -c%s "$f")
35+
echo " $f: ${size} bytes"
36+
if [ "$size" -gt 204800 ]; then
37+
echo "ERROR: $f exceeds 200 KB limit ($size bytes)"
38+
exit 1
39+
fi
40+
done
41+
42+
- name: Upload dist artifacts
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: python-dist
46+
path: python-installer/dist/
47+
48+
test:
49+
name: Run installer tests
50+
needs: build
51+
strategy:
52+
matrix:
53+
os: [ubuntu-latest, windows-latest, macos-latest]
54+
python-version: ["3.8", "3.11", "3.12"]
55+
runs-on: ${{ matrix.os }}
56+
steps:
57+
- uses: actions/checkout@v4
58+
59+
- name: Set up Python ${{ matrix.python-version }}
60+
uses: actions/setup-python@v5
61+
with:
62+
python-version: ${{ matrix.python-version }}
63+
64+
- name: Install package
65+
working-directory: python-installer
66+
run: pip install -e .
67+
68+
- name: Run tests
69+
working-directory: python-installer
70+
run: python -m unittest discover -s tests -v
71+
72+
publish:
73+
name: Publish to PyPI
74+
needs: [build, test]
75+
runs-on: ubuntu-latest
76+
environment: pypi
77+
steps:
78+
- name: Download dist artifacts
79+
uses: actions/download-artifact@v4
80+
with:
81+
name: python-dist
82+
path: dist/
83+
84+
- name: Publish to PyPI (Trusted Publishing)
85+
uses: pypa/gh-action-pypi-publish@release/v1
86+
# No token needed — uses OIDC Trusted Publishing
87+
# Configure Trusted Publisher at: https://pypi.org/manage/project/techscript/settings/publishing/

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
[![Built with Rust](https://img.shields.io/badge/built%20in-Rust-D8B4FE?style=for-the-badge&logo=rust&logoColor=white)](https://www.rust-lang.org/)
2020
[![Platform](https://img.shields.io/badge/Platform-Cross--Platform-E0F2FE?style=for-the-badge)](https://github.com/Tcode-Motion/techscript/releases)
2121
[![VS Code Extension](https://img.shields.io/badge/VS%20Code-Extension-007ACC?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://marketplace.visualstudio.com/items?itemName=tanmoy.techscript)
22+
[![PyPI](https://img.shields.io/pypi/v/techscript?style=for-the-badge&color=0DF28B&logo=pypi&logoColor=white)](https://pypi.org/project/techscript/)
2223
[![Documentation](https://img.shields.io/badge/Docs-Read-059669?style=for-the-badge)](docs/index.md)
2324
[![Open Issues](https://img.shields.io/github/issues-raw/Tcode-Motion/techscript?style=for-the-badge&color=ef4444&label=Issues)](https://github.com/Tcode-Motion/techscript/issues)
2425
[![Stars](https://img.shields.io/github/stars/Tcode-Motion/techscript?style=for-the-badge&color=0DF28B&label=⭐)](https://github.com/Tcode-Motion/techscript/stargazers)
@@ -123,30 +124,38 @@ graph TD
123124

124125
## 📦 Installation
125126

127+
### 🐍 Via pip — All Platforms (Recommended)
128+
```bash
129+
pip install techscript
130+
techscript install
131+
```
132+
The PyPI package auto-detects your OS and downloads the correct native binary from GitHub Releases.
133+
126134
### 🪟 Windows Setup
127135
1. Go to the [Releases](https://github.com/Tcode-Motion/techscript/releases) page on GitHub.
128136
2. Download **`TechScript_Setup.exe`** (or `TechScript_Portable.zip` for a zero-install portable version).
129137
3. Run the installer to configure your environment:
130-
* Installs the native Rust compiler (`tsc`) and VM (`tsvm`).
138+
* Installs the native compiler (`tsc`) and VM.
131139
* Automatically adds `tsc` to your system environment `PATH`.
132-
* Configures file associations for `.txs` source scripts.
140+
* Configures file associations for `.txs` scripts.
133141

134142
### 🐧 Linux / 🍎 macOS Setup
135-
Execute the official one-liner in your terminal to download and configure the native binary:
136143
```bash
137144
curl -fsSL https://raw.githubusercontent.com/Tcode-Motion/techscript/main/scripts/install.sh | bash
138145
```
139146

140147
### 🤖 Android (Termux) Setup
141-
Run these commands in Termux to download and configure TechScript natively on Android:
142148
```bash
143149
pkg update
144150
pkg install curl
145151
curl -fsSL https://raw.githubusercontent.com/Tcode-Motion/techscript/main/scripts/install.sh | bash
146152
```
147153

154+
> **Homebrew** (`brew install techscript`), **Winget** and **Scoop** support coming soon!
155+
148156
---
149157

158+
150159
## 🚀 Quick Start
151160

152161
1. Scaffold a new project:
@@ -170,6 +179,7 @@ curl -fsSL https://raw.githubusercontent.com/Tcode-Motion/techscript/main/script
170179
* **GitHub Repository**: [https://github.com/Tcode-Motion/techscript](https://github.com/Tcode-Motion/techscript)
171180
* **GitHub Discussions**: [https://github.com/Tcode-Motion/techscript/discussions](https://github.com/Tcode-Motion/techscript/discussions)
172181
* **VS Code Extension**: [TechScript 2.0 on VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=tanmoy.techscript)
182+
* **PyPI Package**: [pypi.org/project/techscript](https://pypi.org/project/techscript/)
173183
* **YouTube Channel**: [@tcodemotin on YouTube](https://www.youtube.com/@tcodemotin)
174184
* **Author Profile**: [@Tcode-Motion on GitHub](https://github.com/Tcode-Motion)
175185
* **Discord Community**: [Join Discord (Community Chat)](https://discord.gg/tRtNbuDUr)

python-installer/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Tcode-Motion
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.

python-installer/README.md

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
# TechScript — Python Installer
2+
3+
<div align="center">
4+
5+
[![PyPI](https://img.shields.io/pypi/v/techscript?style=for-the-badge&color=0DF28B)](https://pypi.org/project/techscript/)
6+
[![Python](https://img.shields.io/pypi/pyversions/techscript?style=for-the-badge)](https://pypi.org/project/techscript/)
7+
[![License](https://img.shields.io/badge/license-MIT-green?style=for-the-badge)](../LICENSE)
8+
[![GitHub](https://img.shields.io/badge/GitHub-Tcode--Motion%2Ftechscript-black?style=for-the-badge)](https://github.com/Tcode-Motion/techscript)
9+
10+
**The official Python-based installer for the TechScript 2.0 programming language.**
11+
12+
</div>
13+
14+
---
15+
16+
## What This Package Does
17+
18+
This is a **lightweight bootstrapper only** — it contains no compiler binaries.
19+
20+
When you run `techscript install`, it:
21+
1. Detects your OS and CPU architecture
22+
2. Fetches the correct native binary from [GitHub Releases](https://github.com/Tcode-Motion/techscript/releases/latest)
23+
3. Installs it into your PATH
24+
4. Verifies the installation by running `tsc version`
25+
26+
> **The actual TechScript compiler remains distributed via GitHub Releases.**
27+
> This PyPI package is under 200 KB and contains only Python code.
28+
29+
---
30+
31+
## Supported Platforms
32+
33+
| Platform | Architecture | Status |
34+
|---|---|---|
35+
| Windows | x64 | ✅ Supported |
36+
| Windows | ARM64 | ✅ Supported |
37+
| Linux | x64 | ✅ Supported |
38+
| Linux | ARM64 | ✅ Supported |
39+
| macOS | Intel (x64) | ✅ Supported |
40+
| macOS | Apple Silicon (ARM64) | ✅ Supported |
41+
| Android Termux | ARM64 | ✅ Supported |
42+
| Android Termux | ARMv7 | 🔄 Optional |
43+
44+
---
45+
46+
## Installation
47+
48+
### Via pip (Recommended)
49+
50+
```bash
51+
pip install techscript
52+
techscript install
53+
```
54+
55+
### Via curl — Linux / macOS
56+
57+
```bash
58+
curl -fsSL https://raw.githubusercontent.com/Tcode-Motion/techscript/main/scripts/install.sh | bash
59+
```
60+
61+
### Via installer.exe — Windows
62+
63+
Download `TechScript_Setup.exe` from [GitHub Releases](https://github.com/Tcode-Motion/techscript/releases/latest).
64+
65+
### Via Termux — Android
66+
67+
```bash
68+
pkg update
69+
pkg install curl python
70+
# Option 1: Python installer
71+
pip install techscript
72+
techscript install
73+
74+
# Option 2: Shell installer
75+
curl -fsSL https://raw.githubusercontent.com/Tcode-Motion/techscript/main/scripts/install.sh | bash
76+
```
77+
78+
### Via Homebrew — macOS *(coming soon)*
79+
80+
```bash
81+
brew install tcode-motion/tap/techscript
82+
```
83+
84+
### Via Winget — Windows *(coming soon)*
85+
86+
```powershell
87+
winget install Tcode-Motion.TechScript
88+
```
89+
90+
### Via Scoop — Windows *(coming soon)*
91+
92+
```powershell
93+
scoop install techscript
94+
```
95+
96+
---
97+
98+
## Usage
99+
100+
### Install the compiler
101+
102+
```bash
103+
techscript install
104+
```
105+
106+
### Force reinstall / update
107+
108+
```bash
109+
techscript install --force
110+
```
111+
112+
### Check installed version
113+
114+
```bash
115+
techscript version
116+
```
117+
118+
### Check for updates
119+
120+
```bash
121+
techscript check
122+
```
123+
124+
### Uninstall
125+
126+
```bash
127+
techscript uninstall
128+
```
129+
130+
### Forward commands to tsc
131+
132+
```bash
133+
# These are equivalent:
134+
techscript run myfile.txs
135+
tsc run myfile.txs
136+
```
137+
138+
---
139+
140+
## Quick Start
141+
142+
After installing:
143+
144+
```bash
145+
# Create a new project
146+
tsc new hello_world
147+
cd hello_world
148+
149+
# Run it
150+
tsc run
151+
```
152+
153+
Your first `src/main.txs`:
154+
155+
```txs
156+
say "Hello, World! 🌍"
157+
name = ask "What is your name? "
158+
say $"Welcome, {name}! You are running TechScript 2.0."
159+
```
160+
161+
---
162+
163+
## Install Locations
164+
165+
| Platform | Location |
166+
|---|---|
167+
| Windows | `%LOCALAPPDATA%\TechScript\bin\tsc.exe` |
168+
| Linux / macOS | `~/.local/bin/tsc` |
169+
| Termux | `$PREFIX/bin/tsc` |
170+
171+
---
172+
173+
## Debug Mode
174+
175+
Enable verbose output and Python tracebacks:
176+
177+
```bash
178+
techscript install --debug
179+
```
180+
181+
---
182+
183+
## Requirements
184+
185+
- Python 3.8 or newer
186+
- Internet access (to download the compiler binary)
187+
- The `requests` library (installed automatically)
188+
189+
---
190+
191+
## Development
192+
193+
```bash
194+
git clone https://github.com/Tcode-Motion/techscript
195+
cd techscript/python-installer
196+
197+
# Install in editable mode
198+
pip install -e .
199+
200+
# Run tests
201+
python -m pytest tests/ -v
202+
203+
# Build wheel and sdist
204+
python -m build
205+
```
206+
207+
---
208+
209+
## Links
210+
211+
| Resource | Link |
212+
|---|---|
213+
| 🌐 Website | [techscript.is-a.dev](https://techscript.is-a.dev) |
214+
| 📦 GitHub | [Tcode-Motion/techscript](https://github.com/Tcode-Motion/techscript) |
215+
| 🐍 PyPI | [pypi.org/project/techscript](https://pypi.org/project/techscript/) |
216+
| 💻 VS Code Extension | [marketplace.visualstudio.com](https://marketplace.visualstudio.com/items?itemName=tanmoy.techscript) |
217+
| 🐛 Issues | [GitHub Issues](https://github.com/Tcode-Motion/techscript/issues) |
218+
| 💬 Discussions | [GitHub Discussions](https://github.com/Tcode-Motion/techscript/discussions) |
219+
220+
---
221+
222+
## License
223+
224+
MIT License — Copyright © 2026 [Tcode-Motion](https://github.com/Tcode-Motion)

0 commit comments

Comments
 (0)