python

Back Open Paginator
10.10.2025 08:19
hackernews_bot_vn (@hackernews_bot_vn@mastodon.maobui.com)

Bài viết phân tích cách `contextvars` tương tác trong chuỗi các task `asyncio` của Python, giải thích cơ chế truyền ngữ cảnh giữa các coroutine và cách quản lý biến ngữ cảnh một cách an toàn trong môi trường bất đồng bộ. #Python #asyncio #contextvars #LậpTrình #CôngNghệ

valarmorghulis.io/tech/202408-




Show Original Post


10.10.2025 07:54
sptral (@sptral@mastodon.social)

Python simplifica la automatización de procesos al ofrecer librerías como pandas, schedule y pyautogui, que permiten manipular datos, programar tareas y controlar interfaces gráficas sin esfuerzo. Con scripts ligeros, empresas reducen errores manuales, aceleran flujos de trabajo y escalan soluciones rápidamente.




Show Original Post


10.10.2025 07:49
habr25 (@habr25@zhub.link)

Мы решили задачу омографов и ударений в русском языке

Мы наконец решили задачу омографов. Конечно, с рядом оговорок, куда без них. Получилось пресловутое приключение на 20 минут. Несмотря на кажущуюся простоту (задача по сути является бинарной классификацией, число кейсов с тремя валидными вариантами ничтожно мало), задача является просто кладезем различных "мин замедленного действия" и типичных граблей в сфере машинного обучения. Да, задачу "ёфикации" (расстановка буквы ё там, где люди её поленились поставить) мы считаем частным случаем задачи простановки ударений и омографов. Также мы опубликовали наше продуктовое решение для простановки ударений (в омографах в том числе) в рамках репозитория silero-stress и также напрямую через pypi . В ближайшее время добавим эту модель и обновим наши публичные модели синтеза и раскатим более мощную "большую" (тоже маленькую по современным меркам) версию модели в приватные сервисы и для клиентов. Также мы опубликовали бенчмарки качества и скорости публичных академических решений … и там всё очень неоднозначно. Наливайте себе чай, садитесь поудобнее. Мы постараемся описать наш путь длиной в вечность без лишних подробностей. Сели, налили, читаем

habr.com/ru/articles/955130/?u

#silero #ударение #русский_язык #омографы #разрешение_омографов #pytorch #python #pypi #нейросети #синтез_речи




Show Original Post


10.10.2025 07:47
sptral (@sptral@mastodon.social)

Python revoluciona el IoT al ofrecer una sintaxis sencilla y una gran cantidad de bibliotecas para sensores, comunicación MQTT y procesamiento de datos en tiempo real. Con plataformas como Raspberry Pi o ESP32, los desarrolladores pueden crear prototipos rápidamente, integrar IA en el borde y gestionar dispositivos de forma segura, todo con código legible y mantenible.




Show Original Post


10.10.2025 07:45
avlcharlie (@avlcharlie@mastodon.social)

Heres the final on that little workout. Ive played with this guy before.. he just happens to be on my desk with servos. Looks like my controller joysticks are just crazy noisy and jerk around but getting all the buttons and dpad mapped count. Motor base fiddlin prolly next.







Show Original Post


10.10.2025 07:11
netrom (@netrom@infosec.exchange)

Finally released version 1.7.0 of Vermin! With Python 3.13 support (144 new rules), GitHub annotation and colored output formats, and 3.14 deprecation fixes etc.

github.com/netromdk/vermin/rel

pypi.org/project/vermin/

#vermin #python #python313 #python3 #dev #programming #analysis #version #release #changelog




Show Original Post


10.10.2025 05:44
zcutlip (@zcutlip@hachyderm.io)

#python 3.14 just dropped in homebrew




Show Original Post


10.10.2025 04:53
fediverse (@fediverse@app.wafrn.net)

After using Flask for a few hours to try stuff out I can now say that it feels a lot worse to me than even Express. First of all, their use of decorators for routes is neat, but when you check the actual typing of the route you get "route" which makes sense and then the nebulous type of **options: Any. Ah yes, the unlabeled type Any options… Once you dig into the docs to figure out that you need to use method= with a list of the HTTP verbs, you still don't get any literal checking!

In addition to the pains of setting up a route function, you basically don't get any type safety. Your route is a string which tells Express to call your decorated function with specific named arguments so changing the string changes the name of the variables you get passed in. These variables in your function handler (or as Flask calls them, "view functions") aren't labeled either so you have to duplicate a lot of type signatures around if you aren't going full dynamic typing (vibe typing…). A more helpful system like Hono's type safe routing parameters would've been much more solid feeling though with the less integrated nature of Python's typing with its core features I can see how it would be really difficult to implement.

