pgzero-plus 0.0.1a1__tar.gz → 0.1.0a1__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.
- pgzero_plus-0.1.0a1/PKG-INFO +218 -0
- pgzero_plus-0.1.0a1/README.md +194 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/pyproject.toml +6 -4
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/__init__.py +2 -11
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/actor.py +314 -35
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/builtins.py +4 -4
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/game.py +38 -1
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/loaders.py +4 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/runner.py +48 -43
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/screen.py +1 -1
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/spellcheck.py +1 -1
- pgzero_plus-0.1.0a1/src/pgzero/sprites.py +169 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/tilemaps.py +64 -13
- pgzero_plus-0.1.0a1/src/pgzero/tone.py +158 -0
- pgzero_plus-0.1.0a1/src/pgzero_plus.egg-info/PKG-INFO +218 -0
- pgzero_plus-0.1.0a1/src/pgzero_plus.egg-info/requires.txt +10 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/test/test_actor.py +89 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/test/test_actor_features.py +113 -51
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/test/test_runner.py +124 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/test/test_screen.py +9 -4
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/test/test_sound_formats.py +14 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/test/test_spellcheck.py +6 -0
- pgzero_plus-0.1.0a1/test/test_sprites.py +567 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/test/test_tilemaps.py +69 -0
- pgzero_plus-0.1.0a1/test/test_tone.py +91 -0
- pgzero_plus-0.0.1a1/PKG-INFO +0 -259
- pgzero_plus-0.0.1a1/README.md +0 -235
- pgzero_plus-0.0.1a1/src/pgzero/sprites.py +0 -182
- pgzero_plus-0.0.1a1/src/pgzero/tone.py +0 -132
- pgzero_plus-0.0.1a1/src/pgzero_plus.egg-info/PKG-INFO +0 -259
- pgzero_plus-0.0.1a1/src/pgzero_plus.egg-info/requires.txt +0 -6
- pgzero_plus-0.0.1a1/test/test_sprites.py +0 -309
- pgzero_plus-0.0.1a1/test/test_tone.py +0 -31
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/COPYING +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/setup.cfg +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/__main__.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/animation.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/clock.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/constants.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/data/icon.png +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/data/joypad.png +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/keyboard.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/music.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/ptext.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/rect.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/soundfmt.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero/storage.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero_plus.egg-info/SOURCES.txt +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero_plus.egg-info/dependency_links.txt +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero_plus.egg-info/entry_points.txt +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzero_plus.egg-info/top_level.txt +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/src/pgzrun.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/test/test_animation.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/test/test_builtins.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/test/test_event_dispatch.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/test/test_game_state.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/test/test_keyboard.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/test/test_music.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/test/test_rect_actor.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/test/test_storage.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/test/test_transform_anchor.py +0 -0
- {pgzero_plus-0.0.1a1 → pgzero_plus-0.1.0a1}/test/test_webp_loader.py +0 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pgzero-plus
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: An enhanced fork of Pygame Zero with additional features for teaching and developing 2D games
|
|
5
|
+
Author-email: Michael D'Argenio <mjdargen@gmail.com>
|
|
6
|
+
License-Expression: LGPL-3.0-or-later
|
|
7
|
+
Project-URL: Homepage, https://github.com/mjdargen/pgzero
|
|
8
|
+
Project-URL: Documentation, https://pygame-zero.readthedocs.io/
|
|
9
|
+
Project-URL: Source, https://github.com/mjdargen/pgzero
|
|
10
|
+
Project-URL: Issues, https://github.com/mjdargen/pgzero/issues
|
|
11
|
+
Keywords: pygame,pgzero,games,education
|
|
12
|
+
Classifier: Intended Audience :: Education
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Education
|
|
15
|
+
Classifier: Topic :: Games/Entertainment
|
|
16
|
+
Requires-Python: >=3.6
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: COPYING
|
|
19
|
+
Requires-Dist: pygame>=2.6.1; python_version < "3.10"
|
|
20
|
+
Requires-Dist: pygame-ce>=2.5.8; python_version >= "3.10"
|
|
21
|
+
Requires-Dist: numpy
|
|
22
|
+
Requires-Dist: importlib-metadata==4.8.3; python_version < "3.8"
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# Pygame Zero Plus
|
|
26
|
+
|
|
27
|
+
**Pygame Zero Plus** (`pgzero-plus`) is an independent fork of [Pygame Zero](https://github.com/lordmauve/pgzero), a beginner-friendly Python game development framework that reduces boilerplate code.
|
|
28
|
+
|
|
29
|
+
This fork adds features and quality-of-life improvements for introductory computer science and game design courses while retaining the familiar Pygame Zero API, including `Actor`, `screen`, and `pgzrun`.
|
|
30
|
+
|
|
31
|
+
## What's New
|
|
32
|
+
|
|
33
|
+
- **Enhanced Actors:** Scaling, flipping, opacity, and customizable collision rectangles.
|
|
34
|
+
- **Sprite Animations:** `Sprite` animations from sprite sheets or lists of images, played by any `Actor`.
|
|
35
|
+
- **Tilemaps:** Loading and rendering maps created with [Tiled Map Editor](https://www.mapeditor.org/), including tilesets and tile transformations.
|
|
36
|
+
- **Game Management:** A `Game` object for tracking scores, levels, game states, and restarting games.
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
The PyPI distribution is named `pgzero-plus`, but it provides the same `pgzero` Python package and `pgzrun` command as the original Pygame Zero. **Do not install both distributions in the same Python environment.**
|
|
41
|
+
|
|
42
|
+
### Install or Update
|
|
43
|
+
|
|
44
|
+
**Windows:**
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
python -m pip install --upgrade pgzero-plus
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**macOS / Linux:**
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
python3 -m pip install --upgrade pgzero-plus
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### pygame and pygame-ce
|
|
57
|
+
|
|
58
|
+
On Python 3.10 and newer, Pygame Zero Plus installs [pygame-ce](https://pyga.me/), the actively developed community edition of pygame. On older Python versions it installs `pygame`, since pygame-ce needs Python 3.10 or newer.
|
|
59
|
+
|
|
60
|
+
Both provide the same `pygame` module, so they cannot be installed together. If `pygame` is already installed on Python 3.10 or newer, follow the steps below to switch cleanly. Note that this replaces `pygame` for every program in that Python environment.
|
|
61
|
+
|
|
62
|
+
### Switching from Pygame Zero, pygame, or an Older Fork
|
|
63
|
+
|
|
64
|
+
If you previously installed `pgzero` or `pygame`, uninstall any overlapping distributions before installing Pygame Zero Plus. This also helps repair environments where multiple forks have been installed together. Installing Pygame Zero Plus afterwards brings back the right version of pygame for your Python.
|
|
65
|
+
|
|
66
|
+
**Windows:**
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
python -m pip uninstall -y pgzero pgzero-plus pygame pygame-ce
|
|
70
|
+
python -m pip install pgzero-plus
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**macOS / Linux:**
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
python3 -m pip uninstall -y pgzero pgzero-plus pygame pygame-ce
|
|
77
|
+
python3 -m pip install pgzero-plus
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Running Games
|
|
81
|
+
|
|
82
|
+
Pygame Zero Plus supports running games as regular Python scripts, including with the Run button in most code editors. Start your program with:
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
import pgzrun
|
|
86
|
+
from pgzero.builtins import *
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The explicit `pgzero.builtins` import helps editors such as VS Code (Pylance) recognize names like `Actor` and `screen`.
|
|
90
|
+
|
|
91
|
+
Define your variables and functions, such as `start()`, `draw()`, and `update()`, then end the program with:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
pgzrun.go()
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Run the script through your editor or with:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
python game.py
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Alternatively, use the traditional Pygame Zero command:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pgzrun game.py
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
Clone the repository:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
git clone https://github.com/mjdargen/pgzero.git
|
|
115
|
+
cd pgzero
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Install the fork in editable mode **and** install all development tools with one command:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
python -m pip install -r requirements-dev.txt
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`requirements-dev.txt` includes `-e .`, which installs the local package and its runtime dependencies. Source changes are available immediately without rebuilding the wheel. If the original `pgzero` is installed in this environment, uninstall it first as described above.
|
|
125
|
+
|
|
126
|
+
### Pre-commit Checks
|
|
127
|
+
|
|
128
|
+
[Pre-commit](https://pre-commit.com/) checks whitespace, file endings, YAML/TOML syntax, merge conflict markers, and accidentally added large files.
|
|
129
|
+
|
|
130
|
+
Activate it **once per clone**, after installing the development dependencies:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
python -m pre_commit install
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
It then runs automatically on staged files before each `git commit`. If a hook modifies a file, review it with `git diff`, stage the fix with `git add`, and retry the commit.
|
|
137
|
+
|
|
138
|
+
To check all tracked files manually at any time:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
python -m pre_commit run --all-files
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Using `python -m pre_commit` avoids Windows PATH issues where the `pre-commit` command is not recognized.
|
|
145
|
+
|
|
146
|
+
### Testing
|
|
147
|
+
|
|
148
|
+
Run all tests from the repository root:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
python -m pytest
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
For detailed output or one test file:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
python -m pytest -v
|
|
158
|
+
python -m pytest test/test_actor.py
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Documentation
|
|
162
|
+
|
|
163
|
+
Documentation is written in [Sphinx](https://www.sphinx-doc.org/) using the `.rst` files in `doc/`. Update these pages when features or behavior change, and add new pages to `doc/index.rst` so they appear in the navigation.
|
|
164
|
+
|
|
165
|
+
Build and preview locally from the repository root:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
python -m sphinx -b html doc doc/_build/html
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Then open `doc/_build/html/index.html` in your browser.
|
|
172
|
+
|
|
173
|
+
### Automated Checks
|
|
174
|
+
|
|
175
|
+
GitHub Actions runs pre-commit, the tests on every supported Python version, the documentation build, and a package build on each pull request and push to `main`. Results appear on the pull request and on the [Actions page](https://github.com/mjdargen/pgzero/actions).
|
|
176
|
+
|
|
177
|
+
## Publishing a Release
|
|
178
|
+
|
|
179
|
+
Pushing a version tag triggers the release workflow, which tests, builds, publishes to PyPI, and creates a GitHub Release.
|
|
180
|
+
|
|
181
|
+
**1. Update the version** in `pyproject.toml`:
|
|
182
|
+
|
|
183
|
+
```toml
|
|
184
|
+
version = "0.1.0a2"
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**2. Commit and push changes:**
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
git switch main
|
|
191
|
+
git status
|
|
192
|
+
git add .
|
|
193
|
+
git commit -m "Prepare v0.1.0a2"
|
|
194
|
+
git push origin main
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**3. Confirm Code Checks passes** on the [GitHub Actions page](https://github.com/mjdargen/pgzero/actions).
|
|
198
|
+
|
|
199
|
+
**4. Create and push the release tag:**
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
git tag -a v0.1.0a2 -m "Release v0.1.0a2"
|
|
203
|
+
git push origin v0.1.0a2
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**5. Verify publication:**
|
|
207
|
+
|
|
208
|
+
- [GitHub Actions](https://github.com/mjdargen/pgzero/actions)
|
|
209
|
+
- [GitHub Releases](https://github.com/mjdargen/pgzero/releases)
|
|
210
|
+
- [PyPI — pgzero-plus](https://pypi.org/project/pgzero-plus/)
|
|
211
|
+
|
|
212
|
+
## Credits & License
|
|
213
|
+
|
|
214
|
+
This project is an independent fork of [Pygame Zero](https://github.com/lordmauve/pgzero), originally developed by Daniel Pope and contributors.
|
|
215
|
+
|
|
216
|
+
Original documentation: https://pygame-zero.readthedocs.io/
|
|
217
|
+
|
|
218
|
+
Licensed under the GNU Lesser General Public License v3.0 or later (LGPL-3.0-or-later).
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Pygame Zero Plus
|
|
2
|
+
|
|
3
|
+
**Pygame Zero Plus** (`pgzero-plus`) is an independent fork of [Pygame Zero](https://github.com/lordmauve/pgzero), a beginner-friendly Python game development framework that reduces boilerplate code.
|
|
4
|
+
|
|
5
|
+
This fork adds features and quality-of-life improvements for introductory computer science and game design courses while retaining the familiar Pygame Zero API, including `Actor`, `screen`, and `pgzrun`.
|
|
6
|
+
|
|
7
|
+
## What's New
|
|
8
|
+
|
|
9
|
+
- **Enhanced Actors:** Scaling, flipping, opacity, and customizable collision rectangles.
|
|
10
|
+
- **Sprite Animations:** `Sprite` animations from sprite sheets or lists of images, played by any `Actor`.
|
|
11
|
+
- **Tilemaps:** Loading and rendering maps created with [Tiled Map Editor](https://www.mapeditor.org/), including tilesets and tile transformations.
|
|
12
|
+
- **Game Management:** A `Game` object for tracking scores, levels, game states, and restarting games.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
The PyPI distribution is named `pgzero-plus`, but it provides the same `pgzero` Python package and `pgzrun` command as the original Pygame Zero. **Do not install both distributions in the same Python environment.**
|
|
17
|
+
|
|
18
|
+
### Install or Update
|
|
19
|
+
|
|
20
|
+
**Windows:**
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
python -m pip install --upgrade pgzero-plus
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**macOS / Linux:**
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
python3 -m pip install --upgrade pgzero-plus
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### pygame and pygame-ce
|
|
33
|
+
|
|
34
|
+
On Python 3.10 and newer, Pygame Zero Plus installs [pygame-ce](https://pyga.me/), the actively developed community edition of pygame. On older Python versions it installs `pygame`, since pygame-ce needs Python 3.10 or newer.
|
|
35
|
+
|
|
36
|
+
Both provide the same `pygame` module, so they cannot be installed together. If `pygame` is already installed on Python 3.10 or newer, follow the steps below to switch cleanly. Note that this replaces `pygame` for every program in that Python environment.
|
|
37
|
+
|
|
38
|
+
### Switching from Pygame Zero, pygame, or an Older Fork
|
|
39
|
+
|
|
40
|
+
If you previously installed `pgzero` or `pygame`, uninstall any overlapping distributions before installing Pygame Zero Plus. This also helps repair environments where multiple forks have been installed together. Installing Pygame Zero Plus afterwards brings back the right version of pygame for your Python.
|
|
41
|
+
|
|
42
|
+
**Windows:**
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
python -m pip uninstall -y pgzero pgzero-plus pygame pygame-ce
|
|
46
|
+
python -m pip install pgzero-plus
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**macOS / Linux:**
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
python3 -m pip uninstall -y pgzero pgzero-plus pygame pygame-ce
|
|
53
|
+
python3 -m pip install pgzero-plus
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Running Games
|
|
57
|
+
|
|
58
|
+
Pygame Zero Plus supports running games as regular Python scripts, including with the Run button in most code editors. Start your program with:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
import pgzrun
|
|
62
|
+
from pgzero.builtins import *
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The explicit `pgzero.builtins` import helps editors such as VS Code (Pylance) recognize names like `Actor` and `screen`.
|
|
66
|
+
|
|
67
|
+
Define your variables and functions, such as `start()`, `draw()`, and `update()`, then end the program with:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
pgzrun.go()
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Run the script through your editor or with:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
python game.py
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Alternatively, use the traditional Pygame Zero command:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pgzrun game.py
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Development
|
|
86
|
+
|
|
87
|
+
Clone the repository:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
git clone https://github.com/mjdargen/pgzero.git
|
|
91
|
+
cd pgzero
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Install the fork in editable mode **and** install all development tools with one command:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
python -m pip install -r requirements-dev.txt
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`requirements-dev.txt` includes `-e .`, which installs the local package and its runtime dependencies. Source changes are available immediately without rebuilding the wheel. If the original `pgzero` is installed in this environment, uninstall it first as described above.
|
|
101
|
+
|
|
102
|
+
### Pre-commit Checks
|
|
103
|
+
|
|
104
|
+
[Pre-commit](https://pre-commit.com/) checks whitespace, file endings, YAML/TOML syntax, merge conflict markers, and accidentally added large files.
|
|
105
|
+
|
|
106
|
+
Activate it **once per clone**, after installing the development dependencies:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
python -m pre_commit install
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
It then runs automatically on staged files before each `git commit`. If a hook modifies a file, review it with `git diff`, stage the fix with `git add`, and retry the commit.
|
|
113
|
+
|
|
114
|
+
To check all tracked files manually at any time:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
python -m pre_commit run --all-files
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Using `python -m pre_commit` avoids Windows PATH issues where the `pre-commit` command is not recognized.
|
|
121
|
+
|
|
122
|
+
### Testing
|
|
123
|
+
|
|
124
|
+
Run all tests from the repository root:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
python -m pytest
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
For detailed output or one test file:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
python -m pytest -v
|
|
134
|
+
python -m pytest test/test_actor.py
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Documentation
|
|
138
|
+
|
|
139
|
+
Documentation is written in [Sphinx](https://www.sphinx-doc.org/) using the `.rst` files in `doc/`. Update these pages when features or behavior change, and add new pages to `doc/index.rst` so they appear in the navigation.
|
|
140
|
+
|
|
141
|
+
Build and preview locally from the repository root:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
python -m sphinx -b html doc doc/_build/html
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Then open `doc/_build/html/index.html` in your browser.
|
|
148
|
+
|
|
149
|
+
### Automated Checks
|
|
150
|
+
|
|
151
|
+
GitHub Actions runs pre-commit, the tests on every supported Python version, the documentation build, and a package build on each pull request and push to `main`. Results appear on the pull request and on the [Actions page](https://github.com/mjdargen/pgzero/actions).
|
|
152
|
+
|
|
153
|
+
## Publishing a Release
|
|
154
|
+
|
|
155
|
+
Pushing a version tag triggers the release workflow, which tests, builds, publishes to PyPI, and creates a GitHub Release.
|
|
156
|
+
|
|
157
|
+
**1. Update the version** in `pyproject.toml`:
|
|
158
|
+
|
|
159
|
+
```toml
|
|
160
|
+
version = "0.1.0a2"
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**2. Commit and push changes:**
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
git switch main
|
|
167
|
+
git status
|
|
168
|
+
git add .
|
|
169
|
+
git commit -m "Prepare v0.1.0a2"
|
|
170
|
+
git push origin main
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**3. Confirm Code Checks passes** on the [GitHub Actions page](https://github.com/mjdargen/pgzero/actions).
|
|
174
|
+
|
|
175
|
+
**4. Create and push the release tag:**
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
git tag -a v0.1.0a2 -m "Release v0.1.0a2"
|
|
179
|
+
git push origin v0.1.0a2
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**5. Verify publication:**
|
|
183
|
+
|
|
184
|
+
- [GitHub Actions](https://github.com/mjdargen/pgzero/actions)
|
|
185
|
+
- [GitHub Releases](https://github.com/mjdargen/pgzero/releases)
|
|
186
|
+
- [PyPI — pgzero-plus](https://pypi.org/project/pgzero-plus/)
|
|
187
|
+
|
|
188
|
+
## Credits & License
|
|
189
|
+
|
|
190
|
+
This project is an independent fork of [Pygame Zero](https://github.com/lordmauve/pgzero), originally developed by Daniel Pope and contributors.
|
|
191
|
+
|
|
192
|
+
Original documentation: https://pygame-zero.readthedocs.io/
|
|
193
|
+
|
|
194
|
+
Licensed under the GNU Lesser General Public License v3.0 or later (LGPL-3.0-or-later).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pgzero-plus"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.1.0a1"
|
|
4
4
|
description = "An enhanced fork of Pygame Zero with additional features for teaching and developing 2D games"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "LGPL-3.0-or-later"
|
|
@@ -8,11 +8,13 @@ license-files = ["COPYING"]
|
|
|
8
8
|
authors = [
|
|
9
9
|
{name = "Michael D'Argenio", email = "mjdargen@gmail.com"},
|
|
10
10
|
]
|
|
11
|
-
requires-python = ">=3.6
|
|
11
|
+
requires-python = ">=3.6"
|
|
12
12
|
dependencies = [
|
|
13
|
-
|
|
13
|
+
# Both provide the pygame module. pygame-ce is actively developed but
|
|
14
|
+
# needs Python 3.10+, so older Pythons use pygame.
|
|
15
|
+
"pygame>=2.6.1; python_version < '3.10'",
|
|
16
|
+
"pygame-ce>=2.5.8; python_version >= '3.10'",
|
|
14
17
|
"numpy",
|
|
15
|
-
"pyfxr>=0.3.0",
|
|
16
18
|
"importlib-metadata==4.8.3; python_version < '3.8'",
|
|
17
19
|
]
|
|
18
20
|
keywords = ["pygame", "pgzero", "games", "education"]
|
|
@@ -7,20 +7,11 @@ import warnings
|
|
|
7
7
|
# ``python -m pgzero``) imports this package before pygame, which is when
|
|
8
8
|
# SDL and pygame read these settings.
|
|
9
9
|
|
|
10
|
-
# Codio has no sound device, so use SDL's silent audio driver there.
|
|
11
|
-
if (
|
|
12
|
-
"CODIO_BOX_DOMAIN" in os.environ
|
|
13
|
-
or "CODIO_HOSTNAME" in os.environ
|
|
14
|
-
or os.environ.get("USER") == "codio"
|
|
15
|
-
or os.path.exists("/home/codio")
|
|
16
|
-
):
|
|
17
|
-
os.environ["SDL_AUDIODRIVER"] = "dummy"
|
|
18
|
-
warnings.filterwarnings("ignore", message=".*avx2 capable.*", category=RuntimeWarning)
|
|
19
|
-
|
|
20
10
|
# Hide pygame welcome message
|
|
21
11
|
os.environ["PYGAME_HIDE_SUPPORT_PROMPT"] = "1"
|
|
22
12
|
|
|
23
|
-
# Suppress pkg_resources deprecation warning
|
|
13
|
+
# Suppress pkg_resources deprecation warning
|
|
14
|
+
# Classic pygame imports pkg_resources, which warns on setuptools 67.5–80
|
|
24
15
|
warnings.filterwarnings(
|
|
25
16
|
"ignore",
|
|
26
17
|
message=r"pkg_resources is deprecated as an API.*",
|