pygodide 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.
Files changed (139) hide show
  1. pygodide-0.1.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  2. pygodide-0.1.0/.github/ISSUE_TEMPLATE/conversion-failure.yml +46 -0
  3. pygodide-0.1.0/.github/workflows/ci.yml +59 -0
  4. pygodide-0.1.0/.github/workflows/docs.yml +34 -0
  5. pygodide-0.1.0/.github/workflows/publish.yml +73 -0
  6. pygodide-0.1.0/.gitignore +232 -0
  7. pygodide-0.1.0/.pre-commit-config.yaml +24 -0
  8. pygodide-0.1.0/AGENTS.md +177 -0
  9. pygodide-0.1.0/LICENSE +21 -0
  10. pygodide-0.1.0/PKG-INFO +176 -0
  11. pygodide-0.1.0/README.md +135 -0
  12. pygodide-0.1.0/benchmarks/.gitignore +3 -0
  13. pygodide-0.1.0/benchmarks/README.md +107 -0
  14. pygodide-0.1.0/benchmarks/perf_benchmark/__init__.py +1 -0
  15. pygodide-0.1.0/benchmarks/perf_benchmark/browser.py +243 -0
  16. pygodide-0.1.0/benchmarks/perf_benchmark/browser_launch.py +79 -0
  17. pygodide-0.1.0/benchmarks/perf_benchmark/chart.py +299 -0
  18. pygodide-0.1.0/benchmarks/perf_benchmark/config.py +33 -0
  19. pygodide-0.1.0/benchmarks/perf_benchmark/local.py +110 -0
  20. pygodide-0.1.0/benchmarks/perf_benchmark/metadata.py +62 -0
  21. pygodide-0.1.0/benchmarks/perf_benchmark/models.py +35 -0
  22. pygodide-0.1.0/benchmarks/perf_benchmark/parse.py +12 -0
  23. pygodide-0.1.0/benchmarks/perf_benchmark/serve.py +30 -0
  24. pygodide-0.1.0/benchmarks/perf_benchmark/workspace.py +22 -0
  25. pygodide-0.1.0/benchmarks/run.py +211 -0
  26. pygodide-0.1.0/docs/assets/benchmark-chart.html +7 -0
  27. pygodide-0.1.0/docs/assets/images/benchmark-readme.png +0 -0
  28. pygodide-0.1.0/docs/assets/images/favicon.svg +110 -0
  29. pygodide-0.1.0/docs/assets/images/loading-screen.gif +0 -0
  30. pygodide-0.1.0/docs/assets/images/logo.svg +110 -0
  31. pygodide-0.1.0/docs/assets/images/pygodide-logo.svg +143 -0
  32. pygodide-0.1.0/docs/benchmark.md +111 -0
  33. pygodide-0.1.0/docs/cli.md +5 -0
  34. pygodide-0.1.0/docs/index.md +144 -0
  35. pygodide-0.1.0/docs/instructions.md +528 -0
  36. pygodide-0.1.0/docs/styles/overrides.css +88 -0
  37. pygodide-0.1.0/pygodide/__init__.py +16 -0
  38. pygodide-0.1.0/pygodide/asyncify.py +603 -0
  39. pygodide-0.1.0/pygodide/builder/__init__.py +9 -0
  40. pygodide-0.1.0/pygodide/builder/display_size.py +331 -0
  41. pygodide-0.1.0/pygodide/builder/pipeline.py +182 -0
  42. pygodide-0.1.0/pygodide/builder/plan.py +476 -0
  43. pygodide-0.1.0/pygodide/builder/zip.py +123 -0
  44. pygodide-0.1.0/pygodide/cli/__init__.py +0 -0
  45. pygodide-0.1.0/pygodide/cli/main.py +375 -0
  46. pygodide-0.1.0/pygodide/cli/runners.py +266 -0
  47. pygodide-0.1.0/pygodide/deps.py +259 -0
  48. pygodide-0.1.0/pygodide/logs.py +251 -0
  49. pygodide-0.1.0/pygodide/project_config.py +195 -0
  50. pygodide-0.1.0/pygodide/rendering.py +302 -0
  51. pygodide-0.1.0/pygodide/serving.py +74 -0
  52. pygodide-0.1.0/pygodide/smoke/__init__.py +45 -0
  53. pygodide-0.1.0/pygodide/smoke/manifest.py +349 -0
  54. pygodide-0.1.0/pygodide/smoke/playwright_smoke.py +236 -0
  55. pygodide-0.1.0/pygodide/smoke/runner.py +257 -0
  56. pygodide-0.1.0/pygodide/templates/boot.js +655 -0
  57. pygodide-0.1.0/pygodide/templates/index.html +548 -0
  58. pygodide-0.1.0/pygodide/templates/startup.py.j2 +103 -0
  59. pygodide-0.1.0/pyproject.toml +120 -0
  60. pygodide-0.1.0/test_targets/README.md +89 -0
  61. pygodide-0.1.0/test_targets/asset_maze/assets/sprites/nested/deep/marker.png +0 -0
  62. pygodide-0.1.0/test_targets/asset_maze/assets/ui/badge.png +0 -0
  63. pygodide-0.1.0/test_targets/asset_maze/data/configs/waves.json +1 -0
  64. pygodide-0.1.0/test_targets/asset_maze/data/strings/title.txt +1 -0
  65. pygodide-0.1.0/test_targets/asset_maze/favicon.svg +72 -0
  66. pygodide-0.1.0/test_targets/asset_maze/game/__init__.py +0 -0
  67. pygodide-0.1.0/test_targets/asset_maze/game/app.py +38 -0
  68. pygodide-0.1.0/test_targets/asset_maze/game/loaders/__init__.py +13 -0
  69. pygodide-0.1.0/test_targets/asset_maze/game/loaders/audio.py +5 -0
  70. pygodide-0.1.0/test_targets/asset_maze/game/loaders/data.py +11 -0
  71. pygodide-0.1.0/test_targets/asset_maze/game/loaders/sprites.py +9 -0
  72. pygodide-0.1.0/test_targets/asset_maze/game/loaders/vendor_audio.py +5 -0
  73. pygodide-0.1.0/test_targets/asset_maze/main.py +75 -0
  74. pygodide-0.1.0/test_targets/asset_maze/pyproject.toml +8 -0
  75. pygodide-0.1.0/test_targets/asset_maze/sounds/root_chime.ogg +0 -0
  76. pygodide-0.1.0/test_targets/asset_maze/testing_manifest.yaml +7 -0
  77. pygodide-0.1.0/test_targets/asset_maze/vendor/tiny_sfx/ping.ogg +0 -0
  78. pygodide-0.1.0/test_targets/async_hang/main.py +47 -0
  79. pygodide-0.1.0/test_targets/async_hang/requirements.txt +1 -0
  80. pygodide-0.1.0/test_targets/async_hang/testing_manifest.yaml +12 -0
  81. pygodide-0.1.0/test_targets/audio_mixing/CREDITS.txt +13 -0
  82. pygodide-0.1.0/test_targets/audio_mixing/main.py +113 -0
  83. pygodide-0.1.0/test_targets/audio_mixing/requirements.txt +1 -0
  84. pygodide-0.1.0/test_targets/audio_mixing/sounds/KENNEY_LICENSE.txt +22 -0
  85. pygodide-0.1.0/test_targets/audio_mixing/sounds/bounce.ogg +0 -0
  86. pygodide-0.1.0/test_targets/audio_mixing/sounds/click.ogg +0 -0
  87. pygodide-0.1.0/test_targets/audio_mixing/sounds/confirm.ogg +0 -0
  88. pygodide-0.1.0/test_targets/audio_mixing/sounds/cropped-dirt-rhodes-by-kevin-macleod.mp3 +0 -0
  89. pygodide-0.1.0/test_targets/audio_mixing/testing_manifest.yaml +5 -0
  90. pygodide-0.1.0/test_targets/ball_bouncing/ball.py +59 -0
  91. pygodide-0.1.0/test_targets/ball_bouncing/main.py +56 -0
  92. pygodide-0.1.0/test_targets/ball_bouncing/requirements.txt +1 -0
  93. pygodide-0.1.0/test_targets/ball_bouncing/testing_manifest.yaml +5 -0
  94. pygodide-0.1.0/test_targets/not_async/ball.py +41 -0
  95. pygodide-0.1.0/test_targets/not_async/main.py +42 -0
  96. pygodide-0.1.0/test_targets/not_async/requirements.txt +1 -0
  97. pygodide-0.1.0/test_targets/not_async/testing_manifest.yaml +5 -0
  98. pygodide-0.1.0/test_targets/numpy_particles/main.py +287 -0
  99. pygodide-0.1.0/test_targets/numpy_particles/pyproject.toml +14 -0
  100. pygodide-0.1.0/test_targets/numpy_particles/testing_manifest.yaml +5 -0
  101. pygodide-0.1.0/test_targets/numpy_particles/uv.lock +217 -0
  102. pygodide-0.1.0/test_targets/perf_bench/benchmark.py +116 -0
  103. pygodide-0.1.0/test_targets/perf_bench/entities.py +163 -0
  104. pygodide-0.1.0/test_targets/perf_bench/main.py +128 -0
  105. pygodide-0.1.0/test_targets/perf_bench/requirements.txt +1 -0
  106. pygodide-0.1.0/test_targets/perf_bench/testing_manifest.yaml +5 -0
  107. pygodide-0.1.0/test_targets/save_slots/main.py +290 -0
  108. pygodide-0.1.0/test_targets/save_slots/requirements.txt +1 -0
  109. pygodide-0.1.0/test_targets/save_slots/testing_manifest.yaml +5 -0
  110. pygodide-0.1.0/test_targets/sync_event_pump/ball.py +41 -0
  111. pygodide-0.1.0/test_targets/sync_event_pump/main.py +37 -0
  112. pygodide-0.1.0/test_targets/sync_event_pump/requirements.txt +1 -0
  113. pygodide-0.1.0/test_targets/sync_event_pump/testing_manifest.yaml +5 -0
  114. pygodide-0.1.0/test_targets/sync_flip_loop/ball.py +41 -0
  115. pygodide-0.1.0/test_targets/sync_flip_loop/main.py +36 -0
  116. pygodide-0.1.0/test_targets/sync_flip_loop/requirements.txt +1 -0
  117. pygodide-0.1.0/test_targets/sync_flip_loop/testing_manifest.yaml +5 -0
  118. pygodide-0.1.0/test_targets/sync_helper_loop/ball.py +41 -0
  119. pygodide-0.1.0/test_targets/sync_helper_loop/main.py +40 -0
  120. pygodide-0.1.0/test_targets/sync_helper_loop/requirements.txt +1 -0
  121. pygodide-0.1.0/test_targets/sync_helper_loop/testing_manifest.yaml +5 -0
  122. pygodide-0.1.0/test_targets/sync_running_loop/ball.py +41 -0
  123. pygodide-0.1.0/test_targets/sync_running_loop/main.py +37 -0
  124. pygodide-0.1.0/test_targets/sync_running_loop/requirements.txt +1 -0
  125. pygodide-0.1.0/test_targets/sync_running_loop/testing_manifest.yaml +5 -0
  126. pygodide-0.1.0/test_targets/web_runtime/main.py +114 -0
  127. pygodide-0.1.0/test_targets/web_runtime/requirements.txt +1 -0
  128. pygodide-0.1.0/test_targets/web_runtime/testing_manifest.yaml +7 -0
  129. pygodide-0.1.0/tests/conftest.py +7 -0
  130. pygodide-0.1.0/tests/test_asyncify.py +302 -0
  131. pygodide-0.1.0/tests/test_auto_async_config.py +167 -0
  132. pygodide-0.1.0/tests/test_cli.py +1238 -0
  133. pygodide-0.1.0/tests/test_display_size.py +296 -0
  134. pygodide-0.1.0/tests/test_packaging.py +139 -0
  135. pygodide-0.1.0/tests/test_project_config.py +71 -0
  136. pygodide-0.1.0/tests/test_pyodide_resolution.py +139 -0
  137. pygodide-0.1.0/tests/test_smoke.py +416 -0
  138. pygodide-0.1.0/uv.lock +1207 -0
  139. pygodide-0.1.0/zensical.toml +70 -0
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Documentation
4
+ url: https://elan456.github.io/pygodide/
5
+ about: Setup guide for getting your Pygame app running in the browser
@@ -0,0 +1,46 @@
1
+ name: "My project didn't convert"
2
+ description: Something went wrong turning your Pygame project into a web app
3
+ labels:
4
+ - conversion-failure
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Sorry that it didn't work, but it'll be interesting to figure out why! Please fill out the fields below, so we can make pygodide better for everyone.
10
+
11
+ Two things make this easy for us to debug: a quick description of what happened, and your build log. That's it!
12
+
13
+ > **Tip:** After running `pygodide build`, your log is at `build/pygodide-build.log`. The CLI prints the path when the build finishes.
14
+
15
+ - type: textarea
16
+ id: what-happened
17
+ attributes:
18
+ label: What happened?
19
+ description: "In your own words: what did you try, and what did you see instead?"
20
+ placeholder: |
21
+ I ran `pygodide build . --serve` on my snake game. The build finished, but the browser stays on "Loading..." and never shows the game.
22
+ validations:
23
+ required: true
24
+
25
+ - type: textarea
26
+ id: build-log
27
+ attributes:
28
+ label: Build log
29
+ description: "Paste the full contents of `build/pygodide-build.log`. It has everything we need on our end (version, dependencies, errors)."
30
+ render: shell
31
+ validations:
32
+ required: true
33
+
34
+ - type: input
35
+ id: project-link
36
+ attributes:
37
+ label: Link to your project (optional)
38
+ description: A GitHub repo, gist, or zip link helps us reproduce the issue faster.
39
+ placeholder: "https://github.com/you/my-game"
40
+
41
+ - type: textarea
42
+ id: anything-else
43
+ attributes:
44
+ label: Anything else? (optional)
45
+ description: "Browser console errors (F12 → Console), screenshots, or a link to a smaller repro (only if you have them handy)."
46
+ placeholder: 'Firefox console says "micropip install failed for ..."'
@@ -0,0 +1,59 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+ workflow_call:
9
+
10
+ jobs:
11
+ checks:
12
+ name: Checks (Python ${{ matrix.python-version }})
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ python-version:
18
+ - "3.11"
19
+ - "3.12"
20
+ - "3.13"
21
+ - "3.14"
22
+
23
+ steps:
24
+ - name: Check out repository
25
+ uses: actions/checkout@v4
26
+
27
+ - name: Set up uv
28
+ uses: astral-sh/setup-uv@v6
29
+ with:
30
+ enable-cache: true
31
+
32
+ - name: Set up Python
33
+ uses: actions/setup-python@v5
34
+ with:
35
+ python-version: ${{ matrix.python-version }}
36
+
37
+ - name: Install dependencies
38
+ # dev group includes pygodide[smoke] (Playwright package). Unit tests do
39
+ # not launch browsers, so no "playwright install chromium" here.
40
+ run: uv sync --dev
41
+
42
+ - name: Check formatting
43
+ run: uv run ruff format --check .
44
+
45
+ - name: Lint
46
+ run: uv run ruff check .
47
+
48
+ - name: Run tests
49
+ run: uv run pytest
50
+
51
+ - name: Build distribution artifacts
52
+ run: uv build
53
+
54
+ - name: Smoke test installed CLI
55
+ run: |
56
+ python -m venv .wheel-smoke
57
+ .wheel-smoke/bin/pip install "$(echo dist/*.whl)[smoke]"
58
+ .wheel-smoke/bin/pygodide --help
59
+ .wheel-smoke/bin/python -c "import playwright; print('smoke extra ok')"
@@ -0,0 +1,34 @@
1
+ name: Docs
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+
7
+ permissions:
8
+ contents: read
9
+ pages: write
10
+ id-token: write
11
+
12
+ jobs:
13
+ deploy:
14
+ runs-on: ubuntu-latest
15
+ environment:
16
+ name: github-pages
17
+ url: ${{ steps.deployment.outputs.page_url }}
18
+ steps:
19
+ - uses: actions/configure-pages@v5
20
+ - uses: actions/checkout@v4
21
+ - uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.14"
24
+ - name: Install uv
25
+ uses: astral-sh/setup-uv@v7
26
+ with:
27
+ enable-cache: true
28
+ - run: uv sync --dev
29
+ - run: uv run zensical build --clean --strict
30
+ - uses: actions/upload-pages-artifact@v4
31
+ with:
32
+ path: site
33
+ - uses: actions/deploy-pages@v4
34
+ id: deployment
@@ -0,0 +1,73 @@
1
+ name: Publish
2
+
3
+ on:
4
+ release:
5
+ types:
6
+ - published
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ verify:
11
+ uses: ./.github/workflows/ci.yml
12
+
13
+ smoke:
14
+ name: Smoke tests
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: Check out repository
18
+ uses: actions/checkout@v4
19
+
20
+ - name: Set up uv
21
+ uses: astral-sh/setup-uv@v6
22
+ with:
23
+ enable-cache: true
24
+
25
+ - name: Set up Python
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ python-version: "3.14"
29
+
30
+ - name: Install dependencies
31
+ run: uv sync --dev
32
+
33
+ - name: Install Playwright browsers
34
+ run: uv run playwright install --with-deps chromium
35
+
36
+ - name: Run smoke target suite
37
+ run: uv run pygodide smoke test_targets --suite
38
+
39
+ publish:
40
+ name: Publish to PyPI
41
+ runs-on: ubuntu-latest
42
+ needs:
43
+ - verify
44
+ - smoke
45
+ permissions:
46
+ contents: read
47
+ id-token: write
48
+ environment:
49
+ name: pypi
50
+ url: https://pypi.org/p/pygodide
51
+
52
+ steps:
53
+ - name: Check out repository
54
+ uses: actions/checkout@v4
55
+
56
+ - name: Set up uv
57
+ uses: astral-sh/setup-uv@v6
58
+ with:
59
+ enable-cache: true
60
+
61
+ - name: Set up Python
62
+ uses: actions/setup-python@v5
63
+ with:
64
+ python-version: "3.14"
65
+
66
+ - name: Install dependencies
67
+ run: uv sync --dev
68
+
69
+ - name: Build distribution artifacts
70
+ run: uv build
71
+
72
+ - name: Publish distribution artifacts
73
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,232 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+ *.zip
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py.cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # UV
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi
127
+
128
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
129
+ __pypackages__/
130
+
131
+ # Celery stuff
132
+ celerybeat-schedule
133
+ celerybeat.pid
134
+
135
+ # Redis
136
+ *.rdb
137
+ *.aof
138
+ *.pid
139
+
140
+ # RabbitMQ
141
+ mnesia/
142
+ rabbitmq/
143
+ rabbitmq-data/
144
+
145
+ # ActiveMQ
146
+ activemq-data/
147
+
148
+ # SageMath parsed files
149
+ *.sage.py
150
+
151
+ # Environments
152
+ .env
153
+ .envrc
154
+ .venv
155
+ env/
156
+ venv/
157
+ ENV/
158
+ env.bak/
159
+ venv.bak/
160
+
161
+ # Spyder project settings
162
+ .spyderproject
163
+ .spyproject
164
+
165
+ # Rope project settings
166
+ .ropeproject
167
+
168
+ # mkdocs documentation
169
+ /site
170
+
171
+ # mypy
172
+ .mypy_cache/
173
+ .dmypy.json
174
+ dmypy.json
175
+
176
+ # Pyre type checker
177
+ .pyre/
178
+
179
+ # pytype static type analyzer
180
+ .pytype/
181
+
182
+ # Cython debug symbols
183
+ cython_debug/
184
+
185
+ # PyCharm
186
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
187
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
188
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
189
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
190
+ # .idea/
191
+
192
+ # Abstra
193
+ # Abstra is an AI-powered process automation framework.
194
+ # Ignore directories containing user credentials, local state, and settings.
195
+ # Learn more at https://abstra.io/docs
196
+ .abstra/
197
+
198
+ # Visual Studio Code
199
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
200
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
201
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
202
+ # you could uncomment the following to ignore the entire vscode folder
203
+ # .vscode/
204
+ # Temporary file for partial code execution
205
+ tempCodeRunnerFile.py
206
+
207
+ # Ruff stuff:
208
+ .ruff_cache/
209
+
210
+ # PyPI configuration file
211
+ .pypirc
212
+
213
+ # Marimo
214
+ marimo/_static/
215
+ marimo/_lsp/
216
+ __marimo__/
217
+
218
+ # Streamlit
219
+ .streamlit/secrets.toml
220
+
221
+ # AI stuff:
222
+ .codex/
223
+ .agents/
224
+ .hermes/
225
+
226
+ # Temp / Swap Files
227
+ ~*
228
+ # Benchmark local worktrees
229
+ benchmarks/.work/
230
+ benchmarks/.venv/
231
+ benchmarks/output/
232
+ benchmarks/results/
@@ -0,0 +1,24 @@
1
+ default_install_hook_types:
2
+ - pre-commit
3
+ - pre-push
4
+
5
+ repos:
6
+ - repo: local
7
+ hooks:
8
+ - id: ruff-format
9
+ name: ruff format
10
+ entry: uv run ruff format .
11
+ language: system
12
+ pass_filenames: false
13
+ - id: ruff-check
14
+ name: ruff check
15
+ entry: uv run ruff check . --fix
16
+ language: system
17
+ pass_filenames: false
18
+ - id: pytest
19
+ name: pytest
20
+ entry: uv run pytest
21
+ language: system
22
+ pass_filenames: false
23
+ stages:
24
+ - pre-push
@@ -0,0 +1,177 @@
1
+ # AGENTS.md
2
+
3
+ The contents of this file are for human contributors as well as the AI tools
4
+ leveraged by those human contributors for working on this project.
5
+
6
+ This file is mostly handwritten and should act as the north star for
7
+ guiding the project.
8
+
9
+ ## Project
10
+
11
+ For an overview of the project, read the `README.md` and the `docs/index.md`.
12
+
13
+ The goal of the project is to create a dead-simple tool for beginner Python
14
+ developers to publish their games easily, while also exposing options for more
15
+ experienced developers to tailor the tool to their needs.
16
+
17
+ ## AI-Rules
18
+
19
+ - Always acknowledge that you have read this file with "I've read the AGENTS.md"
20
+ at the start of any chat or task involving the project.
21
+ - Never edit this file (AGENTS.md) even if told to do so explicitly.
22
+ - Exception: Running a grammar pass (don't change any semantics)
23
+ - Never use any `git` commands.
24
+ - `git log` and `git diff` are okay
25
+ - If you want to make temp output files or reports, name them with a leading "~" so they get ignored by git automatically. For example: ~analysis_report.md.
26
+ - The top-level README.md is sacred and needs a strong human touch. Be very careful adding AI-generated prose, and make the user very aware.
27
+ - Don't use weird characters that aren't on a keyboard. They look stupid and are hard to work with. (e.g. ·)
28
+
29
+ ### Backwards-Compatibility
30
+
31
+ The project follows [semver](https://semver.org/) versioning rules, but those
32
+ rules only apply to the user-facing CLI. In practice, this means that every
33
+ minor and patch release must not introduce breaking changes to the user-facing
34
+ CLI, but can change anything around the internal interfaces.
35
+
36
+ ### User-facing CLI
37
+
38
+ | Command | Role |
39
+ | --- | --- |
40
+ | `pygodide build` | Bundle a project into a webapp, resolve deps, optional auto-async, render `index.html` / `boot.js` |
41
+ | `pygodide serve` | Serve a built app |
42
+ | `pygodide smoke` | Build (and optionally browser-test) an app or suite of apps |
43
+
44
+ Typer definitions in `pygodide/cli/main.py` are the source of truth for CLI help
45
+ and the docs site CLI reference (`mkdocs-typer2` + Zensical).
46
+
47
+ ## Layout
48
+
49
+ ```text
50
+ pygodide/
51
+ cli/ # Typer surface (main.py) + runners (runners.py)
52
+ builder/ # plan, pipeline, zip, display_size (not named "build": that is the output dir)
53
+ asyncify/ # AST transform of simple sync Pygame loops
54
+ smoke/ # manifests, suite, Playwright
55
+ dep_handling/ # collect requirements + Pyodide/micropip install plan
56
+ logs.py # shared build/smoke log files (not under builder)
57
+ rendering.py # Jinja → index.html / boot.js
58
+ serving.py # HTTP serve (CLI forever + ephemeral smoke server)
59
+ project_config.py / pyproject.py
60
+ templates/
61
+ tests/ # unit tests
62
+ test_targets/ # fixture apps + testing_manifest.yaml (see test_targets/README.md)
63
+ docs/ # Zensical site
64
+ benchmarks/ # cross-runtime FPS harness (not part of the CLI)
65
+ ```
66
+
67
+ ### Code style
68
+
69
+ - Target Python 3.11+. Ruff for format and lint (`uv run ruff format`, `uv run ruff check`).
70
+ - Prefer small modules with one clear job over mega-files.
71
+ - Frozen dataclasses for config/plan types.
72
+ - Typer options stay in `cli/main.py`; side effects live in `cli/runners.py`.
73
+
74
+ ### Docs and prose
75
+
76
+ - Docs site: Zensical (`zensical.toml`, `docs/`). CLI reference is generated from
77
+ Typer via `mkdocs-typer2`.
78
+ - After CLI help/`short_help` changes that affect generated docs, rebuild with
79
+ `uv run zensical build --clean` when verifying the site (Zensical can cache
80
+ pages that do not change on disk).
81
+ - Prefer normal ASCII punctuation in repo prose.
82
+ - Don't overuse **bold** and *italics*.
83
+ - Keep contributor-facing docs close to the code they describe (e.g.
84
+ `test_targets/README.md` for the fixture suite).
85
+ - Do not use the word "staged" (or "staging") for files copied into the build.
86
+ It is easily confused with git staging. Prefer "copied into the build",
87
+ "packaged", or "included in the build" in docs, comments, logs, and errors.
88
+ - Prefer short, plain language. Say what is happening and what to do next; avoid jargon, log-style prefixes, and
89
+ parenthetical asides when a clearer main sentence works.
90
+
91
+ ### Debuggability
92
+
93
+ Many novice developers will be using this tool. It is extremely important that
94
+ pygodide prioritizes easy-to-read error messages, obvious failure modes, and
95
+ clear warnings. The pygodide window should never just crash or freeze; it should
96
+ always give a helpful error message that is shown clearly on the webpage.
97
+ Anything that makes pygodide easier to use, or easier to figure out why an app
98
+ won't start on the web, should be prioritized.
99
+
100
+ ### Dependencies
101
+
102
+ - Runtime deps: `[project].dependencies`.
103
+ - Browser smoke optional extra: `[project.optional-dependencies].smoke`
104
+ (Playwright). Version is pinned there once.
105
+ - Dev group includes `pygodide[smoke]` so `uv sync --dev` gets the same
106
+ Playwright pin. Do not duplicate the Playwright version string in `dev`.
107
+ - End users: `pip install 'pygodide[smoke]'` then `playwright install chromium`.
108
+ - Unit tests should not require a Chromium install; real browser smoke does.
109
+
110
+ ## Workflows
111
+
112
+ ### Dev setup
113
+
114
+ ```bash
115
+ uv sync --dev
116
+ uv run playwright install chromium # only if running real smoke / benchmarks
117
+ ```
118
+
119
+ ### Checks (same spirit as CI)
120
+
121
+ ```bash
122
+ uv run ruff format --check .
123
+ uv run ruff check .
124
+ uv run pytest
125
+ ```
126
+
127
+ ### Smoke
128
+
129
+ - One project: `uv run pygodide smoke path/to/app`
130
+ - Fixture suite: `uv run pygodide smoke test_targets --suite`
131
+ - `--build-only`: suite/pipeline without Playwright (still applies manifests,
132
+ cleans, builds, smoke logs). Not a synonym for bare `pygodide build` on each
133
+ folder; manifests can override app/deps/auto-async.
134
+ - Fixture schema and how to add targets: `test_targets/README.md`.
135
+
136
+ ### Auto-async
137
+
138
+ Build-time AST rewrite for simple sync game loops (yield with
139
+ `await asyncio.sleep(1 / (fps * 2))`). Prefer improving detection/transform
140
+ carefully; unsafe transforms should skip with a clear message pointing at manual
141
+ async guidance.
142
+
143
+ ### Writing a test_target
144
+
145
+ - Use an FPS of 120 to ensure it feels smooth.
146
+ - Write at the edge of pygodide's support so the fixtures act as good regression
147
+ tests.
148
+ - Keep the code simple and easy to follow so users can read them as examples.
149
+ - Avoid writing for pygodide; write primarily for the local case to imitate what
150
+ most real-world target Python projects will look like. Pygodide should bend to
151
+ the project, not the other way around.
152
+
153
+ ## What "done" looks like
154
+
155
+ - Behavior matches the product goals (build/serve/smoke stay reliable).
156
+ - Names and messages stay clear to game authors, not only to us.
157
+ - Docs/README/`test_targets` guidance updated when contributors need to know
158
+ about behavior changes.
159
+
160
+ ## Release Notes
161
+
162
+ - When asked to generate release notes, look at all of the code changes between the current head and the last tagged commit.
163
+ - Write a concise bulleted list of changes.
164
+ - Any breaking changes to the user CLI or how configuration files (e.g. the user's pyproject.toml file) will be interpreted should be put in a "Breaking Changes" section at the top.
165
+
166
+ Example Release Notes:
167
+
168
+ 0.1.2
169
+
170
+ - Detect hung games that never yield and show fix guidance on the page
171
+ - Re-show hang help after ready if yielding stops (soft stalls)
172
+ - Smarter auto canvas size (prefer playable set_mode, ignore tiny/NOFRAME dummies)
173
+ - Make crash error panels scrollable and selectable
174
+ - Use Hack font for the loader by default
175
+ - Stop nesting previous zip builds into the next zip
176
+ - Smoke support for expected hang warnings (async_hang fixture)
177
+ - Docs and dependency bumps
pygodide-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ethan Anderson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.