gameship 0.1.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.
- gameship-0.1.0/LICENSE +110 -0
- gameship-0.1.0/PKG-INFO +156 -0
- gameship-0.1.0/README.md +139 -0
- gameship-0.1.0/pyproject.toml +28 -0
- gameship-0.1.0/setup.cfg +4 -0
- gameship-0.1.0/src/gameship/__init__.py +260 -0
- gameship-0.1.0/src/gameship.egg-info/PKG-INFO +156 -0
- gameship-0.1.0/src/gameship.egg-info/SOURCES.txt +10 -0
- gameship-0.1.0/src/gameship.egg-info/dependency_links.txt +1 -0
- gameship-0.1.0/src/gameship.egg-info/entry_points.txt +2 -0
- gameship-0.1.0/src/gameship.egg-info/top_level.txt +1 -0
- gameship-0.1.0/tests/test_gameship.py +89 -0
gameship-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, MIT Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-MIT
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 Neuroforge
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the MIT license that is effective on the second anniversary of the date we make
|
|
91
|
+
the Software available. On or after that date, you may use the Software under
|
|
92
|
+
the MIT license, in which case the following will apply:
|
|
93
|
+
|
|
94
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
95
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
96
|
+
the Software without restriction, including without limitation the rights to
|
|
97
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
98
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
99
|
+
so, subject to the following conditions:
|
|
100
|
+
|
|
101
|
+
The above copyright notice and this permission notice shall be included in all
|
|
102
|
+
copies or substantial portions of the Software.
|
|
103
|
+
|
|
104
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
105
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
106
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
107
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
108
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
109
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
110
|
+
SOFTWARE.
|
gameship-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gameship
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Ship your Python game: one command to per-OS builds and itch.io
|
|
5
|
+
License: FSL-1.1-MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/Neuroforge/gameship
|
|
7
|
+
Keywords: pygame,packaging,itch.io,pyinstaller,game
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Topic :: Games/Entertainment
|
|
12
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
13
|
+
Requires-Python: >=3.11
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<img src="https://raw.githubusercontent.com/Neuroforge/gameship/main/docs/logo.png" alt="gameship" width="480">
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
<p align="center">
|
|
23
|
+
<a href="https://github.com/Neuroforge/gameship/actions/workflows/ci.yml"><img src="https://github.com/Neuroforge/gameship/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
24
|
+
<a href="https://pypi.org/project/gameship/"><img src="https://img.shields.io/pypi/v/gameship" alt="PyPI"></a>
|
|
25
|
+
<img src="https://img.shields.io/pypi/pyversions/gameship" alt="Python versions">
|
|
26
|
+
<img src="https://img.shields.io/badge/license-FSL--1.1--MIT-blue.svg" alt="License: FSL-1.1-MIT">
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
**Ship your Python game.** One command from a pygame project to real
|
|
30
|
+
Windows / macOS / Linux builds and an itch.io release — the workflow every
|
|
31
|
+
Python gamedev currently hand-rolls from PyInstaller + GitHub Actions + butler
|
|
32
|
+
blog posts, packaged.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install gameship pyinstaller
|
|
36
|
+
|
|
37
|
+
gameship build # freeze this OS's build -> dist/<platform>/
|
|
38
|
+
gameship push you/your-game # publish to itch.io (butler auto-installed)
|
|
39
|
+
gameship ci # write the 3-OS GitHub Actions workflow
|
|
40
|
+
gameship web # browser build via pygbag (pygame-ce)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Why
|
|
44
|
+
|
|
45
|
+
Python gamedevs are great at game code and stuck on the last mile: a real
|
|
46
|
+
double-clickable app for people who don't have Python, built for all three
|
|
47
|
+
OSes, uploaded to itch.io. The tools all exist — PyInstaller can't
|
|
48
|
+
cross-compile so you need per-OS builders, butler is scriptable but manual,
|
|
49
|
+
the GitHub Actions matrix is a blog-post ritual. gameship glues them so you
|
|
50
|
+
never think about it:
|
|
51
|
+
|
|
52
|
+
- **`gameship build`** — detects your entry point (`main.py`) and `assets/`
|
|
53
|
+
folder, names the app from your `pyproject.toml` or folder, runs PyInstaller
|
|
54
|
+
windowed, outputs to `dist/<platform>/`.
|
|
55
|
+
- **`gameship ci`** — drops a ready GitHub Actions workflow: every `v*` tag
|
|
56
|
+
builds Windows + macOS + Linux in parallel and uploads artifacts. Add a
|
|
57
|
+
`BUTLER_API_KEY` secret and an `ITCH_TARGET` variable and it also publishes
|
|
58
|
+
each build to the right itch.io channel.
|
|
59
|
+
- **`gameship push`** — wraps [butler](https://itch.io/docs/butler/), itch.io's
|
|
60
|
+
official CLI (downloads it on first use), so local pushes are one line too.
|
|
61
|
+
- **`gameship web`** — wraps [pygbag](https://pygame-web.github.io/) for a
|
|
62
|
+
browser build you can host on itch.io's HTML5 player (pygame-ce projects
|
|
63
|
+
with an async main loop).
|
|
64
|
+
|
|
65
|
+
## Quick start (60 seconds, local)
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
cd your-game/ # has a main.py that runs your game
|
|
69
|
+
pip install gameship pyinstaller
|
|
70
|
+
gameship build
|
|
71
|
+
open "dist/mac/YourGame.app" # or dist/windows/, dist/linux/
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Full release pipeline (10 minutes, once)
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
gameship ci
|
|
78
|
+
git add .github && git commit -m "release workflow" && git push
|
|
79
|
+
# GitHub repo -> Settings -> Secrets -> Actions: BUTLER_API_KEY (from itch.io)
|
|
80
|
+
# GitHub repo -> Settings -> Variables -> Actions: ITCH_TARGET=you/your-game
|
|
81
|
+
git tag v1.0 && git push --tags
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Three OS builds appear as artifacts; each pushes to `you/your-game:windows`,
|
|
85
|
+
`:mac`, `:linux` on itch.io. Delta uploads, versioned channels — butler's
|
|
86
|
+
whole feature set, none of its setup.
|
|
87
|
+
|
|
88
|
+
## Honest limitations (v0)
|
|
89
|
+
|
|
90
|
+
- PyInstaller quirks are inherited: Windows Defender sometimes flags frozen
|
|
91
|
+
Python apps (code-signing fixes it; on the roadmap), and asset paths inside
|
|
92
|
+
the bundle should be loaded relative to your script, not the cwd.
|
|
93
|
+
- `gameship web` requires pygame-ce and an async-ified main loop — that's a
|
|
94
|
+
[pygbag rule](https://pygame-web.github.io/wiki/pygbag/), not ours; we warn
|
|
95
|
+
rather than rewrite your code.
|
|
96
|
+
- macOS builds are unsigned/un-notarized (players right-click > Open). Signing
|
|
97
|
+
+ notarization service is the roadmap item after this one.
|
|
98
|
+
- Steam/Epic: not yet. itch.io first, on purpose.
|
|
99
|
+
|
|
100
|
+
## Example
|
|
101
|
+
|
|
102
|
+
[`example/`](example/) is a complete 60-line pygame catcher — the repo's CI
|
|
103
|
+
builds it on all three OSes and smoke-runs the frozen binary headless
|
|
104
|
+
(`SDL_VIDEODRIVER=dummy GAMESHIP_MAX_FRAMES=120`).
|
|
105
|
+
|
|
106
|
+
## Common questions this answers
|
|
107
|
+
|
|
108
|
+
**How do I turn my pygame game into an .exe?** `gameship build` on a Windows
|
|
109
|
+
machine (or let the generated workflow's Windows runner do it) — PyInstaller
|
|
110
|
+
under the hood, no spec file to write.
|
|
111
|
+
|
|
112
|
+
**How do I make a Mac .app from a pygame game?** Same command on macOS:
|
|
113
|
+
`gameship build` → `dist/mac/YourGame.app`.
|
|
114
|
+
|
|
115
|
+
**How do I upload a pygame game to itch.io automatically?** `gameship push
|
|
116
|
+
you/your-game` locally, or add the `BUTLER_API_KEY` secret so every tagged
|
|
117
|
+
release publishes to your itch channels from CI.
|
|
118
|
+
|
|
119
|
+
**How do I build my game for Windows, Mac, and Linux at once?** You can't
|
|
120
|
+
cross-compile Python — nobody can — so `gameship ci` writes the GitHub
|
|
121
|
+
Actions matrix that builds natively on all three, free on public repos.
|
|
122
|
+
|
|
123
|
+
**Is gameship open source?** Source-available under FSL-1.1-MIT: free for
|
|
124
|
+
any use except reselling gameship itself as a service, and each release
|
|
125
|
+
converts to plain MIT after two years. Games built with it are entirely
|
|
126
|
+
unaffected — they're yours.
|
|
127
|
+
|
|
128
|
+
**Can my pygame game run in the browser?** If it's pygame-ce with an async
|
|
129
|
+
main loop: `gameship web` (pygbag), then upload the build as an itch.io HTML5
|
|
130
|
+
game.
|
|
131
|
+
|
|
132
|
+
## Development
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
pip install -e . pytest
|
|
136
|
+
pytest # unit tests (pure logic, no PyInstaller needed)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The [CI](.github/workflows/ci.yml) dogfoods the tool: every push runs the
|
|
140
|
+
tests on Python 3.11–3.13 and builds + headless-smoke-runs the example game
|
|
141
|
+
on Windows, macOS, and Linux **with gameship itself**.
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
**[FSL-1.1-MIT](https://github.com/Neuroforge/gameship/blob/main/LICENSE)** (Functional Source License), which in plain words means:
|
|
146
|
+
|
|
147
|
+
- **Your games are yours.** Build them, sell them, ship them anywhere —
|
|
148
|
+
commercial use of gameship *for making things* is unrestricted, and nothing
|
|
149
|
+
about the license touches your game or its builds.
|
|
150
|
+
- **The one thing you can't do** is offer gameship itself as a competing
|
|
151
|
+
product or service (e.g. a hosted build-your-game SaaS) — that lane funds
|
|
152
|
+
the tool's maintenance.
|
|
153
|
+
- **Every release automatically becomes plain MIT two years after its
|
|
154
|
+
publication.** No takebacks, it's in the license text.
|
|
155
|
+
|
|
156
|
+
Assets: none — the example uses shapes, and the logo is original.
|
gameship-0.1.0/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/Neuroforge/gameship/main/docs/logo.png" alt="gameship" width="480">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://github.com/Neuroforge/gameship/actions/workflows/ci.yml"><img src="https://github.com/Neuroforge/gameship/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
7
|
+
<a href="https://pypi.org/project/gameship/"><img src="https://img.shields.io/pypi/v/gameship" alt="PyPI"></a>
|
|
8
|
+
<img src="https://img.shields.io/pypi/pyversions/gameship" alt="Python versions">
|
|
9
|
+
<img src="https://img.shields.io/badge/license-FSL--1.1--MIT-blue.svg" alt="License: FSL-1.1-MIT">
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
**Ship your Python game.** One command from a pygame project to real
|
|
13
|
+
Windows / macOS / Linux builds and an itch.io release — the workflow every
|
|
14
|
+
Python gamedev currently hand-rolls from PyInstaller + GitHub Actions + butler
|
|
15
|
+
blog posts, packaged.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install gameship pyinstaller
|
|
19
|
+
|
|
20
|
+
gameship build # freeze this OS's build -> dist/<platform>/
|
|
21
|
+
gameship push you/your-game # publish to itch.io (butler auto-installed)
|
|
22
|
+
gameship ci # write the 3-OS GitHub Actions workflow
|
|
23
|
+
gameship web # browser build via pygbag (pygame-ce)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Why
|
|
27
|
+
|
|
28
|
+
Python gamedevs are great at game code and stuck on the last mile: a real
|
|
29
|
+
double-clickable app for people who don't have Python, built for all three
|
|
30
|
+
OSes, uploaded to itch.io. The tools all exist — PyInstaller can't
|
|
31
|
+
cross-compile so you need per-OS builders, butler is scriptable but manual,
|
|
32
|
+
the GitHub Actions matrix is a blog-post ritual. gameship glues them so you
|
|
33
|
+
never think about it:
|
|
34
|
+
|
|
35
|
+
- **`gameship build`** — detects your entry point (`main.py`) and `assets/`
|
|
36
|
+
folder, names the app from your `pyproject.toml` or folder, runs PyInstaller
|
|
37
|
+
windowed, outputs to `dist/<platform>/`.
|
|
38
|
+
- **`gameship ci`** — drops a ready GitHub Actions workflow: every `v*` tag
|
|
39
|
+
builds Windows + macOS + Linux in parallel and uploads artifacts. Add a
|
|
40
|
+
`BUTLER_API_KEY` secret and an `ITCH_TARGET` variable and it also publishes
|
|
41
|
+
each build to the right itch.io channel.
|
|
42
|
+
- **`gameship push`** — wraps [butler](https://itch.io/docs/butler/), itch.io's
|
|
43
|
+
official CLI (downloads it on first use), so local pushes are one line too.
|
|
44
|
+
- **`gameship web`** — wraps [pygbag](https://pygame-web.github.io/) for a
|
|
45
|
+
browser build you can host on itch.io's HTML5 player (pygame-ce projects
|
|
46
|
+
with an async main loop).
|
|
47
|
+
|
|
48
|
+
## Quick start (60 seconds, local)
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
cd your-game/ # has a main.py that runs your game
|
|
52
|
+
pip install gameship pyinstaller
|
|
53
|
+
gameship build
|
|
54
|
+
open "dist/mac/YourGame.app" # or dist/windows/, dist/linux/
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Full release pipeline (10 minutes, once)
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
gameship ci
|
|
61
|
+
git add .github && git commit -m "release workflow" && git push
|
|
62
|
+
# GitHub repo -> Settings -> Secrets -> Actions: BUTLER_API_KEY (from itch.io)
|
|
63
|
+
# GitHub repo -> Settings -> Variables -> Actions: ITCH_TARGET=you/your-game
|
|
64
|
+
git tag v1.0 && git push --tags
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Three OS builds appear as artifacts; each pushes to `you/your-game:windows`,
|
|
68
|
+
`:mac`, `:linux` on itch.io. Delta uploads, versioned channels — butler's
|
|
69
|
+
whole feature set, none of its setup.
|
|
70
|
+
|
|
71
|
+
## Honest limitations (v0)
|
|
72
|
+
|
|
73
|
+
- PyInstaller quirks are inherited: Windows Defender sometimes flags frozen
|
|
74
|
+
Python apps (code-signing fixes it; on the roadmap), and asset paths inside
|
|
75
|
+
the bundle should be loaded relative to your script, not the cwd.
|
|
76
|
+
- `gameship web` requires pygame-ce and an async-ified main loop — that's a
|
|
77
|
+
[pygbag rule](https://pygame-web.github.io/wiki/pygbag/), not ours; we warn
|
|
78
|
+
rather than rewrite your code.
|
|
79
|
+
- macOS builds are unsigned/un-notarized (players right-click > Open). Signing
|
|
80
|
+
+ notarization service is the roadmap item after this one.
|
|
81
|
+
- Steam/Epic: not yet. itch.io first, on purpose.
|
|
82
|
+
|
|
83
|
+
## Example
|
|
84
|
+
|
|
85
|
+
[`example/`](example/) is a complete 60-line pygame catcher — the repo's CI
|
|
86
|
+
builds it on all three OSes and smoke-runs the frozen binary headless
|
|
87
|
+
(`SDL_VIDEODRIVER=dummy GAMESHIP_MAX_FRAMES=120`).
|
|
88
|
+
|
|
89
|
+
## Common questions this answers
|
|
90
|
+
|
|
91
|
+
**How do I turn my pygame game into an .exe?** `gameship build` on a Windows
|
|
92
|
+
machine (or let the generated workflow's Windows runner do it) — PyInstaller
|
|
93
|
+
under the hood, no spec file to write.
|
|
94
|
+
|
|
95
|
+
**How do I make a Mac .app from a pygame game?** Same command on macOS:
|
|
96
|
+
`gameship build` → `dist/mac/YourGame.app`.
|
|
97
|
+
|
|
98
|
+
**How do I upload a pygame game to itch.io automatically?** `gameship push
|
|
99
|
+
you/your-game` locally, or add the `BUTLER_API_KEY` secret so every tagged
|
|
100
|
+
release publishes to your itch channels from CI.
|
|
101
|
+
|
|
102
|
+
**How do I build my game for Windows, Mac, and Linux at once?** You can't
|
|
103
|
+
cross-compile Python — nobody can — so `gameship ci` writes the GitHub
|
|
104
|
+
Actions matrix that builds natively on all three, free on public repos.
|
|
105
|
+
|
|
106
|
+
**Is gameship open source?** Source-available under FSL-1.1-MIT: free for
|
|
107
|
+
any use except reselling gameship itself as a service, and each release
|
|
108
|
+
converts to plain MIT after two years. Games built with it are entirely
|
|
109
|
+
unaffected — they're yours.
|
|
110
|
+
|
|
111
|
+
**Can my pygame game run in the browser?** If it's pygame-ce with an async
|
|
112
|
+
main loop: `gameship web` (pygbag), then upload the build as an itch.io HTML5
|
|
113
|
+
game.
|
|
114
|
+
|
|
115
|
+
## Development
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
pip install -e . pytest
|
|
119
|
+
pytest # unit tests (pure logic, no PyInstaller needed)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The [CI](.github/workflows/ci.yml) dogfoods the tool: every push runs the
|
|
123
|
+
tests on Python 3.11–3.13 and builds + headless-smoke-runs the example game
|
|
124
|
+
on Windows, macOS, and Linux **with gameship itself**.
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
**[FSL-1.1-MIT](https://github.com/Neuroforge/gameship/blob/main/LICENSE)** (Functional Source License), which in plain words means:
|
|
129
|
+
|
|
130
|
+
- **Your games are yours.** Build them, sell them, ship them anywhere —
|
|
131
|
+
commercial use of gameship *for making things* is unrestricted, and nothing
|
|
132
|
+
about the license touches your game or its builds.
|
|
133
|
+
- **The one thing you can't do** is offer gameship itself as a competing
|
|
134
|
+
product or service (e.g. a hosted build-your-game SaaS) — that lane funds
|
|
135
|
+
the tool's maintenance.
|
|
136
|
+
- **Every release automatically becomes plain MIT two years after its
|
|
137
|
+
publication.** No takebacks, it's in the license text.
|
|
138
|
+
|
|
139
|
+
Assets: none — the example uses shapes, and the logo is original.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "gameship"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Ship your Python game: one command to per-OS builds and itch.io"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = { text = "FSL-1.1-MIT" }
|
|
12
|
+
keywords = ["pygame", "packaging", "itch.io", "pyinstaller", "game"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 3 - Alpha",
|
|
15
|
+
"Environment :: Console",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Topic :: Games/Entertainment",
|
|
18
|
+
"Topic :: Software Development :: Build Tools",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://github.com/Neuroforge/gameship"
|
|
23
|
+
|
|
24
|
+
[project.scripts]
|
|
25
|
+
gameship = "gameship:main"
|
|
26
|
+
|
|
27
|
+
[tool.setuptools.packages.find]
|
|
28
|
+
where = ["src"]
|
gameship-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"""gameship — ship your Python game.
|
|
2
|
+
|
|
3
|
+
One command from a pygame/pygame-ce (or any windowed Python) project to
|
|
4
|
+
per-OS distributables and an itch.io release:
|
|
5
|
+
|
|
6
|
+
gameship build # freeze with PyInstaller -> dist/<platform>/
|
|
7
|
+
gameship push user/game # butler push to itch.io (auto-installs butler)
|
|
8
|
+
gameship web # pygbag -> browser build (pygame-ce only)
|
|
9
|
+
gameship ci # write the 3-OS GitHub Actions workflow
|
|
10
|
+
|
|
11
|
+
Zero config: entry point, name, and assets are detected; flags override.
|
|
12
|
+
"""
|
|
13
|
+
import argparse
|
|
14
|
+
import os
|
|
15
|
+
import platform
|
|
16
|
+
import shutil
|
|
17
|
+
import subprocess
|
|
18
|
+
import sys
|
|
19
|
+
import urllib.request
|
|
20
|
+
import zipfile
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
__version__ = "0.1.0"
|
|
24
|
+
|
|
25
|
+
PLATFORM = {"darwin": "mac", "win32": "windows"}.get(sys.platform, "linux")
|
|
26
|
+
BUTLER_URL = (
|
|
27
|
+
"https://broth.itch.zone/butler/{os}-amd64/LATEST/archive/default".format(
|
|
28
|
+
os={"mac": "darwin", "windows": "windows"}.get(PLATFORM, "linux")
|
|
29
|
+
)
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def die(msg: str) -> "None":
|
|
34
|
+
print(f"gameship: {msg}", file=sys.stderr)
|
|
35
|
+
sys.exit(1)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def find_entry(root: Path, explicit: str | None) -> Path:
|
|
39
|
+
if explicit:
|
|
40
|
+
p = root / explicit
|
|
41
|
+
if not p.exists():
|
|
42
|
+
die(f"entry file not found: {p}")
|
|
43
|
+
return p
|
|
44
|
+
for name in ("main.py", "game.py", "run_game.py"):
|
|
45
|
+
if (root / name).exists():
|
|
46
|
+
return root / name
|
|
47
|
+
candidates = [p for p in root.glob("*.py") if not p.name.startswith("_")]
|
|
48
|
+
if len(candidates) == 1:
|
|
49
|
+
return candidates[0]
|
|
50
|
+
die(
|
|
51
|
+
f"couldn't pick an entry point in {root} — found "
|
|
52
|
+
f"{[c.name for c in candidates] or 'no .py files'}. "
|
|
53
|
+
"Name it main.py or pass --entry FILE."
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def game_name(root: Path, explicit: str | None) -> str:
|
|
58
|
+
if explicit:
|
|
59
|
+
return explicit
|
|
60
|
+
pyproject = root / "pyproject.toml"
|
|
61
|
+
if pyproject.exists():
|
|
62
|
+
import tomllib
|
|
63
|
+
|
|
64
|
+
try:
|
|
65
|
+
name = tomllib.loads(pyproject.read_text()).get("project", {}).get("name")
|
|
66
|
+
if name:
|
|
67
|
+
return name
|
|
68
|
+
except tomllib.TOMLDecodeError:
|
|
69
|
+
pass
|
|
70
|
+
return root.resolve().name
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def build(args) -> None:
|
|
74
|
+
root = Path(args.path)
|
|
75
|
+
if not root.is_dir():
|
|
76
|
+
die(f"not a directory: {root}")
|
|
77
|
+
entry = find_entry(root, args.entry)
|
|
78
|
+
name = game_name(root, args.name)
|
|
79
|
+
dist = Path(args.dist or (root / "dist" / PLATFORM)).resolve()
|
|
80
|
+
work = dist.parent / ".gameship-work"
|
|
81
|
+
|
|
82
|
+
cmd = [
|
|
83
|
+
sys.executable, "-m", "PyInstaller",
|
|
84
|
+
"--noconfirm", "--windowed", "--name", name,
|
|
85
|
+
"--distpath", str(dist), "--workpath", str(work),
|
|
86
|
+
"--specpath", str(work),
|
|
87
|
+
]
|
|
88
|
+
sep = ";" if PLATFORM == "windows" else ":"
|
|
89
|
+
for adir in ("assets", "data", "resources"):
|
|
90
|
+
if (root / adir).is_dir():
|
|
91
|
+
cmd += ["--add-data", f"{root / adir}{sep}{adir}"]
|
|
92
|
+
if args.onefile:
|
|
93
|
+
cmd.append("--onefile")
|
|
94
|
+
cmd.append(str(entry))
|
|
95
|
+
|
|
96
|
+
print(f"gameship: building '{name}' from {entry.name} for {PLATFORM}")
|
|
97
|
+
try:
|
|
98
|
+
subprocess.run(cmd, check=True)
|
|
99
|
+
except FileNotFoundError:
|
|
100
|
+
die("PyInstaller not found — pip install pyinstaller")
|
|
101
|
+
except subprocess.CalledProcessError as e:
|
|
102
|
+
die(f"PyInstaller failed (exit {e.returncode})")
|
|
103
|
+
shutil.rmtree(work, ignore_errors=True)
|
|
104
|
+
print(f"gameship: done -> {dist}")
|
|
105
|
+
print("gameship: note — bundled asset paths resolve relative to the exe; "
|
|
106
|
+
"load files relative to __file__ or sys._MEIPASS-aware helpers.")
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def butler_bin() -> str:
|
|
110
|
+
found = shutil.which("butler")
|
|
111
|
+
if found:
|
|
112
|
+
return found
|
|
113
|
+
cache = Path.home() / ".cache" / "gameship"
|
|
114
|
+
exe = cache / ("butler.exe" if PLATFORM == "windows" else "butler")
|
|
115
|
+
if exe.exists():
|
|
116
|
+
return str(exe)
|
|
117
|
+
cache.mkdir(parents=True, exist_ok=True)
|
|
118
|
+
zip_path = cache / "butler.zip"
|
|
119
|
+
print(f"gameship: fetching butler ({BUTLER_URL})")
|
|
120
|
+
urllib.request.urlretrieve(BUTLER_URL, zip_path)
|
|
121
|
+
with zipfile.ZipFile(zip_path) as z:
|
|
122
|
+
z.extractall(cache)
|
|
123
|
+
zip_path.unlink()
|
|
124
|
+
exe.chmod(0o755)
|
|
125
|
+
return str(exe)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def push(args) -> None:
|
|
129
|
+
if "/" not in args.target:
|
|
130
|
+
die("target must be user/game (your itch.io username/project slug)")
|
|
131
|
+
dist = Path(args.path or f"dist/{PLATFORM}")
|
|
132
|
+
if not dist.is_dir():
|
|
133
|
+
die(f"no build at {dist} — run `gameship build` first")
|
|
134
|
+
if not os.environ.get("BUTLER_API_KEY"):
|
|
135
|
+
die("BUTLER_API_KEY not set — get one at https://itch.io/user/settings/api-keys")
|
|
136
|
+
channel = args.channel or PLATFORM
|
|
137
|
+
cmd = [butler_bin(), "push", str(dist), f"{args.target}:{channel}"]
|
|
138
|
+
if args.userversion:
|
|
139
|
+
cmd += ["--userversion", args.userversion]
|
|
140
|
+
print("gameship:", " ".join(cmd))
|
|
141
|
+
subprocess.run(cmd, check=True)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def web(args) -> None:
|
|
145
|
+
root = Path(args.path)
|
|
146
|
+
entry = find_entry(root, args.entry)
|
|
147
|
+
try:
|
|
148
|
+
import pygame # noqa: F401
|
|
149
|
+
|
|
150
|
+
if not getattr(pygame, "IS_CE", False):
|
|
151
|
+
print(
|
|
152
|
+
"gameship: warning — pygbag supports pygame-ce, not classic pygame "
|
|
153
|
+
"(pip install pygame-ce). Also: your main loop must be async "
|
|
154
|
+
"(https://pygame-web.github.io/wiki/pygbag/). Continuing anyway."
|
|
155
|
+
)
|
|
156
|
+
except ImportError:
|
|
157
|
+
pass
|
|
158
|
+
try:
|
|
159
|
+
subprocess.run(
|
|
160
|
+
[sys.executable, "-m", "pygbag", "--build", str(entry.parent)], check=True
|
|
161
|
+
)
|
|
162
|
+
except FileNotFoundError:
|
|
163
|
+
die("pygbag not found — pip install pygbag")
|
|
164
|
+
except subprocess.CalledProcessError as e:
|
|
165
|
+
die(f"pygbag failed (exit {e.returncode})")
|
|
166
|
+
print(f"gameship: web build -> {entry.parent / 'build' / 'web'}")
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
WORKFLOW = """\
|
|
170
|
+
# Made by `gameship ci` — builds your game for Windows/macOS/Linux on every
|
|
171
|
+
# version tag (and by hand from the Actions tab). To also publish to itch.io:
|
|
172
|
+
# 1. repo Settings > Secrets > Actions: add BUTLER_API_KEY
|
|
173
|
+
# 2. repo Settings > Variables > Actions: add ITCH_TARGET = youruser/your-game
|
|
174
|
+
name: gameship
|
|
175
|
+
on:
|
|
176
|
+
push:
|
|
177
|
+
tags: ["v*"]
|
|
178
|
+
workflow_dispatch:
|
|
179
|
+
|
|
180
|
+
jobs:
|
|
181
|
+
build:
|
|
182
|
+
strategy:
|
|
183
|
+
fail-fast: false
|
|
184
|
+
matrix:
|
|
185
|
+
include:
|
|
186
|
+
- { os: ubuntu-latest, channel: linux }
|
|
187
|
+
- { os: windows-latest, channel: windows }
|
|
188
|
+
- { os: macos-latest, channel: mac }
|
|
189
|
+
runs-on: ${{ matrix.os }}
|
|
190
|
+
steps:
|
|
191
|
+
- uses: actions/checkout@v4
|
|
192
|
+
- uses: actions/setup-python@v5
|
|
193
|
+
with: { python-version: "3.12" }
|
|
194
|
+
- name: install game deps
|
|
195
|
+
shell: bash
|
|
196
|
+
run: |
|
|
197
|
+
pip install pyinstaller gameship
|
|
198
|
+
[ -f requirements.txt ] && pip install -r requirements.txt || pip install pygame-ce
|
|
199
|
+
- run: gameship build
|
|
200
|
+
- uses: actions/upload-artifact@v4
|
|
201
|
+
with:
|
|
202
|
+
name: game-${{ matrix.channel }}
|
|
203
|
+
path: dist/
|
|
204
|
+
- name: publish to itch.io
|
|
205
|
+
if: ${{ env.KEY != '' && vars.ITCH_TARGET != '' }}
|
|
206
|
+
shell: bash
|
|
207
|
+
env:
|
|
208
|
+
KEY: ${{ secrets.BUTLER_API_KEY }}
|
|
209
|
+
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
|
|
210
|
+
run: gameship push "${{ vars.ITCH_TARGET }}" --channel "${{ matrix.channel }}"
|
|
211
|
+
"""
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def ci(args) -> None:
|
|
215
|
+
out = Path(args.path) / ".github" / "workflows" / "gameship.yml"
|
|
216
|
+
if out.exists() and not args.force:
|
|
217
|
+
die(f"{out} exists — pass --force to overwrite")
|
|
218
|
+
out.parent.mkdir(parents=True, exist_ok=True)
|
|
219
|
+
out.write_text(WORKFLOW)
|
|
220
|
+
print(f"gameship: wrote {out}")
|
|
221
|
+
print("gameship: tag a release (git tag v1.0 && git push --tags) to build; "
|
|
222
|
+
"add BUTLER_API_KEY + ITCH_TARGET to publish.")
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def main() -> None:
|
|
226
|
+
ap = argparse.ArgumentParser(prog="gameship", description=__doc__.splitlines()[0])
|
|
227
|
+
ap.add_argument("--version", action="version", version=__version__)
|
|
228
|
+
sub = ap.add_subparsers(dest="cmd", required=True)
|
|
229
|
+
|
|
230
|
+
b = sub.add_parser("build", help="freeze the game for this OS -> dist/<platform>/")
|
|
231
|
+
b.add_argument("path", nargs="?", default=".")
|
|
232
|
+
b.add_argument("--entry", help="entry .py (default: auto-detect main.py)")
|
|
233
|
+
b.add_argument("--name", help="app name (default: pyproject name or folder)")
|
|
234
|
+
b.add_argument("--dist", help="output dir (default: dist/<platform>)")
|
|
235
|
+
b.add_argument("--onefile", action="store_true", help="single-file binary")
|
|
236
|
+
b.set_defaults(fn=build)
|
|
237
|
+
|
|
238
|
+
p = sub.add_parser("push", help="push a build to itch.io via butler")
|
|
239
|
+
p.add_argument("target", help="itch.io user/game")
|
|
240
|
+
p.add_argument("path", nargs="?", help="build dir (default dist/<platform>)")
|
|
241
|
+
p.add_argument("--channel", help="itch channel (default: this platform)")
|
|
242
|
+
p.add_argument("--userversion", help="version string shown on itch")
|
|
243
|
+
p.set_defaults(fn=push)
|
|
244
|
+
|
|
245
|
+
w = sub.add_parser("web", help="browser build via pygbag (pygame-ce)")
|
|
246
|
+
w.add_argument("path", nargs="?", default=".")
|
|
247
|
+
w.add_argument("--entry")
|
|
248
|
+
w.set_defaults(fn=web)
|
|
249
|
+
|
|
250
|
+
c = sub.add_parser("ci", help="write the 3-OS GitHub Actions workflow")
|
|
251
|
+
c.add_argument("path", nargs="?", default=".")
|
|
252
|
+
c.add_argument("--force", action="store_true")
|
|
253
|
+
c.set_defaults(fn=ci)
|
|
254
|
+
|
|
255
|
+
args = ap.parse_args()
|
|
256
|
+
args.fn(args)
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
if __name__ == "__main__":
|
|
260
|
+
main()
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gameship
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Ship your Python game: one command to per-OS builds and itch.io
|
|
5
|
+
License: FSL-1.1-MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/Neuroforge/gameship
|
|
7
|
+
Keywords: pygame,packaging,itch.io,pyinstaller,game
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Topic :: Games/Entertainment
|
|
12
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
13
|
+
Requires-Python: >=3.11
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<img src="https://raw.githubusercontent.com/Neuroforge/gameship/main/docs/logo.png" alt="gameship" width="480">
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
<p align="center">
|
|
23
|
+
<a href="https://github.com/Neuroforge/gameship/actions/workflows/ci.yml"><img src="https://github.com/Neuroforge/gameship/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
24
|
+
<a href="https://pypi.org/project/gameship/"><img src="https://img.shields.io/pypi/v/gameship" alt="PyPI"></a>
|
|
25
|
+
<img src="https://img.shields.io/pypi/pyversions/gameship" alt="Python versions">
|
|
26
|
+
<img src="https://img.shields.io/badge/license-FSL--1.1--MIT-blue.svg" alt="License: FSL-1.1-MIT">
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
**Ship your Python game.** One command from a pygame project to real
|
|
30
|
+
Windows / macOS / Linux builds and an itch.io release — the workflow every
|
|
31
|
+
Python gamedev currently hand-rolls from PyInstaller + GitHub Actions + butler
|
|
32
|
+
blog posts, packaged.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install gameship pyinstaller
|
|
36
|
+
|
|
37
|
+
gameship build # freeze this OS's build -> dist/<platform>/
|
|
38
|
+
gameship push you/your-game # publish to itch.io (butler auto-installed)
|
|
39
|
+
gameship ci # write the 3-OS GitHub Actions workflow
|
|
40
|
+
gameship web # browser build via pygbag (pygame-ce)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Why
|
|
44
|
+
|
|
45
|
+
Python gamedevs are great at game code and stuck on the last mile: a real
|
|
46
|
+
double-clickable app for people who don't have Python, built for all three
|
|
47
|
+
OSes, uploaded to itch.io. The tools all exist — PyInstaller can't
|
|
48
|
+
cross-compile so you need per-OS builders, butler is scriptable but manual,
|
|
49
|
+
the GitHub Actions matrix is a blog-post ritual. gameship glues them so you
|
|
50
|
+
never think about it:
|
|
51
|
+
|
|
52
|
+
- **`gameship build`** — detects your entry point (`main.py`) and `assets/`
|
|
53
|
+
folder, names the app from your `pyproject.toml` or folder, runs PyInstaller
|
|
54
|
+
windowed, outputs to `dist/<platform>/`.
|
|
55
|
+
- **`gameship ci`** — drops a ready GitHub Actions workflow: every `v*` tag
|
|
56
|
+
builds Windows + macOS + Linux in parallel and uploads artifacts. Add a
|
|
57
|
+
`BUTLER_API_KEY` secret and an `ITCH_TARGET` variable and it also publishes
|
|
58
|
+
each build to the right itch.io channel.
|
|
59
|
+
- **`gameship push`** — wraps [butler](https://itch.io/docs/butler/), itch.io's
|
|
60
|
+
official CLI (downloads it on first use), so local pushes are one line too.
|
|
61
|
+
- **`gameship web`** — wraps [pygbag](https://pygame-web.github.io/) for a
|
|
62
|
+
browser build you can host on itch.io's HTML5 player (pygame-ce projects
|
|
63
|
+
with an async main loop).
|
|
64
|
+
|
|
65
|
+
## Quick start (60 seconds, local)
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
cd your-game/ # has a main.py that runs your game
|
|
69
|
+
pip install gameship pyinstaller
|
|
70
|
+
gameship build
|
|
71
|
+
open "dist/mac/YourGame.app" # or dist/windows/, dist/linux/
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Full release pipeline (10 minutes, once)
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
gameship ci
|
|
78
|
+
git add .github && git commit -m "release workflow" && git push
|
|
79
|
+
# GitHub repo -> Settings -> Secrets -> Actions: BUTLER_API_KEY (from itch.io)
|
|
80
|
+
# GitHub repo -> Settings -> Variables -> Actions: ITCH_TARGET=you/your-game
|
|
81
|
+
git tag v1.0 && git push --tags
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Three OS builds appear as artifacts; each pushes to `you/your-game:windows`,
|
|
85
|
+
`:mac`, `:linux` on itch.io. Delta uploads, versioned channels — butler's
|
|
86
|
+
whole feature set, none of its setup.
|
|
87
|
+
|
|
88
|
+
## Honest limitations (v0)
|
|
89
|
+
|
|
90
|
+
- PyInstaller quirks are inherited: Windows Defender sometimes flags frozen
|
|
91
|
+
Python apps (code-signing fixes it; on the roadmap), and asset paths inside
|
|
92
|
+
the bundle should be loaded relative to your script, not the cwd.
|
|
93
|
+
- `gameship web` requires pygame-ce and an async-ified main loop — that's a
|
|
94
|
+
[pygbag rule](https://pygame-web.github.io/wiki/pygbag/), not ours; we warn
|
|
95
|
+
rather than rewrite your code.
|
|
96
|
+
- macOS builds are unsigned/un-notarized (players right-click > Open). Signing
|
|
97
|
+
+ notarization service is the roadmap item after this one.
|
|
98
|
+
- Steam/Epic: not yet. itch.io first, on purpose.
|
|
99
|
+
|
|
100
|
+
## Example
|
|
101
|
+
|
|
102
|
+
[`example/`](example/) is a complete 60-line pygame catcher — the repo's CI
|
|
103
|
+
builds it on all three OSes and smoke-runs the frozen binary headless
|
|
104
|
+
(`SDL_VIDEODRIVER=dummy GAMESHIP_MAX_FRAMES=120`).
|
|
105
|
+
|
|
106
|
+
## Common questions this answers
|
|
107
|
+
|
|
108
|
+
**How do I turn my pygame game into an .exe?** `gameship build` on a Windows
|
|
109
|
+
machine (or let the generated workflow's Windows runner do it) — PyInstaller
|
|
110
|
+
under the hood, no spec file to write.
|
|
111
|
+
|
|
112
|
+
**How do I make a Mac .app from a pygame game?** Same command on macOS:
|
|
113
|
+
`gameship build` → `dist/mac/YourGame.app`.
|
|
114
|
+
|
|
115
|
+
**How do I upload a pygame game to itch.io automatically?** `gameship push
|
|
116
|
+
you/your-game` locally, or add the `BUTLER_API_KEY` secret so every tagged
|
|
117
|
+
release publishes to your itch channels from CI.
|
|
118
|
+
|
|
119
|
+
**How do I build my game for Windows, Mac, and Linux at once?** You can't
|
|
120
|
+
cross-compile Python — nobody can — so `gameship ci` writes the GitHub
|
|
121
|
+
Actions matrix that builds natively on all three, free on public repos.
|
|
122
|
+
|
|
123
|
+
**Is gameship open source?** Source-available under FSL-1.1-MIT: free for
|
|
124
|
+
any use except reselling gameship itself as a service, and each release
|
|
125
|
+
converts to plain MIT after two years. Games built with it are entirely
|
|
126
|
+
unaffected — they're yours.
|
|
127
|
+
|
|
128
|
+
**Can my pygame game run in the browser?** If it's pygame-ce with an async
|
|
129
|
+
main loop: `gameship web` (pygbag), then upload the build as an itch.io HTML5
|
|
130
|
+
game.
|
|
131
|
+
|
|
132
|
+
## Development
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
pip install -e . pytest
|
|
136
|
+
pytest # unit tests (pure logic, no PyInstaller needed)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The [CI](.github/workflows/ci.yml) dogfoods the tool: every push runs the
|
|
140
|
+
tests on Python 3.11–3.13 and builds + headless-smoke-runs the example game
|
|
141
|
+
on Windows, macOS, and Linux **with gameship itself**.
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
**[FSL-1.1-MIT](https://github.com/Neuroforge/gameship/blob/main/LICENSE)** (Functional Source License), which in plain words means:
|
|
146
|
+
|
|
147
|
+
- **Your games are yours.** Build them, sell them, ship them anywhere —
|
|
148
|
+
commercial use of gameship *for making things* is unrestricted, and nothing
|
|
149
|
+
about the license touches your game or its builds.
|
|
150
|
+
- **The one thing you can't do** is offer gameship itself as a competing
|
|
151
|
+
product or service (e.g. a hosted build-your-game SaaS) — that lane funds
|
|
152
|
+
the tool's maintenance.
|
|
153
|
+
- **Every release automatically becomes plain MIT two years after its
|
|
154
|
+
publication.** No takebacks, it's in the license text.
|
|
155
|
+
|
|
156
|
+
Assets: none — the example uses shapes, and the logo is original.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/gameship/__init__.py
|
|
5
|
+
src/gameship.egg-info/PKG-INFO
|
|
6
|
+
src/gameship.egg-info/SOURCES.txt
|
|
7
|
+
src/gameship.egg-info/dependency_links.txt
|
|
8
|
+
src/gameship.egg-info/entry_points.txt
|
|
9
|
+
src/gameship.egg-info/top_level.txt
|
|
10
|
+
tests/test_gameship.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gameship
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""Unit tests for gameship's pure logic (no PyInstaller/butler/network)."""
|
|
2
|
+
import subprocess
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from types import SimpleNamespace
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
|
|
9
|
+
import gameship
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_version_flag():
|
|
13
|
+
with pytest.raises(SystemExit) as e:
|
|
14
|
+
sys.argv = ["gameship", "--version"]
|
|
15
|
+
gameship.main()
|
|
16
|
+
assert e.value.code == 0
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def test_find_entry_prefers_main(tmp_path):
|
|
20
|
+
(tmp_path / "main.py").touch()
|
|
21
|
+
(tmp_path / "other.py").touch()
|
|
22
|
+
assert gameship.find_entry(tmp_path, None).name == "main.py"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def test_find_entry_single_candidate(tmp_path):
|
|
26
|
+
(tmp_path / "mygame.py").touch()
|
|
27
|
+
assert gameship.find_entry(tmp_path, None).name == "mygame.py"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_find_entry_explicit_and_missing(tmp_path):
|
|
31
|
+
(tmp_path / "play.py").touch()
|
|
32
|
+
assert gameship.find_entry(tmp_path, "play.py").name == "play.py"
|
|
33
|
+
with pytest.raises(SystemExit):
|
|
34
|
+
gameship.find_entry(tmp_path, "nope.py")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_find_entry_ambiguous_dies(tmp_path):
|
|
38
|
+
(tmp_path / "a.py").touch()
|
|
39
|
+
(tmp_path / "b.py").touch()
|
|
40
|
+
with pytest.raises(SystemExit):
|
|
41
|
+
gameship.find_entry(tmp_path, None)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_game_name_sources(tmp_path):
|
|
45
|
+
assert gameship.game_name(tmp_path, "Explicit") == "Explicit"
|
|
46
|
+
(tmp_path / "pyproject.toml").write_text('[project]\nname = "toml-name"\n')
|
|
47
|
+
assert gameship.game_name(tmp_path, None) == "toml-name"
|
|
48
|
+
(tmp_path / "pyproject.toml").write_text("not [valid toml")
|
|
49
|
+
assert gameship.game_name(tmp_path, None) == tmp_path.resolve().name
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def test_build_command_construction(tmp_path, monkeypatch):
|
|
53
|
+
(tmp_path / "main.py").touch()
|
|
54
|
+
(tmp_path / "assets").mkdir()
|
|
55
|
+
seen = {}
|
|
56
|
+
monkeypatch.setattr(gameship.subprocess, "run", lambda cmd, check: seen.setdefault("cmd", cmd))
|
|
57
|
+
args = SimpleNamespace(path=str(tmp_path), entry=None, name="MyGame", dist=None, onefile=True)
|
|
58
|
+
gameship.build(args)
|
|
59
|
+
cmd = seen["cmd"]
|
|
60
|
+
assert "--windowed" in cmd and "--onefile" in cmd
|
|
61
|
+
assert cmd[cmd.index("--name") + 1] == "MyGame"
|
|
62
|
+
assert any(str(tmp_path / "assets") in c for c in cmd) # --add-data wired
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def test_ci_writes_and_respects_force(tmp_path):
|
|
66
|
+
gameship.ci(SimpleNamespace(path=str(tmp_path), force=False))
|
|
67
|
+
wf = tmp_path / ".github" / "workflows" / "gameship.yml"
|
|
68
|
+
text = wf.read_text()
|
|
69
|
+
assert "windows-latest" in text and "macos-latest" in text and "ubuntu-latest" in text
|
|
70
|
+
assert "BUTLER_API_KEY" in text
|
|
71
|
+
with pytest.raises(SystemExit):
|
|
72
|
+
gameship.ci(SimpleNamespace(path=str(tmp_path), force=False))
|
|
73
|
+
gameship.ci(SimpleNamespace(path=str(tmp_path), force=True)) # no raise
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def test_push_validates_target_and_build_dir(tmp_path, monkeypatch):
|
|
77
|
+
monkeypatch.chdir(tmp_path)
|
|
78
|
+
with pytest.raises(SystemExit):
|
|
79
|
+
gameship.push(SimpleNamespace(target="no-slash", path=None, channel=None, userversion=None))
|
|
80
|
+
with pytest.raises(SystemExit): # valid target, but no build dir
|
|
81
|
+
gameship.push(SimpleNamespace(target="user/game", path=None, channel=None, userversion=None))
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def test_cli_smoke():
|
|
85
|
+
out = subprocess.run(
|
|
86
|
+
[sys.executable, "-c", "import gameship; print(gameship.__version__)"],
|
|
87
|
+
capture_output=True, text=True, check=True,
|
|
88
|
+
)
|
|
89
|
+
assert out.stdout.strip() == gameship.__version__
|