Skip to content

Conversation

tapple-cisco
Copy link

@tapple-cisco tapple-cisco commented Sep 11, 2025

This comment has been minimized.

This comment has been minimized.

_AttrValue: TypeAlias = str | dict[str, str]
_AttrDict: TypeAlias = dict[str, _AttrValue]

class _DictSAXHandler:
Copy link
Member

Choose a reason for hiding this comment

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

I see that this PR's still a draft, but since you were working on this class I wanted to ask: Is _DictSAXHandler part of the public API or known to be used in user code? If not, it shouldn't be included in the stubs.

Copy link
Author

@tapple-cisco tapple-cisco Sep 11, 2025

Choose a reason for hiding this comment

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

It is not public API, but:

  1. I'm currently writing proprietary code that needs to directly access _DictSAXHandler, and need a stub so that my code type-checks
  2. _DictSAXHandler.__init__ args are exposed indirectly via public api parse(**kwargs)
  3. stubgen created incomplete _DictSAXHandler stubs

Since I need to write the stub anyway, I figured I'd share it. If it's not appropriate, I can remove _DictSAXHandler. The research would still be preserved in the parse(**kwargs) typings

Copy link
Member

Choose a reason for hiding this comment

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

In that case it's probably fine to include (we're generally willing to include private APIs when users request them), but I'd like to hear another maintainer's thoughts

@tapple-cisco tapple-cisco marked this pull request as ready for review September 11, 2025 20:57

This comment has been minimized.

@tapple-cisco
Copy link
Author

Marking this as draft as it looks like upstream is about to make a new release that changes some types

@tapple-cisco tapple-cisco marked this pull request as draft September 12, 2025 14:31

This comment has been minimized.

This comment has been minimized.

- Closes: python#14710
- Add default values
- Reveal kwargs
- Add to stricter pyright exclude list
@tapple-cisco tapple-cisco marked this pull request as ready for review September 15, 2025 13:37
@tapple-cisco tapple-cisco changed the title xmltodict stub improvements xmltodict stub improvements and bump to 1.0 Sep 15, 2025

This comment has been minimized.

@tapple-cisco
Copy link
Author

Ready for review as xmltodict 1.0 is released and I included it with a merge from @donBarbos

@tapple-cisco tapple-cisco changed the title xmltodict stub improvements and bump to 1.0 [xmltodict] stub improvements and update to 1.0 Sep 15, 2025
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

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.

3 participants