@@ -36,9 +36,25 @@ def generate_stubs_cmd(pico_name: Annotated[str, typer.Argument(help="Pico name
3636 (stubs_folder / file ).unlink (True )
3737
3838
39+ # This package deliberately ships no runtime dependencies. The one it would
40+ # want, micropython-rp2-stubs, exists only on PyPI -- it is on no anaconda.org
41+ # channel, and neither is its own dependency micropython-stdlib-stubs -- so
42+ # declaring it would leave the conda package unsolvable. The isinstance(str)
43+ # filter below drops `dependencies` anyway; this note is here so that stays a
44+ # decision rather than an accident. Users who want stubs for the MicroPython
45+ # builtins install them separately, as the README below explains.
3946 (stubs_folder / "README.md" ).write_text (
40- "Stubs for " +
41- (PROJECT_ROOT / 'README.md' ).read_text (encoding = 'utf-8' )
47+ "Stubs for "
48+ + (PROJECT_ROOT / 'README.md' ).read_text (encoding = 'utf-8' )
49+ + "\n \n ## MicroPython builtins\n \n "
50+ "These stubs cover ALPACA itself. For `machine`, `rp2` and the rest of\n "
51+ "the MicroPython standard library, install those stubs alongside:\n \n "
52+ "```bash\n "
53+ "pip install micropython-rp2-stubs\n "
54+ "```\n \n "
55+ "They are not published on any conda channel, so they are not declared\n "
56+ "as a dependency here. Without them only the MicroPython builtins stay\n "
57+ "unresolved in your editor; the ALPACA stubs themselves work either way.\n "
4258 )
4359
4460 parent = toml .load (PROJECT_ROOT / "pyproject.toml" )
@@ -60,6 +76,19 @@ def generate_stubs_cmd(pico_name: Annotated[str, typer.Argument(help="Pico name
6076 "setuptools" : {
6177 "packages" : packages ,
6278 "package-data" : dict .fromkeys (packages , ["*.pyi" ])
79+ },
80+ # Read by PlohnenSoftware/PyPI-Anaconda-Publish, which renders the conda
81+ # recipe from this file so the conda package cannot drift from the PyPI one.
82+ "conda-recipe" : {
83+ # Only .pyi files, so a single noarch build serves every architecture
84+ # and every Python the inherited requires-python allows.
85+ "noarch" : True ,
86+ "build-channels" : ["conda-forge" ],
87+ "maintainers" : ["NB-TUDelft" ],
88+ # Deliberately empty. A PEP 561 stub-only distribution ships no runtime
89+ # module, so importing these packages is *meant* to fail -- listing them
90+ # here would fail the conda test phase.
91+ "test-imports" : []
6392 }
6493 }
6594 }, (stubs_folder / "pyproject.toml" ).open ("w+" ))
0 commit comments