Skip to content

Commit 665238b

Browse files
authored
Merge pull request #163 from pyscript/2025-2-1
2025 2 1
2 parents 9610519 + 74ac97d commit 665238b

File tree

7 files changed

+71
-14
lines changed

7 files changed

+71
-14
lines changed

docs/beginning-pyscript.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ module in the document's `<head>` tag:
117117
<meta charset="utf-8" />
118118
<meta name="viewport" content="width=device-width,initial-scale=1" />
119119
<title>🦜 Polyglot - Piratical PyScript</title>
120-
<link rel="stylesheet" href="https://pyscript.net/releases/2024.11.1/core.css">
121-
<script type="module" src="https://pyscript.net/releases/2024.11.1/core.js"></script>
120+
<link rel="stylesheet" href="https://pyscript.net/releases/2025.2.1/core.css">
121+
<script type="module" src="https://pyscript.net/releases/2025.2.1/core.js"></script>
122122
</head>
123123
<body>
124124

@@ -168,8 +168,8 @@ In the end, our HTML should look like this:
168168
<meta charset="utf-8" />
169169
<meta name="viewport" content="width=device-width,initial-scale=1" />
170170
<title>🦜 Polyglot - Piratical PyScript</title>
171-
<link rel="stylesheet" href="https://pyscript.net/releases/2024.11.1/core.css">
172-
<script type="module" src="https://pyscript.net/releases/2024.11.1/core.js"></script>
171+
<link rel="stylesheet" href="https://pyscript.net/releases/2025.2.1/core.css">
172+
<script type="module" src="https://pyscript.net/releases/2025.2.1/core.js"></script>
173173
</head>
174174
<body>
175175
<h1>Polyglot 🦜 💬 🇬🇧 ➡️ 🏴‍☠️</h1>

docs/user-guide/first-steps.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ CSS:
2020
<meta charset="UTF-8">
2121
<meta name="viewport" content="width=device-width,initial-scale=1.0">
2222
<!-- PyScript CSS -->
23-
<link rel="stylesheet" href="https://pyscript.net/releases/2024.11.1/core.css">
23+
<link rel="stylesheet" href="https://pyscript.net/releases/2025.2.1/core.css">
2424
<!-- This script tag bootstraps PyScript -->
25-
<script type="module" src="https://pyscript.net/releases/2024.11.1/core.js"></script>
25+
<script type="module" src="https://pyscript.net/releases/2025.2.1/core.js"></script>
2626
</head>
2727
<body>
2828
<!-- your code goes here... -->

docs/user-guide/plugins.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ For example, this will work because all references are contained within the
100100
registered function:
101101

102102
```js
103-
import { hooks } from "https://pyscript.net/releases/2024.11.1/core.js";
103+
import { hooks } from "https://pyscript.net/releases/2025.2.1/core.js";
104104

105105
hooks.worker.onReady.add(() => {
106106
// NOT suggested, just an example!
@@ -114,7 +114,7 @@ hooks.worker.onReady.add(() => {
114114
However, due to the outer reference to the variable `i`, this will fail:
115115

116116
```js
117-
import { hooks } from "https://pyscript.net/releases/2024.11.1/core.js";
117+
import { hooks } from "https://pyscript.net/releases/2025.2.1/core.js";
118118

119119
// NO NO NO NO NO! ☠️
120120
let i = 0;
@@ -147,7 +147,7 @@ the page.
147147

