bstart-trb 0.1.0__tar.gz → 0.2.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.
- bstart_trb-0.2.0/.python-version +1 -0
- bstart_trb-0.2.0/BUILDING.md +117 -0
- bstart_trb-0.2.0/PACKAGE_SUMMARY.md +208 -0
- bstart_trb-0.2.0/PKG-INFO +949 -0
- bstart_trb-0.2.0/PUBLISHING.md +224 -0
- bstart_trb-0.2.0/README.md +937 -0
- bstart_trb-0.2.0/README_EN.md +937 -0
- {bstart_trb-0.1.0/slice_wrapper → bstart_trb-0.2.0/bstart_trb}/__init__.py +1 -1
- bstart_trb-0.2.0/bstart_trb/_taper_slice.cp311-win_amd64.pyd +0 -0
- bstart_trb-0.2.0/bstart_trb/libtaper_sl.J4R3HUMRYTOGZPKAVTEOISVEHZMIJTJT.gfortran-win_amd64.dll +0 -0
- bstart_trb-0.2.0/demo.xlsx +0 -0
- bstart_trb-0.2.0/main.py +306 -0
- bstart_trb-0.2.0/meson.build +56 -0
- bstart_trb-0.2.0/pyproject.toml +44 -0
- bstart_trb-0.2.0/test_install.py +80 -0
- bstart_trb-0.2.0/uv.lock +251 -0
- bstart_trb-0.1.0/PKG-INFO +0 -165
- bstart_trb-0.1.0/pyproject.toml +0 -61
- bstart_trb-0.1.0/slice_wrapper/_taper_slice.cp312-win_amd64.pyd +0 -0
- {bstart_trb-0.1.0 → bstart_trb-0.2.0}/.gitignore +0 -0
- {bstart_trb-0.1.0 → bstart_trb-0.2.0}/LICENSE +0 -0
- {bstart_trb-0.1.0 → bstart_trb-0.2.0}/README_PYPI.md +0 -0
- {bstart_trb-0.1.0/slice_wrapper → bstart_trb-0.2.0/bstart_trb}/_taper_slice.pyi +0 -0
- {bstart_trb-0.1.0/slice_wrapper → bstart_trb-0.2.0/bstart_trb}/models.py +0 -0
- {bstart_trb-0.1.0/slice_wrapper → bstart_trb-0.2.0/bstart_trb}/py.typed +0 -0
- {bstart_trb-0.1.0/slice_wrapper → bstart_trb-0.2.0/bstart_trb}/wrapper.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Building Guide
|
|
2
|
+
|
|
3
|
+
This guide explains how to build `bstart-trb` wheel packages for distribution.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
### Windows
|
|
8
|
+
|
|
9
|
+
1. **Install MSYS2** (provides gfortran):
|
|
10
|
+
- Download from https://www.msys2.org/
|
|
11
|
+
- After installation, open MSYS2 terminal and run:
|
|
12
|
+
```bash
|
|
13
|
+
pacman -S mingw-w64-ucrt-x86_64-gcc-fortran
|
|
14
|
+
```
|
|
15
|
+
- Add `C:\msys64\ucrt64\bin` to your system PATH
|
|
16
|
+
|
|
17
|
+
2. **Install Python 3.10+**:
|
|
18
|
+
- Download from https://www.python.org/downloads/
|
|
19
|
+
|
|
20
|
+
3. **Install uv** (recommended):
|
|
21
|
+
```powershell
|
|
22
|
+
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### macOS
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Install gfortran
|
|
29
|
+
brew install gfortran
|
|
30
|
+
|
|
31
|
+
# Install uv
|
|
32
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Linux
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Install gfortran
|
|
39
|
+
sudo apt install gfortran # Debian/Ubuntu
|
|
40
|
+
sudo yum install gcc-gfortran # RHEL/CentOS
|
|
41
|
+
|
|
42
|
+
# Install uv
|
|
43
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Build Steps
|
|
49
|
+
|
|
50
|
+
### 1. Clone the repository
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
git clone https://github.com/youjunxiaji/bstart-trb.git
|
|
54
|
+
cd bstart-trb
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 2. Install dependencies with uv
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
uv sync
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
This automatically creates a virtual environment and installs all dependencies.
|
|
64
|
+
|
|
65
|
+
### 3. Build the wheel
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
uv run python -m build --wheel
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The wheel file will be created in the `dist/` directory.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Alternative: Direct f2py Build
|
|
76
|
+
|
|
77
|
+
If meson build fails, you can compile the Fortran module directly:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
cd slice_wrapper
|
|
81
|
+
uv run python -m numpy.f2py -c taper_slice.f90 -m _taper_slice
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Publishing to PyPI
|
|
87
|
+
|
|
88
|
+
### 1. Install twine
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
uv pip install twine
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 2. Create PyPI API token
|
|
95
|
+
|
|
96
|
+
1. Log in to https://pypi.org
|
|
97
|
+
2. Go to Account settings → API tokens → Add API token
|
|
98
|
+
3. Save the token securely
|
|
99
|
+
|
|
100
|
+
### 3. Upload the wheel
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
uv run twine upload dist/*.whl
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
When prompted:
|
|
107
|
+
- Username: `__token__`
|
|
108
|
+
- Password: Your API token (starts with `pypi-`)
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Notes
|
|
113
|
+
|
|
114
|
+
- Each Python version (3.10, 3.11, 3.12) needs a separate wheel
|
|
115
|
+
- Windows wheels have `.whl` suffix like `*-win_amd64.whl`
|
|
116
|
+
- macOS wheels: `*-macosx_*_arm64.whl` (Apple Silicon) or `*-macosx_*_x86_64.whl` (Intel)
|
|
117
|
+
- Linux wheels: `*-manylinux*.whl`
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# bstart-trb PyPI 包配置总结
|
|
2
|
+
|
|
3
|
+
## 完成的工作
|
|
4
|
+
|
|
5
|
+
### 1. 包配置 (`pyproject.toml`)
|
|
6
|
+
|
|
7
|
+
✅ **配置内容**:
|
|
8
|
+
- 包名:`bstart-trb`
|
|
9
|
+
- 版本:`0.1.0`
|
|
10
|
+
- 描述:Cylindrical/Tapered Roller Bearing Slice Stress Calculation Module
|
|
11
|
+
- Python 版本:>= 3.12
|
|
12
|
+
- 许可证:MIT
|
|
13
|
+
- 依赖:仅 `numpy >= 2.0.0`
|
|
14
|
+
|
|
15
|
+
✅ **构建配置**:
|
|
16
|
+
- 使用 `hatchling` 作为构建后端
|
|
17
|
+
- 仅打包 `slice_wrapper` 目录
|
|
18
|
+
- 包含预编译的二进制文件(`.pyd`)
|
|
19
|
+
- 排除 Fortran 源码(`.f90`)和构建脚本(`build.py`)
|
|
20
|
+
|
|
21
|
+
### 2. 文件修改
|
|
22
|
+
|
|
23
|
+
✅ **新增文件**:
|
|
24
|
+
- `README_PYPI.md` - PyPI 包说明文档(英文)
|
|
25
|
+
- `PUBLISHING.md` - 发布指南(中文)
|
|
26
|
+
- `test_install.py` - 安装测试脚本
|
|
27
|
+
- `PACKAGE_SUMMARY.md` - 本文件
|
|
28
|
+
|
|
29
|
+
✅ **修改文件**:
|
|
30
|
+
- `pyproject.toml` - 完整的包配置
|
|
31
|
+
- `.gitignore` - 允许跟踪 `.pyd` 文件
|
|
32
|
+
- `slice_wrapper/__init__.py` - 版本号改为 0.1.0
|
|
33
|
+
|
|
34
|
+
✅ **添加到 Git**:
|
|
35
|
+
- `slice_wrapper/_taper_slice.cp312-win_amd64.pyd` - 预编译的 Fortran 模块
|
|
36
|
+
|
|
37
|
+
### 3. 构建和测试
|
|
38
|
+
|
|
39
|
+
✅ **构建结果**:
|
|
40
|
+
```
|
|
41
|
+
dist/
|
|
42
|
+
├── bstart_trb-0.1.0-py3-none-any.whl # Wheel 包
|
|
43
|
+
└── bstart_trb-0.1.0.tar.gz # 源码包
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
✅ **包内容验证**:
|
|
47
|
+
- ✅ Python 源码文件
|
|
48
|
+
- ✅ 预编译的 `.pyd` 文件(139 KB)
|
|
49
|
+
- ✅ 类型提示文件(`.pyi`)
|
|
50
|
+
- ✅ LICENSE 文件
|
|
51
|
+
- ❌ Fortran 源码(已排除)
|
|
52
|
+
- ❌ 构建脚本(已排除)
|
|
53
|
+
|
|
54
|
+
✅ **功能测试**:
|
|
55
|
+
```
|
|
56
|
+
[OK] 包版本: 0.1.0
|
|
57
|
+
[OK] Fortran 模块可用: True
|
|
58
|
+
[OK] 收敛: True
|
|
59
|
+
[OK] 错误码: 0
|
|
60
|
+
[OK] 滚子变形: 0.006387 mm
|
|
61
|
+
[OK] 平衡载荷: 1338.12 N
|
|
62
|
+
[OK] 最大应力: 1299 MPa
|
|
63
|
+
[SUCCESS] 所有测试通过!
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 包的特点
|
|
67
|
+
|
|
68
|
+
### ✅ 优点
|
|
69
|
+
|
|
70
|
+
1. **无需编译**:用户安装时不需要 Fortran 编译器
|
|
71
|
+
2. **开箱即用**:pip 安装后立即可用
|
|
72
|
+
3. **保密源码**:不包含 Fortran 源代码
|
|
73
|
+
4. **类型安全**:完整的类型提示
|
|
74
|
+
5. **体积小**:仅约 150 KB
|
|
75
|
+
|
|
76
|
+
### ⚠️ 限制
|
|
77
|
+
|
|
78
|
+
1. **平台限制**:当前只支持 Windows x64
|
|
79
|
+
2. **Python 版本**:仅支持 Python 3.12
|
|
80
|
+
3. **扩展性**:添加新平台需要重新编译
|
|
81
|
+
|
|
82
|
+
## 安装和使用
|
|
83
|
+
|
|
84
|
+
### 用户安装
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pip install bstart-trb
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 快速开始
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from slice_wrapper import (
|
|
94
|
+
slice_stress,
|
|
95
|
+
RollerParams,
|
|
96
|
+
RacewayParams,
|
|
97
|
+
CrownType,
|
|
98
|
+
RacewayType,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
# 定义参数
|
|
102
|
+
roller = RollerParams(
|
|
103
|
+
d1=10.0, d2=10.0, length=9.6,
|
|
104
|
+
crown_type=CrownType.LOGARITHMIC,
|
|
105
|
+
curve_q=14100.0
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
raceway = RacewayParams(
|
|
109
|
+
diameter=-150.0,
|
|
110
|
+
raceway_type=RacewayType.OUTER
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
# 计算
|
|
114
|
+
result = slice_stress(roller, raceway, load=1340.86, n_slice=30)
|
|
115
|
+
print(f"Max stress: {result.max_stress:.0f} MPa")
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## 发布流程
|
|
119
|
+
|
|
120
|
+
### 1. 测试 PyPI(推荐)
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# 上传到测试环境
|
|
124
|
+
uv run twine upload --repository testpypi dist/*
|
|
125
|
+
|
|
126
|
+
# 测试安装
|
|
127
|
+
pip install --index-url https://test.pypi.org/simple/ \
|
|
128
|
+
--extra-index-url https://pypi.org/simple/ bstart-trb
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 2. 生产 PyPI
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# 上传到生产环境
|
|
135
|
+
uv run twine upload dist/*
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 3. Git 标签
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
git commit -m "v0.1.0 发布到 PyPI"
|
|
142
|
+
git tag v0.1.0
|
|
143
|
+
git push origin main --tags
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## 后续工作
|
|
147
|
+
|
|
148
|
+
### 可选优化
|
|
149
|
+
|
|
150
|
+
1. **多平台支持**:
|
|
151
|
+
- 在 Linux 上编译 `.so` 文件
|
|
152
|
+
- 在 macOS 上编译 `.so` 文件
|
|
153
|
+
- 上传多个平台特定的 wheel
|
|
154
|
+
|
|
155
|
+
2. **多 Python 版本**:
|
|
156
|
+
- 在 Python 3.11, 3.13 等版本下编译
|
|
157
|
+
- 上传多个版本特定的 wheel
|
|
158
|
+
|
|
159
|
+
3. **CI/CD**:
|
|
160
|
+
- 设置 GitHub Actions 自动构建
|
|
161
|
+
- 自动测试和发布
|
|
162
|
+
|
|
163
|
+
4. **文档**:
|
|
164
|
+
- 添加 Sphinx 文档
|
|
165
|
+
- 发布到 Read the Docs
|
|
166
|
+
|
|
167
|
+
## 文件清单
|
|
168
|
+
|
|
169
|
+
### 项目根目录
|
|
170
|
+
```
|
|
171
|
+
bstart-trb/
|
|
172
|
+
├── slice_wrapper/ # 主包目录
|
|
173
|
+
│ ├── __init__.py # 包初始化(版本 0.1.0)
|
|
174
|
+
│ ├── models.py # 数据模型
|
|
175
|
+
│ ├── wrapper.py # Python 包装器
|
|
176
|
+
│ ├── _taper_slice.pyi # 类型提示
|
|
177
|
+
│ ├── py.typed # PEP 561 标记
|
|
178
|
+
│ ├── _taper_slice.cp312-win_amd64.pyd # 预编译模块 ⭐
|
|
179
|
+
│ ├── taper_slice.f90 # Fortran 源码(不打包)
|
|
180
|
+
│ └── build.py # 构建脚本(不打包)
|
|
181
|
+
├── dist/ # 构建产物
|
|
182
|
+
│ ├── bstart_trb-0.1.0-py3-none-any.whl
|
|
183
|
+
│ └── bstart_trb-0.1.0.tar.gz
|
|
184
|
+
├── pyproject.toml # 包配置 ⭐
|
|
185
|
+
├── README_PYPI.md # PyPI 说明 ⭐
|
|
186
|
+
├── PUBLISHING.md # 发布指南 ⭐
|
|
187
|
+
├── test_install.py # 测试脚本 ⭐
|
|
188
|
+
├── PACKAGE_SUMMARY.md # 本文件 ⭐
|
|
189
|
+
├── LICENSE # MIT 许可证
|
|
190
|
+
├── .gitignore # Git 忽略(已修改)⭐
|
|
191
|
+
└── uv.lock # 依赖锁定
|
|
192
|
+
|
|
193
|
+
⭐ = 新增或重要修改的文件
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## 参考文档
|
|
197
|
+
|
|
198
|
+
- **用户文档**:`README_PYPI.md`
|
|
199
|
+
- **发布指南**:`PUBLISHING.md`
|
|
200
|
+
- **构建文档**:`BUILDING.md`
|
|
201
|
+
- **原始说明**:`README.md`(中文技术文档)
|
|
202
|
+
|
|
203
|
+
## 联系方式
|
|
204
|
+
|
|
205
|
+
- 作者:Gu Lei
|
|
206
|
+
- 许可证:MIT
|
|
207
|
+
- Python 版本:>= 3.12
|
|
208
|
+
- 平台:Windows x64
|