sonolus.py 0.1.3__py3-none-any.whl → 0.1.5__py3-none-any.whl

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.

Potentially problematic release.


This version of sonolus.py might be problematic. Click here for more details.

Files changed (90) hide show
  1. sonolus/backend/blocks.py +756 -756
  2. sonolus/backend/excepthook.py +37 -37
  3. sonolus/backend/finalize.py +77 -69
  4. sonolus/backend/interpret.py +7 -7
  5. sonolus/backend/ir.py +29 -3
  6. sonolus/backend/mode.py +24 -24
  7. sonolus/backend/node.py +40 -40
  8. sonolus/backend/ops.py +197 -197
  9. sonolus/backend/optimize/__init__.py +0 -0
  10. sonolus/backend/optimize/allocate.py +126 -0
  11. sonolus/backend/optimize/constant_evaluation.py +374 -0
  12. sonolus/backend/optimize/copy_coalesce.py +85 -0
  13. sonolus/backend/optimize/dead_code.py +185 -0
  14. sonolus/backend/optimize/dominance.py +96 -0
  15. sonolus/backend/{flow.py → optimize/flow.py} +122 -92
  16. sonolus/backend/optimize/inlining.py +137 -0
  17. sonolus/backend/optimize/liveness.py +177 -0
  18. sonolus/backend/optimize/optimize.py +44 -0
  19. sonolus/backend/optimize/passes.py +52 -0
  20. sonolus/backend/optimize/simplify.py +191 -0
  21. sonolus/backend/optimize/ssa.py +200 -0
  22. sonolus/backend/place.py +17 -25
  23. sonolus/backend/utils.py +58 -48
  24. sonolus/backend/visitor.py +1151 -882
  25. sonolus/build/cli.py +7 -1
  26. sonolus/build/compile.py +88 -90
  27. sonolus/build/engine.py +10 -5
  28. sonolus/build/level.py +24 -23
  29. sonolus/build/node.py +43 -43
  30. sonolus/script/archetype.py +438 -139
  31. sonolus/script/array.py +27 -10
  32. sonolus/script/array_like.py +297 -0
  33. sonolus/script/bucket.py +253 -191
  34. sonolus/script/containers.py +257 -51
  35. sonolus/script/debug.py +26 -10
  36. sonolus/script/easing.py +365 -0
  37. sonolus/script/effect.py +191 -131
  38. sonolus/script/engine.py +71 -4
  39. sonolus/script/globals.py +303 -269
  40. sonolus/script/instruction.py +205 -151
  41. sonolus/script/internal/__init__.py +5 -5
  42. sonolus/script/internal/builtin_impls.py +255 -144
  43. sonolus/script/{callbacks.py → internal/callbacks.py} +127 -127
  44. sonolus/script/internal/constant.py +139 -0
  45. sonolus/script/internal/context.py +26 -9
  46. sonolus/script/internal/descriptor.py +17 -17
  47. sonolus/script/internal/dict_impl.py +65 -0
  48. sonolus/script/internal/generic.py +6 -9
  49. sonolus/script/internal/impl.py +38 -13
  50. sonolus/script/internal/introspection.py +17 -14
  51. sonolus/script/internal/math_impls.py +121 -0
  52. sonolus/script/internal/native.py +40 -38
  53. sonolus/script/internal/random.py +67 -0
  54. sonolus/script/internal/range.py +81 -0
  55. sonolus/script/internal/transient.py +51 -0
  56. sonolus/script/internal/tuple_impl.py +113 -0
  57. sonolus/script/internal/value.py +3 -3
  58. sonolus/script/interval.py +338 -112
  59. sonolus/script/iterator.py +167 -214
  60. sonolus/script/level.py +24 -0
  61. sonolus/script/num.py +80 -48
  62. sonolus/script/options.py +257 -191
  63. sonolus/script/particle.py +190 -157
  64. sonolus/script/pointer.py +30 -30
  65. sonolus/script/print.py +102 -81
  66. sonolus/script/project.py +8 -0
  67. sonolus/script/quad.py +263 -0
  68. sonolus/script/record.py +47 -16
  69. sonolus/script/runtime.py +52 -1
  70. sonolus/script/sprite.py +418 -333
  71. sonolus/script/text.py +409 -407
  72. sonolus/script/timing.py +114 -42
  73. sonolus/script/transform.py +332 -48
  74. sonolus/script/ui.py +216 -160
  75. sonolus/script/values.py +6 -13
  76. sonolus/script/vec.py +196 -78
  77. {sonolus_py-0.1.3.dist-info → sonolus_py-0.1.5.dist-info}/METADATA +1 -1
  78. sonolus_py-0.1.5.dist-info/RECORD +89 -0
  79. {sonolus_py-0.1.3.dist-info → sonolus_py-0.1.5.dist-info}/WHEEL +1 -1
  80. {sonolus_py-0.1.3.dist-info → sonolus_py-0.1.5.dist-info}/licenses/LICENSE +21 -21
  81. sonolus/backend/allocate.py +0 -51
  82. sonolus/backend/optimize.py +0 -9
  83. sonolus/backend/passes.py +0 -6
  84. sonolus/backend/simplify.py +0 -30
  85. sonolus/script/comptime.py +0 -160
  86. sonolus/script/graphics.py +0 -150
  87. sonolus/script/math.py +0 -92
  88. sonolus/script/range.py +0 -58
  89. sonolus_py-0.1.3.dist-info/RECORD +0 -75
  90. {sonolus_py-0.1.3.dist-info → sonolus_py-0.1.5.dist-info}/entry_points.txt +0 -0
