Tootfinder

Opt-in global Mastodon full text search. Join the index!

@hynek@mastodon.social
2024-05-13 15:59:34

Before I start churning out my pre-PyCon releases, how about a build-and-inspect-python-package that adds GitHub-style build provenance attestations by just adding one setting (and one permission)!? #python

@crell@phpc.social
2024-05-13 15:27:09

Teaching #Python folks the joys of clear and explicit object type definitions. An interesting experience...
#Programming

@mgorny@social.treehouse.systems
2024-05-12 13:11:12

These is one of these days when it occurs to you: "hey, packages using #Python and #RustLang, may have *both* Python and Cargo-level tests." And then you spend a lot of time going over all Rust-enabled dev-python/* packages and adding `cargo_src_test` where appropriate.
As it turns out, many of them did. Most of these don't actually link to libpython, so I suppose it's fine to test them once. Pydantic-core does, so I test per-impl (but also can't test on PyPy). Cryptography has Rust-level tests that don't even build (they fail at linking).
#Gentoo

@chrysn@chaos.social
2024-05-13 10:39:15

There is a new version, 0.4.8 of aiocoap, the asynchronous #Python library for #CoAP.
Nothing fancy in terms of features, but some improvements on error handling, type annotations (#mypy has joined CI) and platfor…

@guerda@ruhr.social
2024-03-12 16:45:34

#TIL that #Python is older than #Java

Screenshot of Wikipedia articles of Java and Python: Java Highlighted: First appeared May 23, 1995; 28 years ago; Python highlighted: First appeared: 20 February 1991; 33 years ago
@wikinaut@berlin.social
2024-03-11 12:28:05

#Python
In case you need that:
Interpolation of a given #GPX-track
🔸Force number of output track points (e. g. make a track of 1000 points matching the input) ; or
🔸Force constant distance (force output track with points e. g. every meter)
Options
🔹overwrite existing timesta…

@mgorny@social.treehouse.systems
2024-05-14 19:13:45

#CPython 3.13 has some new fun flags for #Gentoo ricers.
USE=jit − enable to get Just-in-Time compiler and make stuff faster. Note that you're also going to see random segfaults, etc.
USE=gil − disable to get rid of Global Interpreter Lock and get a freethreading #Python. Expect some random breakage, race conditions, etc.

@MrBerard@pilote.me
2024-05-12 10:53:33

BeeTeeDubs, I'm going live in ten with a #LiveCoding #Python Tutorial drawing flags with turtle graphics.
Really it's about abstraction and decomposition.
#ComputerScience

@khalidabuhakmeh@mastodon.social
2024-03-11 14:40:14

I’m doing #python today...

screaming homer simpson GIF
@JGraber@mastodon.social
2024-03-08 19:00:51

#Python Friday #217: Path- and Query Parameters in #FastAPI
impr…

@Madelen@social.linux.pizza
2024-04-12 18:29:44

RenPy is such an interesting project.
#programming #python

@khalidabuhakmeh@mastodon.social
2024-03-11 14:40:14

I’m doing #python today...

screaming homer simpson GIF
@dennisfaucher@infosec.exchange
2024-05-13 17:06:31

Just stumbled on this now that I have a server with an actual GPU. Host a jupyter server with GPU access.
docker run --gpus all -it --rm -p 10000:8888 -v "${PWD}":/home/jovyan/work quay.io/jupyter/datascience-notebook:2024-04-29
#Docker #AI #Python #NVIDIA

@davidshq@hachyderm.io
2024-03-08 18:12:59

I have a #python script that queries a #neo4j #database. It was working fine connecting to AuraDB but when I changed to use my local instance it started erroring out ("Unable to retrieve routing information&q…

@mgorny@social.treehouse.systems
2024-05-12 18:35:17

By the way, if you find my #Python 3.13 porting or other #Gentoo work helpful, please consider donating to my cat food fund.
#donation

@farshidhakimy@chaos.social
2024-05-09 12:16:00

Kann man in #Python eigentlich Variablen z.B. mit #Redis oder anderen Key-Value-Stores ersetzen und dabei so wenig Code wie möglich verändern?
Sodass die Variablen sozusagen auf allen Servern in Echtzeit den gleichen Wert haben?

@frankel@mastodon.top
2024-03-26 09:19:03

Breaking #Packages in #Python: an exposé of the nooks and crannies of Python’s modules and packages
dagster.io/bl…

@hynek@mastodon.social
2024-05-11 07:44:02

Come for wisdom on tox & Nox – stay for unrelated gems that will improve your life! #python #video
youtu.be/ImBvrDvK-1U

@cdp1337@social.veraciousnetwork.com
2024-05-09 05:11:23

#Python
As I'm working on my #networking diagnostic script which relies on my OS abstraction layer for system information I built a number of years back, I decided it would make more sense to formally port this API up to pypi as a standalone library. (It doesn…

@Madelen@social.linux.pizza
2024-04-12 18:29:44

RenPy is such an interesting project.
#programming #python

@nobodyinperson@fosstodon.org
2024-05-04 11:42:49

I think I have finally™️ (for the third or so time) found myself a solution for :python: #Python development on :nixos: #NixOS that allows me to just work with #pythonPoetry et. al. as on other distros.

@mgorny@pol.social
2024-05-09 05:41:48

Wczoraj dodałem Pythona 3.13.0b1 do #Gentoo, razem ze wsparciem na poziomie eclass oraz pierwszą partią portów (z PyTestem włącznie).
Na razie tylko dla amd64, bo musimy przetestować mpdecimal.
#Python

@publicvoit@graz.social
2024-03-26 18:22:52

Had an issue with #NixOS where I couldn't run a #Python tool that uses pandas. (Nix really doesn't work well with Python.)
Somebody helped me to find the solution by:
nix-shell -p 'python3.withPackages (ps: with ps; [ pandas numpy ])'
Today, another Python project with pandas a…

@mgorny@social.treehouse.systems
2024-05-14 12:40:54

Here's my newest optimization idea for #Gentoo #Python: for pure Python packages and packages using the stable #CPython API, let's reuse previously built wheels if they're compatible instead of building them separately for each Python implementation.
This is mostly a major gain for the lot of packages using #setuptools when you're using multiple PYTHON_TARGETS, since calling into that build system has a significant cost. However, it also saves some actual compiling in the packages using the stable API (particularly, Rust packages).
github.com/gentoo/gentoo/pull/
bugs.gentoo.org/931689

@scottmiller42@mstdn.social
2024-04-08 04:02:13

It's really a bummer that #Python enumerate doesn't have an option to tell it to go backwards.
Also, it took me way too long to figure out that code like this doesn't do what I wanted it to do. (The index doesn't match the location in MyString.)
MyString = "Hello"
for index , Char in enumerate (MyString[::-1]):
print (index, Char)
0 o
1 …

@anders@mastodon.cyborch.com
2024-05-07 06:19:41

The more of these comments that pop up in my feed the more it feels like the internet is conspiring to make me try Julia for my next data science project.
#python #julia
From: @…

@JGraber@mastodon.social
2024-04-05 18:21:34

#Python Friday #221: Refactor the #FastAPI To-Do Application
i…

@me_datapoint@mastodon.online
2024-03-01 09:00:28

I have a job opening for a research software engineer for expanding our #Python libraries for #massspec data analysis!
You should bring Python software development skills. #massspec or

Sketch of the new ZDD building at the University of Applied Sciences Düsseldorf (HSD).
@ian@phpc.social
2024-03-03 02:32:17

Me: #Python couldn't possibly still have a horrid experience on installing packages.
Me, ten minutes later: Actually, nope, still horrid. How do people function in this environment?!?
h/t to @… for being correct here.
For the record,

@mgorny@social.treehouse.systems
2024-05-12 16:45:48

How about tests that fail in a completely nondescript way if your hostname is 12 characters long? I mean, the bash prompt gets into output and breaks matching in one environment, and doesn't in an environment with a shorter hostname.
As it turns out, it was caused by putting a wrong path to bashrc override while adding zsh support to #ArgComplete. I guess most people didn't get a long enough bash prompt to hit the failure.
#Gentoo #Python

@mmoya@mastodon.social
2024-04-19 10:56:07

Time is hard #python

@joe@toot.works
2024-05-02 22:33:46

I'm close to having @… sorted out. With a new API comes slightly different data points. #python

@astrojuanlu@social.juanlu.space
2024-02-22 07:23:21

What alternative to Heroku are you using to deploy your Python projects? (Please boost for reach!)
(Same survey as last year, let's see if the results are significantly different)
#python #paas #heroku

@frankel@mastodon.top
2024-04-21 09:02:05

Announcing py2wasm: A #Python to #Wasm compiler
wasmer.io/posts/py2wasm-a-pyth

@simon_brooke@mastodon.scot
2024-04-29 15:18:30

The available open source libraries for generating human models (MakeHuman, ManuelBastioniLab) appear to be written in #Python. I need something like this, but I'm working primarily in #Clojure. I'm wondering whether it would be easier to load one of the existing libraries into Jython and try to …

@chrysn@chaos.social
2024-03-06 08:18:37

Me, looking at #Python 3.13 changes: Hey nice, I'd like to use this (today: helpers for #IPv6 mapped addresses).
Me, looking at downstream projects: Hm, once they upgrade their deployments, I can finally use Python 3.10 features!

@karlauerbach@sfba.social
2024-03-23 22:54:06

I have noticed that some of my Python builds are emitting "Sorry" error messages rather than "Error" message for things like indentation flaws.
"Sorry" is a sorry way to flag an error.
#python

@JGraber@mastodon.social
2024-04-12 18:01:03

#Python Friday #222: Filter the Tasks in the #FastAPI Application #DependencyInjection

@cark@social.tchncs.de
2024-03-28 20:23:16

I am working on a significant improvement to debug #Python code in #Jupyter notebooks:
It is based on the possibility to connect to a running Jupyter kernel from the command line and execute code in that context.
There, we can rerun the failing code and apply a custom excepthook to sta…

@castarco@hachyderm.io
2024-02-15 21:20:50

It's been a while since I worked on #Python, but I remember how great was Ruff as a linter replacement.
It seems that the same team behind Ruff is now releasing a pkg manager named `uv`, as a substitute for pip, poetry, pdm... and it looks great (well, I think the name is terrible, but we can live with that):

@cdp1337@social.veraciousnetwork.com
2024-05-08 03:33:48

#HomeLab #Python #Linux
Making progress on this network diagnostic script.
Thus far it reports:
Interface...
* name
* type
* status

Terminal application listing technical network stats useful for debugging a network connection
Terminal application listing technical wireless network stats useful for debugging a network connection
@fell@ma.fellr.net
2024-04-18 11:18:04

Even though I despise Python for wasting CPU cycles, I have rarely seen a CPU-limted system that was actually busy doing CPU things.
Most of the time things are only slow because GPU things like rendering and video decoding have to be done on the CPU.
#Python #Programming

@frankel@mastodon.top
2024-04-15 17:18:03

#Python PEP 744 – #JITCompilation
peps.python.org/pep-0744/

@me_datapoint@mastodon.online
2024-03-01 09:00:28

I have a job opening for a research software engineer for expanding our #Python libraries for #massspec data analysis!
You should bring Python software development skills. #massspec or

Sketch of the new ZDD building at the University of Applied Sciences Düsseldorf (HSD).
@crell@phpc.social
2024-03-01 20:24:29

Thought: #Python and #GoLang have very strong concepts of what is "idiomatically correct" for that language.
What is "idiomatic #PHP"? Is the PHP community even consistent enough for there to b…

@AndrzejWasowski@scholar.social
2024-02-23 13:27:21

Wow, I just accidentally discovered that #matplotlib allows some limited latex in label strings. At least $x$ works!
#python

@JGraber@mastodon.social
2024-05-03 18:00:50

#Python Friday #225: Set a Response Header With #FastAPI
improvean…

@datascience@genomic.social
2024-02-21 11:00:01

Video tutorials for modern ideas and open source tools. #python

@scottmiller42@mstdn.social
2024-03-01 15:53:21

Due to my assumption that my code will (eventually) be used to train AI, I've been obfuscating my #LeetCode submissions.
Today, I figured out how to use the #Python walrus operator inside a list to mash variable assignment into a return statement. It's delightfully horrible. Check out this o…

This is a screenshot of some Python code that was deliberately written in a way to be confusing (aka, obfuscated):

from collections import Counter
def DoSomething (s:str) -> str:
    return [CharCount := Counter(s), 
            f"The string has {CharCount['0']} zeros."
            ][1]

#  This prints "The string has 4 zeros."
print (DoSomething ('00011110'))
@joe@toot.works
2024-05-02 22:33:46

I'm close to having @… sorted out. With a new API comes slightly different data points. #python

@compfu@mograph.social
2024-04-16 20:35:21

Today I saw #Python code from hell where the author wrote a function to wrap a call that might return an empty list. Apparently they wanted to return False in that case to use it in an if statement - not knowing that Python treats empty lists as falsy by default. But it gets better. The code was broken and it was never able to return False. Instead it returned the empty list but the code worked an…

@nobodyinperson@fosstodon.org
2024-05-03 11:36:24

Can one pre-build a buildFHSUserEnv in configuration.nix and then have a command like 'fhs' that yanks you into a shell with all your environment.systemPackages in an FHS layout?
All my tries have given me either infinite recursion errors or other problems.
Seems like a way out of the #Python development misery on

@mgorny@social.treehouse.systems
2024-03-13 10:21:29

New on blog: "the story of #distutils build directory in #Gentoo".
"""
The #Python distutils build system, as well as #setuptools (that it was later merged into), used a two-stage build: first, a build command would prepare a built package version (usually just copy the .py files, sometimes compile Python extensions) into a build directory, then an install command would copy them to the live filesystem, or a staging directory. Curious enough, distutils were an early adopter of out-of-source builds — when used right (which often enough wasn’t the case), no writes would occur in the source directory and all modifications would be done directly in the build directory.
Today, in the #PEP517 era, two-stage builds aren't really relevant anymore. Build systems were turned into black boxes that spew wheels. However, setuptools still internally uses the two-stage build and the build directory, and therefore it still remains relevant to Gentoo eclasses. In this post, I'd like to shortly tell how we dealt with it over the years.
"""
blogs.gentoo.org/mgorny/2024/0

@frankel@mastodon.top
2024-04-18 09:22:08

9 Advanced #Python #Type Hints That Will Improve Your Code Significantly

@_mr_moe@mastodon.social
2024-04-19 14:22:12

I just wrote a script in #python that is using HuggingFaceH4 (hosted internally on a server) to make a proposal for the Severity of my Bugs with an explanation why it does that.
Tooked me with research and setup about 3 hours and it is pretty good. for the first 20 bugs, i would personally rate differently - but for one out of those the genAI is maybe more right than i am :)

@MrBerard@pilote.me
2024-04-27 09:15:28

If you are learning Python, I'm making a clicker-style game (but that doesn't threaten the lifespan of your mouse) at 1400 BST (1300 UTC).
Live coding: Cookie clicker, but without clicking (or cookies) #python #...

@UP8@mastodon.social
2024-02-23 02:14:39

🧠 Rye Grows With UV
#python

@mgorny@pol.social
2024-03-22 19:03:58

Cytując siebie (i tłumacząc):
"""
Szczerze mówiąc, uważam, że największym problemem jest to, że dystrybucja oprogramowania w Pythonie jest nieskończenie skomplikowana i nieintuicyjna, co oznacza, że każda osoba, która chce się tym zająć z którejkolwiek strony, ku swojemu zaskoczeniu odkryje bardzo wysoki próg wejścia. #Gentoo

@crell@phpc.social
2024-02-17 23:59:51

This video is about #Python, but the principles apply to any language. Or with appropriate language specific translation.
youtu.be/wf-BqAjZb8M

@mgorny@social.treehouse.systems
2024-03-14 16:21:30

I've done some benchmarks to demonstrate how different versions of #Gentoo parallel #Python extension builds (using #setuptools) #PEP517 code in distutils-r1.eclass improved over the years. I've even copied the numbers into a gnumeric spreadsheet. Now I just need to find energy to make a nice chart out of that (probably using PGF/Tikz).
Some numbers for a rough idea:
Cython 3.0.9 (package with a few C extensions):
- serial PEP517 build: 46.7 s
- parallel build / build_ext PEP517: 20.8 s 2.7 s
- parallel PEP517 via DIST_EXTRA_CONFIG: 22.8 s
django 5.0.3 (moderate pure .py package):
- PEP517 build: 5.4 s
- unnecessary build PEP517: 3.1 s 5.3 s
- unnecessary build_ext PEP517: 0.6 s 5.4 s

@nobodyinperson@fosstodon.org
2024-05-03 11:36:24

Can one pre-build a buildFHSUserEnv in configuration.nix and then have a command like 'fhs' that yanks you into a shell with all your environment.systemPackages in an FHS layout?
All my tries have given me either infinite recursion errors or other problems.
Seems like a way out of the #Python development misery on

@astrojuanlu@social.juanlu.space
2024-04-23 08:36:10

Second day of #PyDataBerlin, hearing about measuring tree height with satellite imagery
#python #PyData

Photo of a giant screen with a slide, a man on the right, and at the bottom the back of the heads of some attendees
@JGraber@mastodon.social
2024-02-23 19:01:50

#Python Friday #215: Async & Await
improveandrepeat.com/2024/02/p

@mgorny@social.treehouse.systems
2024-05-09 05:39:34

I've added #Python 3.13.0b1 to #Gentoo yesterday, along with the initial eclass support and a few baseline ports (up to PyTest).
It's amd64-only for the time being, since we need to keyword mpdecimal.

@scottmiller42@mstdn.social
2024-02-27 22:42:19

I'm surprised to see a computer science topic become the talk of the Whitehouse, but here we are.
The memory safety features of #Python are one of the many things I like about it.
What are the memory safe features of Python? A few that spring to mind: automatic bounds-checking, can't use undefined object references, & no memory pointer arithmetic. IMHO, those features don'…

@crell@phpc.social
2024-02-17 23:59:51

This video is about #Python, but the principles apply to any language. Or with appropriate language specific translation.
youtu.be/wf-BqAjZb8M

@compfu@mograph.social
2024-04-16 20:35:21

Today I saw #Python code from hell where the author wrote a function to wrap a call that might return an empty list. Apparently they wanted to return False in that case to use it in an if statement - not knowing that Python treats empty lists as falsy by default. But it gets better. The code was broken and it was never able to return False. Instead it returned the empty list but the code worked an…

@JGraber@mastodon.social
2024-03-29 19:00:36

#Python Friday #220: Manage To-Dos With #FastAPI
improveandrepeat.com/2024…

@nobodyinperson@fosstodon.org
2024-05-02 13:51:11

What would cause :git: #git to shell out at 'git -C repo fetch --all'?
I call git via #Python's subprocess module (no, not with shell=True) and it apparently shells out to my default :fish_shell: #fishShell

@UP8@mastodon.social
2024-02-23 02:14:39

🧠 Rye Grows With UV
#python

@mgorny@social.treehouse.systems
2024-04-08 16:21:15

Did you notice that the word "backslashes" includes "lashes"? That's precisely how I feel about people using unnecessary backslashes all over the place in #Python or #Bash code.
#Gentoo

@astrojuanlu@social.juanlu.space
2024-04-22 14:13:43

Katherine Jarmul at #pydataberlin: "Sure, humans learn things too, but we don't do it at scale, and surely we don't do it word by word"
THIS
#python #ml

@mgorny@social.treehouse.systems
2024-04-06 08:05:04

On 2024-03-19, two vulnerabilities were announced on #Python #security mailing list: "quoted zip-bomb" and "TemporaryDirectory symlink dereference during cleanup". Both were announced to affect all current #CPython releases.
The same day, security releases were made for Python 3.10, 3.9 and 3.8 branches. So far, so good. However, I found it surprising that there were no releases being made for 3.11 or 3.12.
On 2024-04-02, Python 3.11.9 was tagged. Initially, the signature on source tarball didn't verify. Today, it does verify, but the release still doesn't seem to have been announced. However, what I found the most surprising is the lack of fixes for the security issues announced before! Was the release borked?
So I've checked in more detail… and it turned out that both issues were already fixed in 3.11.8 (and 3.12.2), so the security announcement was wrong. Sigh.
That said, #PyPy is still affected.
mail.python.org/archives/list/
mail.python.org/archives/list/
discuss.python.org/t/python-3-
bugs.gentoo.org/927299

@JGraber@mastodon.social
2024-04-26 18:00:49

#Python Friday #224: Better HTTP Status Codes for #FastAPI
impro…

@nobodyinperson@fosstodon.org
2024-04-09 08:14:05

Here at #distribits unconference I quickly demonstrate @…'s #textual framework for website-like

@JGraber@mastodon.social
2024-05-10 18:00:50

#Python Friday #226: Fine-Tune the #OpenAPI Documentation in #FastAPI

@scottmiller42@mstdn.social
2024-03-27 14:12:36

Python Question: Is there an efficient way to see if every element in an iterable is equal to a user-specified value?
The best idea I've seen so far is to use a list comprehension to check for equality, and then use the all function, like this:
MyList = [1,1,1,1,1,1,1]
all((x==1 for x in MyList))
That's readable and probably not bad performance. Is there something better?
#Python

@astrojuanlu@social.juanlu.space
2024-04-17 16:17:02

Give a warm welcome to @… dear #Python folks! 🇮🇹

@mgorny@social.treehouse.systems
2024-02-25 18:59:48

I remember that back in the day, I've hit a #Python package that would attempt to be closed-source by shipping only a .pyc file… for Python 2.5. As you can imagine, this didn't work out — though it was a bit of a hassle to get a working decompiler back then (we didn't have a Python version older than 2.7.x in #Gentoo at the time). However, I don't really remember what it was and how it worked out in the end.

@JGraber@mastodon.social
2024-03-22 19:01:04

#Python Friday #219: Structure your #FastAPI Application
improvean…

@crell@phpc.social
2024-02-20 17:39:14

Just found an old GitHub repo from 2012 with the tag line "Bringing #Ruby best practices to #Python."
I cannot imagine how this would ever be a good idea.

@astrojuanlu@social.juanlu.space
2024-04-16 14:22:20

Who will be at PyData Berlin/PyCon Germany next week? ✋🏼
#python #PyConDE2024 #PyDataBerlin

@JGraber@mastodon.social
2024-02-16 19:00:49

#Python Friday #214: First Steps With #FastAPI
improveandrepeat.com/2024/02/…

@mgorny@social.treehouse.systems
2024-05-11 06:06:00

Of course, there's a #PEP517 backend for #SCons, one of the most horrible build systems ever made by humankind.
Of course, it managed not to implement PEP517 correctly.
#Gentoo #Python

@mgorny@social.treehouse.systems
2024-02-27 08:14:59

If you were even wondering why #Gentoo python-exec is sitting in dev-lang/ rather than dev-python/, that's actually a curious story of a hack.
#Python script wrapping dates back to the original python.eclass. The idea was sound: you'd rename scripts installed by Python packages to "foo-2.6", "foo-3.1", and then install a new wrapper that selects one of these versions. If this may sound unnecessary, remember that scripts need to be run with a Python version that has all its dependencies installed, and that different scripts could technically be installed for different versions (especially in the early Python 3 era, when using 2to3 was not uncommon).
The first version of dev-python/python-exec built on that concept, optimizing it in a few ways. It would install a shared wrapper as a separate package and use symlinks, whereas the old wrappers would be installed separately by every package. It would introduce a C executable to remove the overhead of starting a Python interpreter to determine which interpreter to actually start. However, it did copy the idea of suffixing scripts.
In the long run, this turned out to be a bad idea. Some scripts expected specific names, and we'd ended up hacking and patching things around. So I've made python-exec 2 that used a slightly different approach, and rather than renaming scripts, it moved them into a per-interpreter directory. This not only preserved the basename but let us make things simpler — we could just override the script install directory rather than having to rename stuff!
Migration was the problem. Two different approaches meant that packages built against python-exec:0 would have to continue depending on it. Originally, I've added a `:=` dep to the eclass but this couldn't solve the problem for packages already installed, and Portage ended up removing old python-exec. It wasn't good.
After some tinkering, I've figured out that the best approach is to add both slots as a new package, have the eclass depend on it with `:=` operator going forward and have the old `dev-python/python-exec` pull both slots for compatibility. This is what gave birth to `dev-lang/python-exec`.
bugs.gentoo.org/489440#c20

@mgorny@social.treehouse.systems
2024-04-04 18:19:10

It's a miracle! I've managed to make #SciKit Image tests work offline in #Gentoo!
That said:
1. Upstream includes most of the test data in sdist. Except they don't use it, and instead fetch it all from the GitHub repository. Sigh. (If you're upstream, please pretend you didn't see this and do not remove the data from sdist. Thanks.)
2. On top of that, they fetch more test data from an additional GitLab repository, and move and rename it around.
3. Yes, you've read right. They keep code on GitHub, but test data on GitLab.com (not self-hosted).
#Python

@JGraber@mastodon.social
2024-03-15 19:52:40

#Python Friday #218: Send Data to #FastAPI
improveandrepeat.com/2024/03/p

@mgorny@social.treehouse.systems
2024-05-10 18:45:57

You know what's great about #Python stable ABI? That you can take a binary package of, say, cryptography, and it will work on CPython 3.13, even though it's been built with older CPython version.
You know what's not so great about #PyO3? That you won't be able to build this package using Python 3.13 because it's going to reject it as "too new". Even if the package in question is only using the stable ABI compatible with CPython 3.9. Sigh.
So, of course, everything on #Gentoo will be blocked, until individual packages update their dependencies to use PyO3 new enough to support 3.13.
#RustLang

@mgorny@social.treehouse.systems
2024-02-29 17:14:47

And did you file a #LeapDay bug today? Like, a bug that people won't be able to naturally experience for the next 4 years?
#Gentoo #Python

@mgorny@social.treehouse.systems
2024-03-29 14:59:54

Small good news today: I've finally removed #nose (and its last reverse dependencies) from #Gentoo today.
#Python

@mgorny@social.treehouse.systems
2024-02-24 14:18:02

The state of #Python packaging:
1. Look into `pyproject.toml`. Just random linter configs.
2. Look into `setup.cfg`. More random linter configs.
3. Look into `setup.py`…
[EDIT: 4. It turns out you've missed `requirements.txt`.]
#Gentoo #PEP517

@mgorny@social.treehouse.systems
2024-02-28 04:07:38

Today is the day! We have finally been able to mark #NoseTests for removal from #Gentoo!
#Python

@mgorny@social.treehouse.systems
2024-02-28 04:07:38

Today is the day! We have finally been able to mark #NoseTests for removal from #Gentoo!
#Python

@mgorny@social.treehouse.systems
2024-03-28 12:47:24

The "#PyPI Support Specialist" job posting would be quite nice if they didn't add the last point that automatically disqualifies some people with disabilities, plus people from some countries that USA doesn't like at the moment [EDIT: and of course people who for one reason or another don't want to go to such a dangerous and hostile country]:
"Willingness to travel to annual PyCon US conference"
#ActuallyAutistic #Python

@mgorny@social.treehouse.systems
2024-05-11 08:42:44

Just hit my first JIT-related #CPython 3.13 test failure. Curious enough, it doesn't seem that the `gc.collect()` hack works, the way it does for #PyPy.
#Gentoo #Python

@mgorny@social.treehouse.systems
2024-04-23 05:10:59

As we all know, one of the primary purposes for #RustLang rewrites is improving security. And there is no better way to make your code secure than by not including it at all.
#Python #Gentoo

@mgorny@social.treehouse.systems
2024-04-23 05:10:59

As we all know, one of the primary purposes for #RustLang rewrites is improving security. And there is no better way to make your code secure than by not including it at all.
#Python #Gentoo

@mgorny@social.treehouse.systems
2024-04-02 15:35:40

Recently I've added a cheap hack to the standard #Gentoo invocation for #PyTest to throw errors if unhandled async functions are detected. The goal was to increase our chances of finding packages with missing dependency on dev-python/pytest-asyncio (or another equivalent plugin), or packages disabling plugin autoloading and failing to load such a plugin.
Today, I've gotten a first bug report, regarding dev-python/ipython. I've grepped the sources and confirmed that the package depends on PyTest-AsyncIO, except that it pins to < 0.22. Well, we don't have one that old but let's hope it works anyway. So I've tried adding the dep, `-p asyncio`… and PyTest still apparently couldn't find the plugin. I've scratched my head and tried `PYTEST_PLUGINS` instead — still the same result. What the…?
So I've checked the git repository out, tried with older PyTest-AsyncIO, and indeed the tests worked. Tried with the newest, 0.23.6, and the same issue occurred. I've checked the git history and discovered that the version pin was added because of a buggy 0.22.0 release. However, the issue has been fixed since, the release was yanked and my problem was nothing like that.
So I've investigated more. For some reason, #IPython test suite does not mark tests with `pytest.mark.asyncio` marker directly. Instead, it globally iterates over all test functions, and implicitly adds the marker to all coroutines. This used to work with older versions, but does not work anymore — the test is correctly marked, but for some reason it stops being recognized as a coroutine. So I've made a minimal reproducer and filed a bug.
The key point here is: the (potential) bug went unnoticed for a while now, because of the premature, then obsolete pin in IPython.
#Python