Skip to content

Commit f7ed44d

Browse files
committed
Ship micropython as a typed package, drop micropython-stubs
circuitpython-stubs also installs micropython-stubs/__init__.pyi, so the two wheels fought over the same file (adafruit/circuitpython#11221). Move micropython.py into a package with inline annotations and py.typed; the stubs still take precedence when both are installed.
1 parent 37a4ff5 commit f7ed44d

5 files changed

Lines changed: 14 additions & 33 deletions

File tree

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
python_requires=">=3.9.0",
8080
url="https://github.com/adafruit/Adafruit_Blinka",
8181
package_dir={"": "src"},
82-
packages=find_packages("src") + ["micropython-stubs"],
82+
packages=find_packages("src"),
8383
# py_modules lists top-level single file packages to include.
8484
# find_packages only finds packages in directories with __init__.py files.
8585
py_modules=[
@@ -89,7 +89,6 @@
8989
"busio",
9090
"digitalio",
9191
"keypad",
92-
"micropython",
9392
"neopixel_write",
9493
"onewireio",
9594
"pulseio",
@@ -109,7 +108,7 @@
109108
"adafruit_blinka.microcontroller.amlogic.meson_g12_common.pulseio": [
110109
"libgpiod_pulsein",
111110
],
112-
"micropython-stubs": ["*.pyi"],
111+
"micropython": ["py.typed"],
113112
},
114113
include_package_data=True,
115114
install_requires=[

src/micropython.py

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,27 @@
88
* Author(s): cefn
99
"""
1010

11-
from typing import Callable, TypeVar, Any, NoReturn
11+
from typing import Any, Callable, NoReturn, TypeVar
1212

1313
Fun = TypeVar("Fun", bound=Callable[..., Any])
1414
T = TypeVar("T")
1515

16+
1617
def const(x: T) -> T:
1718
"Emulate making a constant"
19+
return x
20+
1821

1922
def native(f: Fun) -> Fun:
2023
"Emulate making a native"
24+
return f
25+
2126

2227
def viper(f: Fun) -> NoReturn:
2328
"User is attempting to use a viper code emitter"
29+
raise SyntaxError("invalid micropython decorator")
30+
2431

2532
def asm_thumb(f: Fun) -> NoReturn:
2633
"User is attempting to use an inline assembler"
34+
raise SyntaxError("invalid micropython decorator")

src/micropython/py.typed

Whitespace-only changes.

src/micropython/py.typed.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT

0 commit comments

Comments
 (0)