sonolus/script/engine.py CHANGED
@@ -4,7 +4,7 @@ from collections.abc import Callable
4
4
  from typing import Any
5
5
 
6
6
  from sonolus.build.collection import Asset
7
- from sonolus.script.archetype import BaseArchetype, PlayArchetype, PreviewArchetype, WatchArchetype
7
+ from sonolus.script.archetype import PlayArchetype, PreviewArchetype, WatchArchetype, _BaseArchetype
8
8
  from sonolus.script.bucket import Buckets, EmptyBuckets
9
9
  from sonolus.script.effect import Effects, EmptyEffects
10
10
  from sonolus.script.instruction import (
@@ -20,6 +20,21 @@ from sonolus.script.ui import UiConfig
20
20
 
21
21
 
22
22
  class Engine:
23
+ """A Sonolus.py engine.
24
+
25
+ Args:
26
+ name: The name of the engine.
27
+ title: The title of the engine.
28
+ subtitle: The subtitle of the engine.
29
+ author: The author of the engine.
30
+ skin: The default skin for the engine.
31
+ background: The default background for the engine.
32
+ effect: The default effect for the engine.
33
+ particle: The default particle for the engine.
34
+ thumbnail: The thumbnail for the engine.
35
+ data: The engine's modes and configurations.
36
+ """
37
+
23
38
  version = 12
24
39
 
25
40
  def __init__(
@@ -53,10 +68,20 @@ def default_callback() -> Any:
53
68
 
54
69
 
55
70
  class PlayMode:
71
+ """A play mode definition.
72
+
73
+ Args:
74
+ archetypes: A list of play archetypes.
75
+ skin: The skin for the play mode.
76
+ effects: The effects for the play mode.
77
+ particles: The particles for the play mode.
78
+ buckets: The buckets for the play mode.
79
+ """
80
+
56
81
  def __init__(
57
82
  self,
58
83
  *,
59
- archetypes: list[type[BaseArchetype]] | None = None,
84
+ archetypes: list[type[_BaseArchetype]] | None = None,
60
85
  skin: Skin = EmptySkin,
61
86
  effects: Effects = EmptyEffects,
62
87
  particles: Particles = EmptyParticles,
@@ -74,10 +99,21 @@ class PlayMode:
74
99
 
75
100
 
76
101
  class WatchMode:
102
+ """A watch mode definition.
103
+
104
+ Args:
105
+ archetypes: A list of watch archetypes.
106
+ skin: The skin for the watch mode.
107
+ effects: The effects for the watch mode.
108
+ particles: The particles for the watch mode.
109
+ buckets: The buckets for the watch mode.
110
+ update_spawn: A callback returning the spawn time used by archetypes.
111
+ """
112
+
77
113
  def __init__(
78
114
  self,
79
115
  *,
80
- archetypes: list[type[BaseArchetype]] | None = None,
116
+ archetypes: list[type[_BaseArchetype]] | None = None,
81
117
  skin: Skin = EmptySkin,
82
118
  effects: Effects = EmptyEffects,
83
119
  particles: Particles = EmptyParticles,
@@ -97,10 +133,17 @@ class WatchMode:
97
133
 
98
134
 
99
135
  class PreviewMode:
136
+ """A preview mode definition.
137
+
138
+ Args:
139
+ archetypes: A list of preview archetypes.
140
+ skin: The skin for the preview mode.
141
+ """
142
+
100
143
  def __init__(
101
144
  self,
102
145
  *,
103
- archetypes: list[type[BaseArchetype]] | None = None,
146
+ archetypes: list[type[_BaseArchetype]] | None = None,
104
147
  skin: Skin = EmptySkin,
105
148
  ) -> None:
106
149
  self.archetypes = archetypes or []
@@ -112,6 +155,19 @@ class PreviewMode:
112
155
 
113
156
 
114
157
  class TutorialMode:
158
+ """A tutorial mode definition.
159
+
160
+ Args:
161
+ skin: The skin for the tutorial mode.
162
+ effects: The effects for the tutorial mode.
163
+ particles: The particles for the tutorial mode.
164
+ instructions: The instructions for the tutorial mode.
165
+ instruction_icons: The instruction icons for the tutorial mode.
166
+ preprocess: A callback to be called before the tutorial starts.
167
+ navigate: A callback to be called when the user navigates.
168
+ update: A callback to be called each frame.
169
+ """
170
+
115
171
  def __init__(
116
172
  self,
117
173
  *,
@@ -135,6 +191,17 @@ class TutorialMode:
135
191
 
136
192
 
137
193
  class EngineData:
194
+ """A Sonolus.py engine's modes and configurations.
195
+
196
+ Args:
197
+ ui: The UI configuration.
198
+ options: The options for the engine.
199
+ play: The play mode configuration.
200
+ watch: The watch mode configuration.
201
+ preview: The preview mode configuration.
202
+ tutorial: The tutorial mode configuration.
203
+ """
204
+
138
205
  def __init__(
139
206
  self,
140
207
  *,