minipy3dr 0.4.1__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.
- minipy3dr-0.4.1/MANIFEST.in +1 -0
- minipy3dr-0.4.1/PKG-INFO +251 -0
- minipy3dr-0.4.1/README.md +220 -0
- minipy3dr-0.4.1/minipy3dr/__init__.py +36 -0
- minipy3dr-0.4.1/minipy3dr/__main__.py +7 -0
- minipy3dr-0.4.1/minipy3dr/app.py +654 -0
- minipy3dr-0.4.1/minipy3dr/benchmark.py +362 -0
- minipy3dr-0.4.1/minipy3dr/core/__init__.py +19 -0
- minipy3dr-0.4.1/minipy3dr/core/camera.py +70 -0
- minipy3dr-0.4.1/minipy3dr/core/light.py +28 -0
- minipy3dr-0.4.1/minipy3dr/core/material.py +14 -0
- minipy3dr-0.4.1/minipy3dr/core/mesh.py +142 -0
- minipy3dr-0.4.1/minipy3dr/core/object3d.py +22 -0
- minipy3dr-0.4.1/minipy3dr/core/scene.py +58 -0
- minipy3dr-0.4.1/minipy3dr/demo.py +20 -0
- minipy3dr-0.4.1/minipy3dr/loaders/__init__.py +5 -0
- minipy3dr-0.4.1/minipy3dr/loaders/obj.py +105 -0
- minipy3dr-0.4.1/minipy3dr/math/__init__.py +13 -0
- minipy3dr-0.4.1/minipy3dr/math/matrix.py +193 -0
- minipy3dr-0.4.1/minipy3dr/math/transform.py +49 -0
- minipy3dr-0.4.1/minipy3dr/math/vector.py +74 -0
- minipy3dr-0.4.1/minipy3dr/native/__init__.py +1 -0
- minipy3dr-0.4.1/minipy3dr/native/rasterizer.cpp +1022 -0
- minipy3dr-0.4.1/minipy3dr/py.typed +1 -0
- minipy3dr-0.4.1/minipy3dr/pygame/__init__.py +7 -0
- minipy3dr-0.4.1/minipy3dr/pygame/camera_controller.py +34 -0
- minipy3dr-0.4.1/minipy3dr/render/__init__.py +20 -0
- minipy3dr-0.4.1/minipy3dr/render/native_rasterizer.py +97 -0
- minipy3dr-0.4.1/minipy3dr/render/numpy_rasterizer.py +80 -0
- minipy3dr-0.4.1/minipy3dr/render/pipeline.py +21 -0
- minipy3dr-0.4.1/minipy3dr/render/rasterizer.py +85 -0
- minipy3dr-0.4.1/minipy3dr/render/renderer.py +592 -0
- minipy3dr-0.4.1/minipy3dr/render/shader.py +134 -0
- minipy3dr-0.4.1/minipy3dr/render/zbuffer.py +28 -0
- minipy3dr-0.4.1/minipy3dr.egg-info/PKG-INFO +251 -0
- minipy3dr-0.4.1/minipy3dr.egg-info/SOURCES.txt +47 -0
- minipy3dr-0.4.1/minipy3dr.egg-info/dependency_links.txt +1 -0
- minipy3dr-0.4.1/minipy3dr.egg-info/entry_points.txt +3 -0
- minipy3dr-0.4.1/minipy3dr.egg-info/requires.txt +8 -0
- minipy3dr-0.4.1/minipy3dr.egg-info/top_level.txt +1 -0
- minipy3dr-0.4.1/pyproject.toml +59 -0
- minipy3dr-0.4.1/setup.cfg +4 -0
- minipy3dr-0.4.1/setup.py +59 -0
- minipy3dr-0.4.1/tests/test_api.py +111 -0
- minipy3dr-0.4.1/tests/test_benchmark.py +41 -0
- minipy3dr-0.4.1/tests/test_loaders.py +63 -0
- minipy3dr-0.4.1/tests/test_math.py +59 -0
- minipy3dr-0.4.1/tests/test_native_render.py +117 -0
- minipy3dr-0.4.1/tests/test_render.py +226 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include minipy3dr/native/*.cpp
|
minipy3dr-0.4.1/PKG-INFO
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: minipy3dr
|
|
3
|
+
Version: 0.4.1
|
|
4
|
+
Summary: A small software 3D renderer for pygame surfaces.
|
|
5
|
+
Author: MiniPy3DR contributors
|
|
6
|
+
Project-URL: Homepage, https://github.com/andogensi/MiniPy3DR
|
|
7
|
+
Project-URL: Repository, https://github.com/andogensi/MiniPy3DR
|
|
8
|
+
Project-URL: Issues, https://github.com/andogensi/MiniPy3DR/issues
|
|
9
|
+
Keywords: pygame,3d,renderer,education,software-renderer
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Education
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: C++
|
|
19
|
+
Classifier: Topic :: Games/Entertainment
|
|
20
|
+
Classifier: Topic :: Multimedia :: Graphics :: 3D Rendering
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
Requires-Dist: numpy>=1.26
|
|
25
|
+
Requires-Dist: pygame>=2.5
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: build>=1; extra == "dev"
|
|
28
|
+
Requires-Dist: cibuildwheel>=2; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
30
|
+
Requires-Dist: twine>=5; extra == "dev"
|
|
31
|
+
|
|
32
|
+
# MiniPy3DR
|
|
33
|
+
|
|
34
|
+
MiniPy3DR is a tiny software 3D renderer for Pygame surfaces.
|
|
35
|
+
It is designed for lessons, prototypes, and small games where students can see
|
|
36
|
+
the basics of cameras, meshes, lights, flat shading, and z-buffer rendering.
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
Recommended for Windows classroom PCs:
|
|
41
|
+
|
|
42
|
+
```powershell
|
|
43
|
+
python -m pip install minipy3dr
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
This installs the matching prebuilt Windows wheel from PyPI for 64-bit Python
|
|
47
|
+
3.10, 3.11, 3.12, or 3.13. Students do not need Visual Studio Build Tools.
|
|
48
|
+
|
|
49
|
+
To pin a specific version for a class:
|
|
50
|
+
|
|
51
|
+
```powershell
|
|
52
|
+
python -m pip install "minipy3dr==0.4.1"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Check that the native renderer is available:
|
|
56
|
+
|
|
57
|
+
```powershell
|
|
58
|
+
python -c "from minipy3dr.render import is_native_available; print(is_native_available())"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
With uv:
|
|
62
|
+
|
|
63
|
+
```powershell
|
|
64
|
+
uv pip install minipy3dr
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Installing from GitHub source is useful for teachers and development, but it is
|
|
68
|
+
not the recommended classroom default because pip builds the C++ extension on
|
|
69
|
+
the local PC:
|
|
70
|
+
|
|
71
|
+
```powershell
|
|
72
|
+
python -m pip install "git+https://github.com/andogensi/MiniPy3DR.git"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
With uv:
|
|
76
|
+
|
|
77
|
+
```powershell
|
|
78
|
+
uv pip install "git+https://github.com/andogensi/MiniPy3DR.git"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
From a specific branch or tag:
|
|
82
|
+
|
|
83
|
+
```powershell
|
|
84
|
+
python -m pip install "git+https://github.com/andogensi/MiniPy3DR.git@main"
|
|
85
|
+
python -m pip install "git+https://github.com/andogensi/MiniPy3DR.git@v0.4.1"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
From this repository:
|
|
89
|
+
|
|
90
|
+
```powershell
|
|
91
|
+
python -m pip install .
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
For classroom development, use editable install:
|
|
95
|
+
|
|
96
|
+
```powershell
|
|
97
|
+
python -m pip install -e .
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
or with uv:
|
|
101
|
+
|
|
102
|
+
```powershell
|
|
103
|
+
uv pip install -e .
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
After that, student files can simply import the beginner API:
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from minipy3dr import App
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Quick Start
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from minipy3dr import App
|
|
116
|
+
|
|
117
|
+
app = App(title="MiniPy3DR")
|
|
118
|
+
cube = app.cube(position=(0, 0, -5), size=2, color=(220, 120, 80), ambient=0.22)
|
|
119
|
+
app.light(direction=(-0.4, -0.8, -0.6))
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def update(app, delta):
|
|
123
|
+
app.rotate(cube, y=delta)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
app.run(update=update)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Load OBJ Meshes
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
from minipy3dr import App
|
|
133
|
+
|
|
134
|
+
app = App(title="OBJ demo")
|
|
135
|
+
model = app.obj("assets/model.obj", position=(0, 0, -6), color=(160, 210, 255))
|
|
136
|
+
app.light(direction=(-0.4, -0.8, -0.6))
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def update(app, delta):
|
|
140
|
+
app.rotate(model, y=delta)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
app.run(update=update)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
For lower-level code, use `load_obj(path)` to get a `Mesh`:
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
from minipy3dr import load_obj
|
|
150
|
+
|
|
151
|
+
mesh = load_obj("assets/model.obj")
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Run the Demo
|
|
155
|
+
|
|
156
|
+
```powershell
|
|
157
|
+
python -m minipy3dr
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
or, after installation:
|
|
161
|
+
|
|
162
|
+
```powershell
|
|
163
|
+
minipy3dr-demo
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Renderer Benchmark
|
|
167
|
+
|
|
168
|
+
Compare the current renderer modes before changing the rasterizer:
|
|
169
|
+
|
|
170
|
+
```powershell
|
|
171
|
+
python -m minipy3dr.benchmark
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
or, after installation:
|
|
175
|
+
|
|
176
|
+
```powershell
|
|
177
|
+
minipy3dr-benchmark
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
The default benchmark runs these cases at `640x480` and `1280x720`:
|
|
181
|
+
|
|
182
|
+
- `cube_100`
|
|
183
|
+
- `cube_500`
|
|
184
|
+
- `sphere_obj_1`
|
|
185
|
+
|
|
186
|
+
You can also run the heavier example scene with `--cases doom_like_shooter`.
|
|
187
|
+
|
|
188
|
+
It measures `solid`, `solid_numpy`, and `solid_native`. `solid_native` uses the
|
|
189
|
+
C++ extension when it is built; otherwise it is reported as skipped.
|
|
190
|
+
|
|
191
|
+
From source, install or rebuild the project to compile the native extension:
|
|
192
|
+
|
|
193
|
+
```powershell
|
|
194
|
+
python -m pip install -e .
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
For a quick smoke run:
|
|
198
|
+
|
|
199
|
+
```powershell
|
|
200
|
+
python -m minipy3dr.benchmark --frames 1 --warmup 0 --cases sphere_obj_1 --resolutions 640x480
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Beginner Lessons
|
|
204
|
+
|
|
205
|
+
- `docs/beginner_api.md`
|
|
206
|
+
- `docs/classroom_setup.md`
|
|
207
|
+
- `examples/beginner_01_cube.py`
|
|
208
|
+
- `examples/beginner_02_keyboard.py`
|
|
209
|
+
- `examples/beginner_03_collect_game.py`
|
|
210
|
+
|
|
211
|
+
## Build
|
|
212
|
+
|
|
213
|
+
```powershell
|
|
214
|
+
python -m pip install -e ".[dev]"
|
|
215
|
+
python -m build
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
With uv:
|
|
219
|
+
|
|
220
|
+
```powershell
|
|
221
|
+
uv pip install -e ".[dev]"
|
|
222
|
+
uv run python -m build
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
The wheel and source archive will be written to `dist/`.
|
|
226
|
+
|
|
227
|
+
## Publish to PyPI
|
|
228
|
+
|
|
229
|
+
Windows wheels are built by GitHub Actions and published to PyPI on version
|
|
230
|
+
tags. Before the first release, configure a PyPI trusted publisher or pending
|
|
231
|
+
publisher for repository `andogensi/MiniPy3DR`, workflow `wheels.yml`, and
|
|
232
|
+
environment `pypi`.
|
|
233
|
+
|
|
234
|
+
To publish a new version, update the version in `pyproject.toml` and
|
|
235
|
+
`minipy3dr/__init__.py`, then push a tag:
|
|
236
|
+
|
|
237
|
+
```powershell
|
|
238
|
+
git tag v0.4.1
|
|
239
|
+
git push origin main
|
|
240
|
+
git push origin v0.4.1
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
The `Build and publish package` workflow uploads `cp310`, `cp311`, `cp312`, and
|
|
244
|
+
`cp313` Windows `win_amd64` wheels plus the source distribution to PyPI. Those
|
|
245
|
+
wheels include the C++ native renderer, so students can use `pip install
|
|
246
|
+
minipy3dr` without Visual Studio Build Tools.
|
|
247
|
+
|
|
248
|
+
The workflow uses PyPI trusted publishing with the `pypi` GitHub Environment.
|
|
249
|
+
It sets `MINIPY3DR_REQUIRE_NATIVE=1`, so PyPI wheels fail to build if the native
|
|
250
|
+
extension is missing. Source installs keep the extension optional and fall back
|
|
251
|
+
to the Python/NumPy renderer when no compiler is available.
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# MiniPy3DR
|
|
2
|
+
|
|
3
|
+
MiniPy3DR is a tiny software 3D renderer for Pygame surfaces.
|
|
4
|
+
It is designed for lessons, prototypes, and small games where students can see
|
|
5
|
+
the basics of cameras, meshes, lights, flat shading, and z-buffer rendering.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
Recommended for Windows classroom PCs:
|
|
10
|
+
|
|
11
|
+
```powershell
|
|
12
|
+
python -m pip install minipy3dr
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This installs the matching prebuilt Windows wheel from PyPI for 64-bit Python
|
|
16
|
+
3.10, 3.11, 3.12, or 3.13. Students do not need Visual Studio Build Tools.
|
|
17
|
+
|
|
18
|
+
To pin a specific version for a class:
|
|
19
|
+
|
|
20
|
+
```powershell
|
|
21
|
+
python -m pip install "minipy3dr==0.4.1"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Check that the native renderer is available:
|
|
25
|
+
|
|
26
|
+
```powershell
|
|
27
|
+
python -c "from minipy3dr.render import is_native_available; print(is_native_available())"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
With uv:
|
|
31
|
+
|
|
32
|
+
```powershell
|
|
33
|
+
uv pip install minipy3dr
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Installing from GitHub source is useful for teachers and development, but it is
|
|
37
|
+
not the recommended classroom default because pip builds the C++ extension on
|
|
38
|
+
the local PC:
|
|
39
|
+
|
|
40
|
+
```powershell
|
|
41
|
+
python -m pip install "git+https://github.com/andogensi/MiniPy3DR.git"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
With uv:
|
|
45
|
+
|
|
46
|
+
```powershell
|
|
47
|
+
uv pip install "git+https://github.com/andogensi/MiniPy3DR.git"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
From a specific branch or tag:
|
|
51
|
+
|
|
52
|
+
```powershell
|
|
53
|
+
python -m pip install "git+https://github.com/andogensi/MiniPy3DR.git@main"
|
|
54
|
+
python -m pip install "git+https://github.com/andogensi/MiniPy3DR.git@v0.4.1"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
From this repository:
|
|
58
|
+
|
|
59
|
+
```powershell
|
|
60
|
+
python -m pip install .
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
For classroom development, use editable install:
|
|
64
|
+
|
|
65
|
+
```powershell
|
|
66
|
+
python -m pip install -e .
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
or with uv:
|
|
70
|
+
|
|
71
|
+
```powershell
|
|
72
|
+
uv pip install -e .
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
After that, student files can simply import the beginner API:
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
from minipy3dr import App
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Quick Start
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from minipy3dr import App
|
|
85
|
+
|
|
86
|
+
app = App(title="MiniPy3DR")
|
|
87
|
+
cube = app.cube(position=(0, 0, -5), size=2, color=(220, 120, 80), ambient=0.22)
|
|
88
|
+
app.light(direction=(-0.4, -0.8, -0.6))
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def update(app, delta):
|
|
92
|
+
app.rotate(cube, y=delta)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
app.run(update=update)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Load OBJ Meshes
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from minipy3dr import App
|
|
102
|
+
|
|
103
|
+
app = App(title="OBJ demo")
|
|
104
|
+
model = app.obj("assets/model.obj", position=(0, 0, -6), color=(160, 210, 255))
|
|
105
|
+
app.light(direction=(-0.4, -0.8, -0.6))
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def update(app, delta):
|
|
109
|
+
app.rotate(model, y=delta)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
app.run(update=update)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
For lower-level code, use `load_obj(path)` to get a `Mesh`:
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
from minipy3dr import load_obj
|
|
119
|
+
|
|
120
|
+
mesh = load_obj("assets/model.obj")
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Run the Demo
|
|
124
|
+
|
|
125
|
+
```powershell
|
|
126
|
+
python -m minipy3dr
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
or, after installation:
|
|
130
|
+
|
|
131
|
+
```powershell
|
|
132
|
+
minipy3dr-demo
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Renderer Benchmark
|
|
136
|
+
|
|
137
|
+
Compare the current renderer modes before changing the rasterizer:
|
|
138
|
+
|
|
139
|
+
```powershell
|
|
140
|
+
python -m minipy3dr.benchmark
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
or, after installation:
|
|
144
|
+
|
|
145
|
+
```powershell
|
|
146
|
+
minipy3dr-benchmark
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
The default benchmark runs these cases at `640x480` and `1280x720`:
|
|
150
|
+
|
|
151
|
+
- `cube_100`
|
|
152
|
+
- `cube_500`
|
|
153
|
+
- `sphere_obj_1`
|
|
154
|
+
|
|
155
|
+
You can also run the heavier example scene with `--cases doom_like_shooter`.
|
|
156
|
+
|
|
157
|
+
It measures `solid`, `solid_numpy`, and `solid_native`. `solid_native` uses the
|
|
158
|
+
C++ extension when it is built; otherwise it is reported as skipped.
|
|
159
|
+
|
|
160
|
+
From source, install or rebuild the project to compile the native extension:
|
|
161
|
+
|
|
162
|
+
```powershell
|
|
163
|
+
python -m pip install -e .
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
For a quick smoke run:
|
|
167
|
+
|
|
168
|
+
```powershell
|
|
169
|
+
python -m minipy3dr.benchmark --frames 1 --warmup 0 --cases sphere_obj_1 --resolutions 640x480
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Beginner Lessons
|
|
173
|
+
|
|
174
|
+
- `docs/beginner_api.md`
|
|
175
|
+
- `docs/classroom_setup.md`
|
|
176
|
+
- `examples/beginner_01_cube.py`
|
|
177
|
+
- `examples/beginner_02_keyboard.py`
|
|
178
|
+
- `examples/beginner_03_collect_game.py`
|
|
179
|
+
|
|
180
|
+
## Build
|
|
181
|
+
|
|
182
|
+
```powershell
|
|
183
|
+
python -m pip install -e ".[dev]"
|
|
184
|
+
python -m build
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
With uv:
|
|
188
|
+
|
|
189
|
+
```powershell
|
|
190
|
+
uv pip install -e ".[dev]"
|
|
191
|
+
uv run python -m build
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
The wheel and source archive will be written to `dist/`.
|
|
195
|
+
|
|
196
|
+
## Publish to PyPI
|
|
197
|
+
|
|
198
|
+
Windows wheels are built by GitHub Actions and published to PyPI on version
|
|
199
|
+
tags. Before the first release, configure a PyPI trusted publisher or pending
|
|
200
|
+
publisher for repository `andogensi/MiniPy3DR`, workflow `wheels.yml`, and
|
|
201
|
+
environment `pypi`.
|
|
202
|
+
|
|
203
|
+
To publish a new version, update the version in `pyproject.toml` and
|
|
204
|
+
`minipy3dr/__init__.py`, then push a tag:
|
|
205
|
+
|
|
206
|
+
```powershell
|
|
207
|
+
git tag v0.4.1
|
|
208
|
+
git push origin main
|
|
209
|
+
git push origin v0.4.1
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
The `Build and publish package` workflow uploads `cp310`, `cp311`, `cp312`, and
|
|
213
|
+
`cp313` Windows `win_amd64` wheels plus the source distribution to PyPI. Those
|
|
214
|
+
wheels include the C++ native renderer, so students can use `pip install
|
|
215
|
+
minipy3dr` without Visual Studio Build Tools.
|
|
216
|
+
|
|
217
|
+
The workflow uses PyPI trusted publishing with the `pypi` GitHub Environment.
|
|
218
|
+
It sets `MINIPY3DR_REQUIRE_NATIVE=1`, so PyPI wheels fail to build if the native
|
|
219
|
+
extension is missing. Source installs keep the extension optional and fall back
|
|
220
|
+
to the Python/NumPy renderer when no compiler is available.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""MiniPy3DR: a small software 3D renderer for pygame."""
|
|
2
|
+
|
|
3
|
+
from minipy3dr.app import AppFrame, AppObject, MiniPy3DRApp, key_code_from_name, vec3
|
|
4
|
+
from minipy3dr.core import DirectionalLight, Material, Mesh, PerspectiveCamera, Scene
|
|
5
|
+
from minipy3dr.loaders import ObjLoadError, load_obj, loads_obj
|
|
6
|
+
from minipy3dr.math import Matrix4, Transform, Vector2, Vector3, Vector4
|
|
7
|
+
from minipy3dr.pygame import KeyboardCameraController
|
|
8
|
+
from minipy3dr.render import Renderer
|
|
9
|
+
|
|
10
|
+
__version__ = "0.4.1"
|
|
11
|
+
|
|
12
|
+
App = MiniPy3DRApp
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"App",
|
|
16
|
+
"AppFrame",
|
|
17
|
+
"AppObject",
|
|
18
|
+
"DirectionalLight",
|
|
19
|
+
"KeyboardCameraController",
|
|
20
|
+
"Matrix4",
|
|
21
|
+
"Material",
|
|
22
|
+
"Mesh",
|
|
23
|
+
"MiniPy3DRApp",
|
|
24
|
+
"ObjLoadError",
|
|
25
|
+
"PerspectiveCamera",
|
|
26
|
+
"Renderer",
|
|
27
|
+
"Scene",
|
|
28
|
+
"Transform",
|
|
29
|
+
"Vector2",
|
|
30
|
+
"Vector3",
|
|
31
|
+
"Vector4",
|
|
32
|
+
"key_code_from_name",
|
|
33
|
+
"load_obj",
|
|
34
|
+
"loads_obj",
|
|
35
|
+
"vec3",
|
|
36
|
+
]
|