AI can now spin up Python functions on the fly, but the real work—maintaining, testing, and ensuring type safety—still falls to us. Learn how tools like Pydantic help bridge the gap between AI‑generated code and reliable, typed Python, and why developers can’t hand over the reins completely. #AICodeGen #Pydantic #PythonTyping #TypeValidation

🔗 https://aidailypost.com/news/ai-writes-python-functions-yet-developers-must-still-maintain-them

Which type-checker are you using?

#python #PythonTyping

mypy
73.9%
Pyright/Pylance
26.1%
Pytype
0%
Pyre
0%
Poll ended at .

@europython I went through 3/4th of the proposals so far. There are *too many* interesting proposals, even more so than previous years I find. What a nice predicament to experience!

Especially excited to see (relatively) many people wanting to share their stories and retrospectives (which has been historically lacking from soloists & small teams), #eventsourcing for all knowledge levels, and more nuances on #pythontyping (it's not a yes/no story for #python ).

Bumped to typing.cast() function, which has been there since Python 3.5. This blog post explained well what it does and when you might need it:

https://adamj.eu/tech/2021/07/06/python-type-hints-how-to-use-typing-cast/

#python #typing #pythontyping

Python Type Hints - How to Use typing.cast() - Adam Johnson

Python’s dynamism means that, although support continues to expand, type hints will never cover every situation. For edge cases we need to use an “escape hatch” to override the type checker.

#Python #PythonTyping

Sometimes I contribute types to opensource projects, and while some projects are welcoming type contributions, others either not consider it a priority or even oppose including types.

For me typing greatly improves development process. How about you?

Are you using types in your projects?

Yes, with mypy
43.5%
Yes, with pyright/pylance
13%
Yes, other type checkers (comment which)
13%
No
30.4%
Poll ended at .

Turns out using `func(kwargs)`becomes very inconvinient, when you're using type-checking.

Pyright 1.1.312 landed a change:

> ... The new behavior matches that of mypy and assumes that the unpacked dict may supply arguments for all otherwise-unmatched keyword parameters even if they have default argument values.

https://github.com/microsoft/pyright/issues/5545

And now i need `# type: ignore` for each `kwargs`.

@hynek any ideas how to approach this?

Or maybe someone on #EuroPython ?

#Python #PythonTyping

Regression in handling kwargs arguments · Issue #5545 · microsoft/pyright

Describe the bug I'm using unittest.mock.patch in my tests, and it has ability to pass kwargs to configure_mock later, so i'm using code like this: from unittest.mock import patch @patch("urllib.re...

GitHub