FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Cleanup by jolaf · Pull Request #3 · pyscript/pyscript-stubs · GitHub

Cleanup - #3

Open
jolaf wants to merge 15 commits into
pyscript:mainfrom
jolaf:cleanup
Open

Cleanup#3
jolaf wants to merge 15 commits into
pyscript:mainfrom
jolaf:cleanup

Conversation

jolaf commented Jan 5, 2026

Copy link
Copy Markdown

I'm writing a PyScript app, and I see a lot of situations where the stubs are incorrect and incomplete.
After struggling for some I've decided to do something with it and updated the stubs so that they've become effective for my projects.
They're still incomplete but less incomplete than before.

Josverl commented Jan 6, 2026

Copy link
Copy Markdown

Hi @jolaf ,

Thanks for the contributions,

To help with the review can you specify which version and runtime of pyscript you have based and verified your changes on?

I also have an update stewing, and I want to prevent that undoing parts of your work

jolaf commented Jan 6, 2026

Copy link
Copy Markdown
Author

I'm working with PyScript 2025.11.2.
And typechecking statically with mypy 1.19.1 and in runtime with beartype 0.22.9.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

stub-only packaged should not contain a py.typed marker file.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

the _typeshed.pyi stub is already available in all typecheckers and should not be overwritten from this package.
doing that will likely disrupt all static typecheckers and IDE;s

ref : https://github.com/python/typeshed/blob/main/stdlib/_typeshed/__init__.pyi

# Copyright (c) 2020-2025 Jos Verlinde
# MIT Licensed

__all__ = [

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

what is the purpose of removing __all__ ?

removing it will expose module attributes that are not public , or not actually available at runtime.
I know it is a bit of a hassle to add to it , but that is part of the price to pay for stability and reliability,

@@ -0,0 +1,14 @@
from __future__ import annotations

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

l suggest to to add a docstring here that this submodule is (AFAIK) only available python/pyodide and not to MicroPython

(currently it is not yet possible for typecheckers / IDEs to filet on this , so we need to communicate this in a human readable manner.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

the should not be any py.typed in stub only packages.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

no py.typed

"""

def __init__(self, name, error) -> None: ...
def __init__(self, name: str, error: BaseException) -> None: ...

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Is there a special reason you need BaseExeption rather than the normal Exception ?

from js import Event as JsEvent, FileList

from .events import Event
from ._typeshed import Incomplete

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

why not just _typeshed ?
._typeshed is not needed, unclear and risky

Josverl left a comment
edited
Loading

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think there are a large number of very good improvements.
I have made a number of comments on things that I think should be changes , and question on the changes that I did not understand the pupose of.

To keep track of version specific changes - it may be useful to add a #version_comment

I did not do a full verification test - but I will likely need to update that test to the updated interfaces as well.

See: https://github.com/Josverl/micropython-stubs/tree/main/tests/quality_tests/check_webassembly

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL