mini-arcade-core 0.4.0__py3-none-any.whl → 0.5.2__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.
@@ -5,11 +5,16 @@ Provides access to core classes and a convenience function to run a game.
5
5
 
6
6
  from __future__ import annotations
7
7
 
8
+ import logging
9
+ from importlib.metadata import PackageNotFoundError, version
10
+
8
11
  from .backend import Backend, Event, EventType
9
12
  from .entity import Entity, SpriteEntity
10
13
  from .game import Game, GameConfig
11
14
  from .scene import Scene
12
15
 
16
+ logger = logging.getLogger(__name__)
17
+
13
18
 
14
19
  def run_game(initial_scene_cls: type[Scene], config: GameConfig | None = None):
15
20
  """
@@ -34,3 +39,38 @@ __all__ = [
34
39
  "Event",
35
40
  "EventType",
36
41
  ]
42
+
43
+ PACKAGE_NAME = "mini-arcade-core" # or whatever is in your pyproject.toml
44
+
45
+
46
+ def get_version() -> str:
47
+ """
48
+ Return the installed package version.
49
+
50
+ This is a thin helper around importlib.metadata.version so games can do:
51
+
52
+ from mini_arcade_core import get_version
53
+ print(get_version())
54
+
55
+ :return: The version string of the installed package.
56
+ :rtype: str
57
+
58
+ :raises PackageNotFoundError: If the package is not installed.
59
+ """
60
+ try:
61
+ return version(PACKAGE_NAME)
62
+ except PackageNotFoundError: # if running from source / editable
63
+ logger.warning(
64
+ f"Package '{PACKAGE_NAME}' not found. Returning default version '0.0.0'."
65
+ )
66
+ return "0.0.0"
67
+
68
+
69
+ try:
70
+ __version__ = get_version()
71
+ # Justification: We want to ensure that any exception during version retrieval
72
+ # results in a default version being set, rather than crashing the import.
73
+ # pylint: disable=broad-exception-caught
74
+ except Exception:
75
+ __version__ = "0.0.0"
76
+ # pylint: enable=broad-exception-caught
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mini-arcade-core
3
- Version: 0.4.0
3
+ Version: 0.5.2
4
4
  Summary: Tiny scene-based game loop core for small arcade games.
5
5
  License: Copyright (c) 2025 Santiago Rincón
6
6
 
@@ -1,9 +1,9 @@
1
- mini_arcade_core/__init__.py,sha256=c66IkzZjiyUbTtjQRyf4XyiH6xPS79Ajxeb1OvnVPZA,887
1
+ mini_arcade_core/__init__.py,sha256=xlePCq6tvPfIgHlhQ-WtESvEyX2sjkgu_aann-1QsZk,2041
2
2
  mini_arcade_core/backend.py,sha256=6_3-ni0EQJXfaSReavcrOeUOCNkdrjGctFn5q0D9nrw,1847
3
3
  mini_arcade_core/entity.py,sha256=mAkedH0j14giBQFRpQjaym46uczbQDln6nbxy0WFAqU,1077
4
4
  mini_arcade_core/game.py,sha256=OkQIFkFLqFailZDPY1fAq6Tyi7IQ9EKxloW1UgDaHko,2123
5
5
  mini_arcade_core/scene.py,sha256=FEtywrnOBU8p0-t8oWGDELYBRRXOs4-Phe0dF7iSjKI,927
6
- mini_arcade_core-0.4.0.dist-info/METADATA,sha256=-xzwRN08pD-G9PgpCH_Ld-KxFRNlRWC9bGtb-fA_lv8,8296
7
- mini_arcade_core-0.4.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
8
- mini_arcade_core-0.4.0.dist-info/licenses/LICENSE,sha256=3lHAuV0584cVS5vAqi2uC6GcsVgxUijvwvtZckyvaZ4,1096
9
- mini_arcade_core-0.4.0.dist-info/RECORD,,
6
+ mini_arcade_core-0.5.2.dist-info/METADATA,sha256=5ogfRfSrJtRHRqnSAGo2ZSNQWDMal3USAFZ3rCeJGtY,8296
7
+ mini_arcade_core-0.5.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
8
+ mini_arcade_core-0.5.2.dist-info/licenses/LICENSE,sha256=3lHAuV0584cVS5vAqi2uC6GcsVgxUijvwvtZckyvaZ4,1096
9
+ mini_arcade_core-0.5.2.dist-info/RECORD,,