兄弟姐妹们,我最近最大的感慨就一句:现在的软件更新,比你楼下奶茶店上新品还勤。
你刚把环境装好,转头一看——Python 3.14 都出来了,还是 2025 年 10 月 7 号官宣的那种“正儿八经大版本”。更离谱的是:以前大家吐槽 Python 的 GIL 像个“工位保安”,不让线程并排干活;到 3.14 这波,人家直接把 free-threaded(可关闭 GIL 的版本) 说成“官方支持”了。你说这谁顶得住?前端那边也不消停。Vite 6 早在 2024 年 11 月 26 号就发了,生态越跑越快,还顺手告诉你:Node 版本得跟上,支持 18/20/22+,Node 21 已经被踢出群聊了。你要是还在老 Node 上“将就用”,那就等着脚手架给你甩脸色。鸿蒙这边更热闹:HarmonyOS NEXT 这条路,已经被官方明确成 HarmonyOS 5.0 正式发布 的方向,开发套件也跟着成体系了。很多人之前觉得“鸿蒙开发离我远”,现在你再说这话,就有点像 2016 年说“移动互联网离我远”——说着说着,机会就从你身边溜走了。所以今天我不跟你扯虚的,就干一件市井但实用的事:用 Python 3.14 的新风,配上 uv 这种“快得像开挂”的项目管理工具,做个工位效率小工具:待办 + 一键日报。再用 Vite 6 搭个网页壳子,最后给你塞一段 ArkTS 的网络请求代码——让它在鸿蒙里也能拉数据。你学会这套,别说写简历了,办公室里随手搞个小工具,隔壁组都得来问你“你这咋弄的”。

入门技术:今天就认准这几样“好使的家伙”
Python 3.14: 今年(2025)的大动作很多,最吸引眼球的就是 free-threaded 官方支持,还有 t-strings(模板字符串,t 前缀,长得像 f-string 但返回的是 Template 对象,不是普通 str),以及一堆底层优化。
uv: 这玩意儿我愿称之为“Python 项目管理的加速器”。官方自己说得很直白:一个工具顶一堆(pip、pip-tools、pipx、poetry、virtualenv、pyenv…),还号称比 pip 快 10-100 倍。你就当它是“装依赖不再磨叽”的神器。FastAPI: 让你零基础也能写出一个能跑、能测、能对接的 API。
Vite 6: 现在前端想快,Vite 基本就是标配,尤其写个小工具页面,真香。
ArkTS(鸿蒙): 你别怕,它就是更“规矩”的 TypeScript 风格,网络请求也有现成模块能用。
主内容:工位待办 + 一键日报,三端都能用

我先把丑话说前头:这个实战是“入门级但真能跑”。数据先放内存里(重启就没了),因为我们今天要的不是“搞个宇宙级系统”,要的是十分钟上手、立刻见效果。你真要上线,再换数据库、加登录、做权限,那是下一篇的事。
先把后端整起来:uv + FastAPI,快得离谱
先装 uv。官方给了很直接的方式(你也可以用包管理器装,这里给最常见的命令):
```bash
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows PowerShell(按官方写法来)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
```
然后开个项目,装依赖,跑起来:
```bash
uv init office-helper
cd office-helper
装 FastAPI + Uvicorn
uv add fastapi "uvicorn[standard]"
直接运行(uv 会自动给你搞虚拟环境)
uv run uvicorn app:app --reload --port 8000
```
接下来创建 `app.py`,复制粘贴就能跑:
```python
from datetime import datetime
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
app = FastAPI(title="工位效率小助手")
class TodoIn(BaseModel):
text: str
class Todo(TodoIn):
id: int
done: bool = False
created_at: str
TODOS: list[Todo] = []
@app.get("/health")
def health():
return {"ok": True, "ts": datetime.now().isoformat(timespec="seconds")}
@app.get("/todos")
def list_todos():
return TODOS
@app.post("/todos", status_code=201)
def add_todo(item: TodoIn):
text = item.text.strip()
if not text:
raise HTTPException(status_code=400, detail="text 不能为空")
todo = Todo(
id=(TODOS[-1].id + 1 if TODOS else 1),
text=text,
done=False,
created_at=datetime.now().isoformat(timespec="seconds"),
)
TODOS.append(todo)
return todo
@app.patch("/todos/{todo_id}")
def toggle(todo_id: int):
for t in TODOS:
if t.id == todo_id:
t.done = not t.done
return t
raise HTTPException(status_code=404, detail="找不到这个 todo")
@app.delete("/todos/{todo_id}", status_code=204)
def remove(todo_id: int):
for idx, t in enumerate(TODOS):
if t.id == todo_id:
TODOS.pop(idx)
return
raise HTTPException(status_code=404, detail="找不到这个 todo")
@app.get("/daily")
def daily():
total = len(TODOS)
done = sum(1 for t in TODOS if t.done)
undone = total - done
msg = (
f"【今日进度】已完成 {done} 项,待跟进 {undone} 项。"
f"(生成时间 {datetime.now().strftime('%Y-%m-%d %H:%M')})"
)
return {"text": msg, "total": total, "done": done, "undone": undone}
```
现在你浏览器打开:
* `http://127.0.0.1:8000/health`
* `http://127.0.0.1:8000/todos`
如果能看到 JSON,恭喜你,后端已经“活了”。
再来个网页壳:Vite 6 一把梭,写个能用的界面
你前端不想学框架都行,先用最朴素的 Vanilla 模板,能跑就是硬道理。
```bash
# 建议用 pnpm(你用 npm/yarn 也行)
pnpm create vite todo-web --template vanilla
cd todo-web
pnpm install
pnpm dev
```
Vite 6 是 2024-11-26 发的,Node 版本要求也写得明明白白:18/20/22+,别拿太老的 Node 硬顶。接着搞个代理,不然跨域能把新手劝退。编辑 `vite.config.js`:
```js
import { defineConfig } from "vite";
export default defineConfig({
server: {
proxy: {
"/api": {
target: "http://127.0.0.1:8000",
changeOrigin: true,
rewrite: (p) => p.replace(/^\/api/, ""),
},
},
},
});
```
然后把 `src/main.js` 改成这样(依旧是“能跑就赢”风格):
```js
const $ = (sel) => document.querySelector(sel);
async function api(path, options = {}) {
const res = await fetch(`/api${path}`, {
headers: { "Content-Type": "application/json" },
...options,
});
if (!res.ok) throw new Error(await res.text());
// delete 204 没 body
if (res.status === 204) return null;
return res.json();
}
async function refresh() {
const list = await api("/todos");
$("#list").innerHTML = list
.map(
(t) => `
<li>
<label style="cursor:pointer;">
<input type="checkbox" ${t.done ? "checked" : ""} data-id="${t.id}" />
<span>${t.text}</span>
</label>
<button data-del="${t.id}">删</button>
</li>
`
)
.join("");
}
async function addTodo() {
const text = $("#text").value.trim();
if (!text) return;
await api("/todos", { method: "POST", body: JSON.stringify({ text }) });
$("#text").value = "";
refresh();
}
async function daily() {
const r = await api("/daily");
$("#daily").textContent = r.text;
}
document.body.innerHTML = `
<div style="max-width: 520px; margin: 24px auto; font-family: sans-serif;">
<h2>工位待办小助手</h2>
<div style="display:flex; gap:8px;">
<input id="text" placeholder="写点你今天要干啥..." style="flex:1; padding:8px;" />
<button id="add">加一条</button>
</div>
<ul id="list" style="margin-top:16px; line-height: 2;"></ul>
<div style="margin-top:16px; display:flex; gap:8px;">
<button id="dailyBtn">一键生成日报</button>
<div id="daily" style="flex:1;"></div>
</div>
</div>
`;
$("#add").addEventListener("click", addTodo);
$("#dailyBtn").addEventListener("click", daily);
document.addEventListener("click", async (e) => {
const cb = e.target.closest("input[type=checkbox][data-id]");
if (cb) {
await api(`/todos/${cb.dataset.id}`, { method: "PATCH" });
refresh();
return;
}
const del = e.target.closest("button[data-del]");
if (del) {
await api(`/todos/${del.dataset.del}`, { method: "DELETE" });
refresh();
}
});
refresh();
```
打开 Vite 的地址(终端会告诉你,一般是 `http://localhost:5173`),你就能在网页上点点点了。到这里,你已经能在工位上“凭空造一个工具”了。你别小看这玩意儿:很多团队里的内部小系统,就是这么从一个小页面长成“核心平台”的。
最后给鸿蒙来一口:ArkTS 拉一下我们的接口

