NPworks — Numerical Physics Works, 计算物理交互式教材
Project description
NPworks — Numerical Physics Works
计算物理交互式教材,基于 PyQt5 + QScintilla 的桌面 IDE 应用,内置 7 章 27 节 Python 物理计算示例。
安装与启动
pip install npworks
npworks
启动后左侧显示中文章节目录,右侧为多标签页代码编辑器,底部为输出/IPython/终端面板。点击章节加载对应 Python 程序,可直接编辑和运行。
核心特性
- 零配置:
pip install一键安装,命令行直接启动 - 内置教材:7 章 27 节 Python 物理计算示例,打包在安装包中
- QScintilla 编辑器:代码折叠、自动补全、括号匹配、智能缩进、缩进参考线
- 多标签页:同时打开多个文件/章节,标签页可拖拽排序和关闭
- 双向导航:目录树与标签页联动,点击目录打开代码,切换标签高亮目录
- 三面板底部区:输出面板(stdout/stderr)、IPython 终端(Jupyter 内核)、Shell 终端(PowerShell)
- 查找替换:支持查找/替换/全部替换,大小写敏感开关
- 亮色/暗色主题:VS Code 风格双主题,偏好自动持久化
- 代码执行:QProcess 异步执行,不阻塞 GUI,支持 stdin 交互
- 中文支持:matplotlib 自动配置中文字体
教材章节
共 7 章 27 节,每节一个独立可运行的 Python 脚本:
| 章 | 内容 |
|---|---|
| 第1章 Python 基础 | Hello World, 变量与数据类型, 控制流, 函数, 文件读写 |
| 第2章 数值计算 | NumPy 基础, 梯形积分, 辛普森积分, 欧拉法 ODE, Runge-Kutta, Matplotlib |
| 第3章 经典力学 | 抛体运动, 行星轨道, 简谐振子, 阻尼振子, 双摆 |
| 第4章 电磁学 | 电场, 磁场 |
| 第5章 热力学与统计物理 | 随机行走, 分子动力学, 热传导 |
| 第6章 量子力学 | 波函数, 薛定谔方程, 量子隧穿 |
| 第7章 波动与光学 | 波动方程, 干涉, 衍射 |
项目结构
三包 Monorepo 结构,IDE 与内容松耦合,可独立更新:
- npworks — 元包,安装后自动引入 IDE 和教材内容
- npworks-ide — 基于 PyQt5 + QScintilla 的 IDE 界面
- npworks-content — 教材内容(7 章 27 个 .py 脚本 + YAML 元数据)
独立更新示例:
pip install --upgrade npworks-content # 仅更新教材内容
pip install --upgrade npworks-ide # 仅更新 IDE 界面
pip install --upgrade npworks # 同时更新
依赖
| 包 | 用途 |
|---|---|
| PyQt5 >= 5.15 | GUI 框架 |
| QScintilla >= 2.13 | 代码编辑器 |
| NumPy >= 1.20 | 数值计算 |
| SciPy >= 1.7 | 科学计算 |
| Matplotlib >= 3.4 | 绘图 |
| qtconsole >= 5.0 | IPython 终端 |
| Pygments >= 2.0 | 语法高亮 |
| PyYAML >= 6.0 | 内容元数据 |
链接
- 源代码: https://github.com/lzrhzhu/NPworks
- 问题反馈: https://github.com/lzrhzhu/NPworks/issues
- PyPI: https://pypi.org/project/npworks/
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
npworks-0.0.2.tar.gz
(4.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file npworks-0.0.2.tar.gz.
File metadata
- Download URL: npworks-0.0.2.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
618beca4256552af7e4b2235cbf1d5aa48e768987a0a2698c717f4c570beb94c
|
|
| MD5 |
a53fc377fe9cb603bac3321bec7ab969
|
|
| BLAKE2b-256 |
c865ac045b10f3c39cdaa902e04299b35223bd23c4041db57a84f78e5d972a52
|
File details
Details for the file npworks-0.0.2-py3-none-any.whl.
File metadata
- Download URL: npworks-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c98a4139f51e5aef0992674e5ec3db734d26c1d5e0a9d621ae61edd93265353
|
|
| MD5 |
96c1bd2d58ab7d287ceae9aa58757e59
|
|
| BLAKE2b-256 |
27be7fd99cf0ac62464e475ce6b9f647212cf79b1d6c2f4bf9c6758c60fba69c
|