Skip to content

Add typing in Python code#660

Open
peasoft wants to merge 4 commits intomsgpack:mainfrom
peasoft:main
Open

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

Conversation

@peasoft
Copy link
Copy Markdown

@peasoft peasoft commented Jan 2, 2026

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 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.

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)

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