These are public posts tagged with #mypy. You can interact with them if you have an account anywhere in the fediverse.
Redid my #neovim config to keep up with the times (I used many deprecated
plug-ins, and didn't use #lua).
I haven't the faintest idea what I'm doing, I just followed a tutorial, got #lazyVim, and a few plug-ins, and I am utterly stomped by how to set up the #python lsp, especially as I want to include #mypy type checking.
The duality of #documentation is that I either get a tutorial that explains nothing and expects you to copy paste, or a manual that goes waaaay over my head.
#ty #mypy - but mypy already compiles itself to c via #mypyc so being faster isn't what I'd be expecting, it will be different and probably find different typing errors since for all the type checkers, it comes down to a matter of opinion. Do you think that will be a runtime error? That's in the future, who knows man.
I’m busy re-applying this “gradual import” technique on a client project today. Will slowly get them up to a full django-stubs installation.
https://adamj.eu/tech/2022/08/23/python-type-hints-gradually-add-types-for-third-party-packages/
Hynek Schlawack recently described graduality as Python’s…
adamj.euNous avons tous nos bonnes pratiques lorsqu'il s'agit de créer un nouveau #projet #Python, avec l'utilisation de patterns et d'outils éprouvés : lint avec #ruff et #mypy, hooks avec #precommit, tests avec #pytest, intégration continue #githubactions : https://github.com/neubig/starter-repo
Libre à chaque personne de faire évoluer le porojet selon ses propres goûts et contraintes.
An example starter repo for Python projects. Contribute…
GitHub#ChatGPT introduced me to a couple of cool things in #Python today. When you know that a function returns a specific type you can use assert to let #mypy know that. Or you can use the cast() or TypeGuard.
https://chatgpt.com/share/67d9f37a-5434-8009-884a-60eed44951cb
Shared via ChatGPT
ChatGPTАннотации типов в Python: коротко о главном
Привет, Хабр! Сегодня рассмотрим, как Python, оставаясь динамически типизированным, может приближаться к строгой типизации. Всё дело в аннотациях типов , которые позволяют явно указывать, какие данные ожидаются в переменных, аргументах функций и возвращаемых значениях. Аннотации сами по себе не заставляют Python проверять типы во время выполнения, но их можно использовать вместе с инструментами статического анализа. В первую очередь мы будем работать с mypy — популярным инструментом, который выявляет ошибки до запуска программы.
Привет, Хабр! Сегодня рассмотрим, как Python, оставаясь…
ХабрNew account, so new #introduction. Let's do it again!
I have a #MastersDegree in #ComputerScience and #ComputerEngineering. I went to #NMU for undergrad and #MSU for my graduate degree. I currently work at #UChicago for the #TMWCenter, which focuses on helping young children acquire language (and therefore other learning skills) faster.
In my spare time, I develop #OpenSourceSoftware such as
- a #SphinxDoc extension that embed #Fediverse comments on your page
- a library to talk to #ManifoldMarkets from native #Python
- a #PredictionMarket manager using the above
- a #transpiler from a subset of Python to #OpenStreetMaps's #OverpassQL
- bug fixes to many other projects, including #mypy, #base58, #attrs, #CPython, & more
I spend a fair bit of my time these days on #MathResearch, specifically into the #ThueMorse Sequence and its extensions.
I'm also a hobbyist editor on OpenStreetMap.
#Demisexual, #transfem, and happily engaged to my #enby sweetheart.
We have two cats: #OpheTheLoaf and #MayalaranTheCat (yes, from #StormlightArchive) See here for more on them!
I speak English fluently, Spanish haltingly, and am trying to learn Chinese
#queer #Chicago
These are our cats, #OpheTheLoaf and #MayalaranTheCat.…
TransFem SpaceThe static type annotation system in Python (and associated typecheckers) really turns it into a business-ready language. I'm making some big refactors, and I don't know how I would pull them off without type verification.
So many situations where I change a function signature and discover it's being called
alllllll the way over there and would just runtime-error without mypy letting me know the signatures no longer match.
Seriously, static type annotation alone has moved Python from "cute toy language" to "production-worthy" in my professional toolbox.
Survey on use of types in Python among around 1000 developers. 88% of respondents “Always” or “Often” use Types in their Python code.
Study conducted by Meta, JetBrains, and Microsoft, results on a Google dashboard.
https://engineering.fb.com/2024/12/09/developer-tools/typed-python-2024-survey-meta/
Ten years after the introduction of PEP 484, we surveyed…
Engineering at Meta@cdavies I really really want to hate #python sometimes but can't. The darn thing is so useful. Nothing beats it for anything <1k loc! And no matter what you want to do, it is second or third best choice available.
But as a language for developing systems, it sucks! C-API is terrible (shoutout to #pybind11 and #maturin). Dynamic typing becomes a bane (#mypy helps). For last two days, I am tweaking a #fastapi, I miss rust type safety when refactoring.
Good news #NumPy is built 1.23.2->1.24.4 with the latest #pytest and #MyPy, any other versions up to 1.26.4 could not be built without a higher level of wizardry.
#Pandas has been built on the latest version!
Fixing failing dependency to build #SciPy hoping to refresh it to the latest version when chaning packages are resolved.
70+ commits are in the queue for the python team in #Guix.
Oh Brave New World...
How on earth are users of django-stubs getting the “id" field to work properly? Does nobody ever refer to it in code? Am I holding it wrong? I have so many instances of ‘error: "NominatingMemberProfile" has no attribute "id"' in my mypy output, and I can't help but wonder what the hell I'm doing wrong. #django #mypy #python
Дайджест канала opensource_findings за август 2024
Привет! Под катом множество сложных технических тем внутри питона: от генерации стратегий hypothesis до устройства тайпчекера MyPy. В качестве тестового формата решил сделать подборку сложных технических тем, про которые писал в августе у себя в тг канале: https://t.me/opensource_findings со ссылками на полные посты. Посмотрим, насколько такой формат работает, напишите свои мысли в комментарии! Буду благодарен обратной связи, поехали!
Привет! Меня зовут Никита Соболев. Я занимаюсь опенсорс…
t.meAre there people here using the #Ruff #LSP on #KDE with #Kate ?
I've followed the setup instructions [0] but it does not seem to work properly... in particular it doesn't seem to detect functions, etc, so I don't get the "go to definition" functionality, while everything works fine if I use #mypy (it's just super slow and CPU intensive).
[0]: https://docs.astral.sh/ruff/editors/setup/#kate
Any help is welcome (even if it's only a boost) because I'd really like to get that lightning fast LSP!
Enjoyed a morning walk listening to Intervista Pythonista italian podcast
Marco Santoni & Cesare Placanica hosted Alan Franzoni who discussed type-checking in Python and its application at Aiven with mypy
Highly recommend
https://podcasters.spotify.com/pod/show/marco-santoni/episodes/Type-checking-statico-su-grandi-codebase--Ep-55-e2lufum
Conosciamo Alan Franzoni, Engineering manager presso…
Anchor FM Inc.@mariatta, I think I would have enjoyed PyConUS. My attitude toward #python has been evolving rapidly. My first encounter was in the 90s looking at the mailman code, but never touched it or looked at it until a couple of years ago.
My reintroduction was via #SageMath. I liked using Python for teaching about other things, including #cryptography. I could write things that would be readable to many people and I didn’t have to use a bigint library. So I have largely shifted to #jupyter from #RMarkdown for my own notes on things and for exposition.
But (putting it mildly) I am not a fan of dynamic typing, and I was coding against the grain. But a very wise friend, @averagesecurityguy said, “Let Python be Python”.
The work of the Python typing community has helped me enormously. If I broaden my notion of “compile time” to include #mypy checks, then I have decent compile time type checking, while letting Python be Python.
A guide on integrating #emacs + #python + #hatch using [mostly] builtin tooling and project local .dir-locals.el variables.
Specifically, this setup uses #Eglot + #pyright for live syntax checking, #pytest for code running, #MyPy for type-checking, and #IPython as the shell
Feedback would be welcome -- trying to get it robust + idiomatic.
Python has yet another packaging tool, Hatch. Here’s…
jtmoulia.srht.site