parkouss / pyewmh

An implementation of EWMH (Extended Window Manager Hints) for python, based on Xlib.
GNU Lesser General Public License v3.0
40 stars 15 forks source link

PEP 561 (type hints and `py.typed`) #19

Closed Avasam closed 2 months ago

Avasam commented 2 years ago

Added type hint comments and py.typed marker as per PEP 561 to allow type-checkers to validate usage of EWMH's API. Type comments allow to keep compatibility with python < 3.5. Optionally I could use stub files instead (.pyi), but that's more likely to fall out of sync with the implementation than inline-typing.

Validated with mypy and pyright both in strict mode. Added a github workflow to validate typing.

Also explicitly re-exported EWMH. Allow using boolean with setShowingDesktop. And prevent potential None errors from self._getProperty.

(sitenote, just tagging https://github.com/python/typing/issues/566 to link back here)

Avasam commented 1 year ago

@parkouss Could I get a review on this?

Avasam commented 2 months ago

@parkouss Bump

parkouss commented 2 months ago

Sorry for the (long!) delay! I'm not actively doing support for pyewmh, and for some reason I didn't get any messages from the conversation here (just got your email you sent directly a few days ago). Maybe you'd be interested to take ownership on this project?

Avasam commented 2 months ago

@parkouss No worries! I figured that'd be a possibility. Thank you for the offer, but whilst a have quite a bit of experience in Python, and gained much more in its type system over the past 2 years. I don't know that much about EWMH and my wish for PEP 561 support came from usage in https://github.com/Kalmat/PyWinCtl

Lack of tests and experience with EWMH means I could very easily and unknowingly break features. This is not something I could do without someone with the right expertise to help. I also wouldn't want to keep support for EOL versions of Python.