Taking more thoughts from Express and Hono, having the request and response as the guaranteed input type of the function is a lot better DX in my opinion. Express has mild troubles with having the function call have req res sometimes if they're unused which can lead to having to rename them with a prefix _ to stop your IDE from yelling at you. I think Hono's usage of a single context variable that includes the request, response, path parameters, and everything you could ever want is a better option in that respect as you're basically guaranteed to use it via context.res to send a response. By comparison the way that Python does reading request data is just horrid DX. You get a global object requests imported from Flask which has the request information you want except the path parameters. So we can get almost all the context we want. From a single variable. And you don't just pack the path parameters in there with them and pass it in as a context?!

One last small papercut on getting request details is that request.get_json() returns the type Any in case static type haters needed more ways to say types are useless. Json types with recursive typing is a whole other hell I don't want to deal with when I'm just making a simple REST API.

A different, more recent pain point I had was trying to do some basic validation. There isn't a Zod for Python, but there is a library called Pydantic which seems to be the most popular one at 25.4k stars. It comes with a whole system for making classes to use as validation schemes which will throw upon an invalid error. Since I personally really dislike errors as non-values, I went to a separate library for my simple validation needs called Zon which is awesome since it has similar syntax to Zod but is also a lot less developed and doesn't have proper error messages listing which property caused an error. Even with these libraries, however, I wasn't able to make middleware on specific paths as the middleware options that flask gives are either all paths or go make your own decorator. I'm not too averse to having to write my own decorators but I would have liked it to be like Express with a spot to put an array of middleware functions or something similar.

Once you're done dealing with all the dynamic type hell and you're ready to return, you're still not out of the dynamically typed woods yet. Unlike Express or Hono, to return a value in Python you don't use something standard-ish like response.text('goodbye') or response.status(200). Instead you return either another global from Flask—this time being the function make_response()—or a tuple with some arbitrary and unhinted value ordering.

For the make_response function, it returns a useful type of response but returns to the Flask Classic of having arguments of *args: Any. You couldn't just have a few variants?? Checking the API docs it turns out that the function call is useless for helping you write the values as it is just going to act like you were returning the arguments you use meaning if you didn't want to use it more like a factory function to assign the data, status, and headers separately, you're getting no type hinting from the function call signature so it's basically just the tuple! Even treating it like a factory you don't get the ease of chaining function calls as the properties are just properties on the class. Seemingly the philosophy is that more lines makes it more Pythonic.

Regarding the tuple option, you get a relatively arbitrary ordering and no helpful type hinting with names or other nice things—only your static type analyzer yelling at you for having the wrong types. You have to just know that the first spot is your value (which does sometimes give you helpful errors about type coersion), that your second spot is the status code, and the third is your headers.

And headers—fun fact! The Flask quickstart section on responses doesn't go over an example of adding headers with the tuple. All it says regarding that option is that you can make a list or dictionary of "additional header values". What type are these "additional header values" you may be wondering? It doesn't list 'em and you have to find the actual type by going to Flask's Api -> Response Objects and find the link to the type Header. This link then sends you all the way to the Werkzeug API docs on the Header type and then you don't even get an example of the dictionary type! For anyone following along at home, the actual types as extracted from type hinting are (DATA, STATUS_CODE, [("Header-Name", "value"), ("Another", "value")]) and (DATA, STATUS_CODE, {"Header-Name": "value", "Another": "value"}). The only appreciable thing about the entirety of the return semantic is that you are forced to return unlike in Express with its res.send() that explodes if you do it twice in the same function.

I wouldn't go so far to say that it's a horrible DX to make simple REST APIs but I wouldn't want to work on it for anything I care about. Since it's used so widely in teaching backend code so my issues like the the response global and "view function" semantics aren't likely to get any improvements, so my complaints are probably not going to change without something crazy like Python 2 to Python 3. It's just… Disappointing.


#python #flask


Show Original Post


10.10.2025 04:33
villares (@villares@pynews.com.br)

Code at: github.com/villares/sketch-a-d
More sketch-a-day: abav.lugaralgum.com/sketch-a-d
If you like this, support my work:
paypal.com/donate/?hosted_butt
liberapay.com/Villares
wise.com/pay/me/alexandrev562 #Processing #Python #py5 #CreativeCoding #LSystem #generativeArt





Show Original Post


10.10.2025 04:10
wobweger (@wobweger@mstdn.social)

#python
and for now something completely different 😍

pythoninsider.blogspot.com/202




Show Original Post


10.10.2025 03:00
jbz (@jbz@indieweb.social)

🐍 Python Insider: #Python 3.14.0 (final) is here!
pythoninsider.blogspot.com/202




Show Original Post


09.10.2025 23:55
ehmatthes (@ehmatthes@fosstodon.org)

This is why I haven't had to ask hosting platforms for a privileged account in order to work on django-simple-deploy.

I've been working on a plugin for Railway, and this is part of my usage for this month.

#Django #Python





Show Original Post


1 ...1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 ...1559
UP