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

Add typing in Python code by peasoft · Pull Request #660 · msgpack/msgpack-python · GitHub

Add typing in Python code - #660

Open
peasoft wants to merge 4 commits into
msgpack:mainfrom
peasoft:main
Open

Add typing in Python code#660
peasoft wants to merge 4 commits into
msgpack:mainfrom
peasoft:main

Conversation

peasoft commented Jan 2, 2026
edited
Loading

Copy link
Copy Markdown

Add Python 3.10-style typing for msgpack-python.

Compared to sbdchd/msgpack-types and #404, this PR added typing for all Python codes.

Closes #448

peasoft changed the title Add type stub Add typing in Python code Jan 4, 2026
Comment thread msgpack/ext.py
__slots__ = ["seconds", "nanoseconds"]

def __init__(self, seconds, nanoseconds=0):
def __init__(self, seconds: int, nanoseconds=0):

Copy link
Copy Markdown
Contributor

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

Shouldn't this also have typing for nanoseconds? Or are you deliberately not adding type annotations where the type can be deduced maybe?

I'm asking because I believe e.g. mypy wouldn't like this (partial type hinting in function definitions)

Copy link
Copy Markdown
Author

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

My typing is intended for VS Code's (and maybe other editors') auto complete, so I didn't add type annotations where the type can be deduced.

Copy link
Copy Markdown
Contributor

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

FWIW if you're planning to get this merged, I'd highly recommend to go ahead and fully type it, even for things that pyright (which VSCode uses) can infer -- it'll probably be helpful to more people and is only marginally more work!

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.

Adding type stubs

2 participants


Back | FazBrowse Home | New Git URL