148148
```js title="log.js - a plugin that simply logs to the console."
149149
// import the hooks from PyScript first...
150-
import { hooks } from "https://pyscript.net/releases/2024.11.1/core.js";
150+
import { hooks } from "https://pyscript.net/releases/2025.2.1/core.js";
151151

152152
// The `hooks.main` attribute defines plugins that run on the main thread.
153153
hooks.main.onReady.add((wrap, element) => {
@@ -197,8 +197,8 @@ hooks.worker.onAfterRun.add(() => {
197197
<!-- JS plugins should be available before PyScript bootstraps -->
198198
<script type="module" src="./log.js"></script>
199199
<!-- PyScript -->
200-
<link rel="stylesheet" href="https://pyscript.net/releases/2024.11.1/core.css">
201-
<script type="module" src="https://pyscript.net/releases/2024.11.1/core.js"></script>
200+
<link rel="stylesheet" href="https://pyscript.net/releases/2025.2.1/core.css">
201+
<script type="module" src="https://pyscript.net/releases/2025.2.1/core.js"></script>
202202
</head>
203203
<body>
204204
<script type="mpy">

docs/user-guide/pygame-ce.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# PyGame Support
2+
3+
!!! Danger
4+
5+
**Support for PyGame-CE is experimental** and its behaviour is likely to
6+
change as we get feedback and bug reports from the community.
7+
8+
Please bear this in mind as you try PyGame-CE with PyScript, and all
9+
feedback, bug reports and constructive critique is welcome via discord
10+
or GitHub.
11+
12+
13+
[PyGameCE](https://pyga.me/) is a Python library for building powerful games
14+
(so says their website). They also say, to get started you just need to
15+
`pip install pygame-ce`.
16+
17+
Thanks to work in the upstream [Pyodide project](https://pyodide.org/)
18+
PyGame-CE is available in PyScript and to get started all you need to do is:
19+
`<script type="py-game" src="my_game.py"></script>` Now you don't even need to
20+
`pip install` the library! It comes with PyScript by default, and you can share
21+
your games via a URL!
22+
23+
!!! Info
24+
25+
Please refer to
26+
[PyGame-CE's extensive documentation](https://pyga.me/docs/) for how to
27+
create a game. Some things may not work because we're running in a
28+
browser context, but play around and let us know how you get on.
29+
30+
## How it works
31+
32+
When a `<script type="py-game"></script>` element is found on the page a
33+
Pyodide instance is bootstrapped with the `pygame-ce` package already included.
34+
Differently from other scripts, `py-game` cannot currently work through a
35+
worker and it uses an optional target attribute to define the `<canvas>`
36+
element id that will be used to render the game. If no target attribute is
37+
defined, the script assumes there is a `<canvas id="canvas">` element already
38+
on the page.
39+
40+
A config attribute can be specified to add extra packages but right now that's
41+
all it can do.
42+
43+
This is an experiment, but:
44+
45+
* It is possible to use regular PyScript to load the pygame-ce package and use
46+
all the other features. But there be dragons! This helper simply allows
47+
multiple games on a page and forces game logic to run on the main thread to
48+
reduce confusion around attributes and features when the `pygame-ce` package
49+
is meant to be used. Put simply, we make it relatively safe and easy to use.
50+
* The fact `pygame-ce` is the default "game engine" does not mean in the future
51+
PyScript won't have other engines also available.
52+
* Once again, as this is an experiment, we welcome any kind of feedback,
53+
suggestions, hints on how to improve or reports of what's missing.
54+
55+
Other than that, please go make and share wonderful games. We can't wait to see
56+
what you come up with.

docs/user-guide/workers.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@ Here's how:
282282
<meta charset="utf-8">
283283
<meta name="viewport" content="width=device-width,initial-scale=1">
284284
<!-- PyScript CSS -->
285-
<link rel="stylesheet" href="https://pyscript.net/releases/2024.11.1/core.css">
285+
<link rel="stylesheet" href="https://pyscript.net/releases/2025.2.1/core.css">
286286
<!-- This script tag bootstraps PyScript -->
287-
<script type="module" src="https://pyscript.net/releases/2024.11.1/core.js"></script>
287+
<script type="module" src="https://pyscript.net/releases/2025.2.1/core.js"></script>
288288
<title>PyWorker - mpy bootstrapping pyodide example</title>
289289
<script type="mpy" src="main.py"></script>
290290
</head>

mkdocs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ nav:
7474
- The FFI in detail: user-guide/ffi.md
7575
- Python terminal: user-guide/terminal.md
7676
- Python editor: user-guide/editor.md
77+
- PyGame-CE: user-guide/pygame-ce.md
7778
- Plugins: user-guide/plugins.md
7879
- Use Offline: user-guide/offline.md
7980
- Built-in APIs: api.md

version.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "2024.11.1"
2+
"version": "2025.2.1"
33
}

0 commit comments

Comments
 (0)