你可能会说:“鸿蒙我没碰过啊。”没事,今天我们只做一件事:发个 HTTP 请求,把待办拉下来显示。 这就是最朴素的“实战入门”。ArkTS 里常见写法就是用 `@ohos.net.http` 这套模块,创建请求、request、拿结果。下面这段就是典型封装思路:
```ts
import http from '@ohos.net.http';
export function httpGet(url: string): Promise<string> {
let httpRequest = http.createHttp();
return httpRequest.request(url, {
method: http.RequestMethod.GET,
readTimeout: 10000,
connectTimeout: 10000,
header: {
'Content-Type': 'application/json'
}
}).then((value: http.HttpResponse) => {
if (value.responseCode === 200) {
return `${value.result}`;
}
return '';
}).catch(() => {
httpRequest.destroy();
return '';
});
}
```
有了这个,你在页面里就能这么用(示意写法,核心就两步:请求 + JSON.parse):
```ts
import { httpGet } from './Net';
@Entry
@Component
struct TodoPage {
@State text: string = '加载中...';
aboutToAppear() {
// 注意:这里的地址要换成你电脑局域网 IP,真机才能访问
// 比如 http://192.168.1.8:8000/todos
httpGet('http://192.168.1.8:8000/todos').then((s) => {
if (!s) {
this.text = '没拉到数据,检查网络和地址';
return;
}
const arr = JSON.parse(s);
this.text = arr.map((t) => (t.done ? '✅ ' : '⬜ ') + t.text).join('\n');
});
}
build() {
Column() {
Text('鸿蒙端待办预览').fontSize(20).margin({ bottom: 12 })
Text(this.text).fontSize(16)
}.padding(16)
}
}
```
你看,鸿蒙端也不神秘:能发请求、能渲染 UI,你就能对接你自己的后端。 这才是“实战入门”的价值——先跑通链路,再谈高大上。
来点“2025 新规定/新趋势”的吐槽与感慨
现在做开发,真不是“学会一门语言就稳了”,而是“你得学会跟更新做朋友”。Python 3.14 这波更新里,还有个小细节特别像“新规矩”:从 3.14 开始,发布包不再提供 PGP 签名,改推荐用 Sigstore。你看,连“怎么验证安装包”都在升级玩法。前端这边也一样:Vite 6 把 Node 支持范围写得清清楚楚,就是告诉你“别抱着老环境不撒手”。鸿蒙更不用说,HarmonyOS 5.0 这波“体系化”之后,你再把它当成小众,就容易错过一波“新平台红利”。

#Python #Python3.14 #uv工具 #FastAPI #Vite6 #前端开发 #全栈开发 #鸿蒙开发 #HarmonyOS5 #ArkTS #零基础学编程 #程序员日常 #职场效率 #效率工具 #开源项目 #工程化 #学习笔记