scirodev 0.5.5__tar.gz → 0.5.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scirodev
3
- Version: 0.5.5
3
+ Version: 0.5.6
4
4
  Summary: PeakHub / sciro extensions to Pybricks: typed API stubs (sciro.*) and hub tooling on top of pybricksdev
5
5
  Author: Thomas Schank
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "scirodev"
7
- version = "0.5.5"
7
+ version = "0.5.6"
8
8
  description = "PeakHub / sciro extensions to Pybricks: typed API stubs (sciro.*) and hub tooling on top of pybricksdev"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,7 +1,8 @@
1
1
  """sciro.hubs -- the PeakHub.
2
2
 
3
3
  On the hub this module re-exports ``pybricks.hubs`` unchanged; the stub adds what
4
- the upstream stubs lack: the ``PeakHub`` class and its ``display.device()``.
4
+ the upstream stubs lack: the ``PeakHub`` class, its ``display.device()``, and the
5
+ ``ThisHub`` alias.
5
6
  """
6
7
 
7
8
  from __future__ import annotations
@@ -150,3 +151,32 @@ class PeakHub:
150
151
  broadcast_channel: Channel for broadcasting data (0 .. 255).
151
152
  observe_channels: Channels to observe.
152
153
  """
154
+
155
+
156
+ #: The hub this program is running on.
157
+ #:
158
+ #: Every Pybricks firmware compiles in exactly one hub class and exports it
159
+ #: under several names: the generic ``ThisHub``, the hub's own name, and any
160
+ #: aliases. On PeakHub firmware ``ThisHub``, :class:`PeakHub`, ``PrimeHub`` and
161
+ #: ``InventorHub`` are therefore all the *same* class object -- this is resolved
162
+ #: when the firmware is built, not by detecting anything at run time.
163
+ #:
164
+ #: Use it for code that should run unchanged on whichever hub is in front of
165
+ #: you, which is mostly bench and test scripts::
166
+ #:
167
+ #: from sciro.hubs import ThisHub
168
+ #:
169
+ #: hub = ThisHub()
170
+ #: print(hub.imu.heading(), hub.imu.tilt())
171
+ #:
172
+ #: Prefer :class:`PeakHub` when a program is specific to this hub anyway: it
173
+ #: says so, and it reads better than a generic name.
174
+ #:
175
+ #: Note the difference between the REPL and a downloaded program. The REPL is
176
+ #: started with everything auto-imported and with a ready-made ``hub`` instance
177
+ #: already created, so there ``hub.imu.heading()`` just works. A downloaded
178
+ #: program gets neither: it must import what it uses and construct the hub, as
179
+ #: above, and ``print(hub)`` there raises ``NameError``. (In the firmware this
180
+ #: is ``pb_package_pybricks_init(true)`` for the REPL versus ``false`` for
181
+ #: everything else.)
182
+ ThisHub = PeakHub
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scirodev
3
- Version: 0.5.5
3
+ Version: 0.5.6
4
4
  Summary: PeakHub / sciro extensions to Pybricks: typed API stubs (sciro.*) and hub tooling on top of pybricksdev
5
5
  Author: Thomas Schank
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes