Tootfinder

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

@cark@social.tchncs.de
2024-02-09 06:09:12

Until last week I supervised a weekly online lecture on :python: #Python for #engineering at @…
Now I am thinking on continuing this as a public Q&…

@JGraber@mastodon.social
2024-02-09 19:00:25

#Python Friday #213: Tune the Garbage Collector
improveandrepeat.com/2024/02/p

@hynek@mastodon.social
2024-02-09 09:53:33

Nothing lets me feel like an alien visiting earth like the popular state of data validation in #Python.
I have an elaborate blog post in me, but I’m just gonna leave here that trying to shoehorn your validation models into your data model is the biggest attractive nuisance I’ve seen in a LONG time.
Whenever I try it anyway, I run into unsolvable problems within minutes & have to s…

@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-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.

@JGraber@mastodon.social
2024-03-08 19:00:51

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

@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…

@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 …

@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

@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: @…

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

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

@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!

@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
@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…

@philip@mastodon.mallegolhansen.com
2024-05-07 01:09:35

For the first time in quite a while, the following factors have come together for me:
1. I solved a novel problem at work
2. I'm allowed to talk about it
3. I'm proud enough of my solution to share it
So if you are a person out there using the #Panel #Python

@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,

@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…

@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).
@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…

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

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

@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

@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

@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.

@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 …

@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 #...

@philip@mastodon.mallegolhansen.com
2024-05-07 01:09:35

For the first time in quite a while, the following factors have come together for me:
1. I solved a novel problem at work
2. I'm allowed to talk about it
3. I'm proud enough of my solution to share it
So if you are a person out there using the #Panel #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

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

Time is hard #python

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

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

@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

@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

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

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

@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

@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…

@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):

@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

@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'))
@frankel@mastodon.top
2024-04-18 09:22:08

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

@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
@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

@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

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

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

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

🧠 Rye Grows With UV
#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

@ShibaBotJason@social.linux.pizza
2024-03-26 02:55:31

Leaned a handy #Python trick today. Needed a quick web server to test a web site. Browse to folder in Linux Mint, right click for 'terminal here' then:
python3 -m http.server 8000
Starts a web server with current directory as document root on port 8000.

@_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 :)

@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…

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

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

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

I’m doing #python today...

screaming homer simpson GIF
@texttheater@mastodon.social
2024-02-16 12:51:00

open(path, 'w', makedirs=True) #Python #when

@ronaldsnijder@mastodon.social
2024-04-19 17:52:44

Here at Mastodon you are allowed to #nerd, right? Since a week or so I am learning to do some #coding in #python , and I am amazed how easy it is to work with. Need to create some JSON

@geant@mstdn.social
2024-02-16 13:32:01

We are happy to announce the release of #FileSender 2.45.
For this release, the #Python client supports #encryption allowing upload and download of encrypted files from the command line. Newer versio…

@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

@90scraig@pb.craignt.com
2024-03-29 23:31:09

Do any of my connections have experience with LangChain?
I'll preface this with "I'm not a dev/coder".
I have a question on loading data. Say I have I am pointing to a directory of PDFs that I want to chat with. I start a chat session, it indexes it all into a vector db and I can chat with it. What happens when I add a new PDF in the directory? Does it update it does it wait until I restart the session?

@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

@wemic@social.linux.pizza
2024-03-26 18:13:38

Code in Place is back for another year, baby!
Are you looking to get into coding? Or maybe you're looking to tech some students?
Well this is the place for you! Fully online, fully free, intro to #Python course created by two lovely #Stanford professors back in the dark ages (2…

@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

@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'…

@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-03-29 19:00:36

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

@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-02-23 19:01:50

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

@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

@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…

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

I’m doing #python today...

screaming homer simpson GIF
@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

@geant@mstdn.social
2024-02-16 13:32:01

We are happy to announce the release of #FileSender 2.45.
For this release, the #Python client supports #encryption allowing upload and download of encrypted files from the command line. Newer versio…

@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

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

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

@_mr_moe@mastodon.social
2024-02-14 14:13:24

requests and urllib3 and so on - ahhhhhhhhhh
#python

@mgorny@social.treehouse.systems
2024-02-09 19:10:49

Did I ever mention that I hate how often modern software treats your home directory like a waste dump, and never bothers cleaning up after itself?
I've just discovered 2G of random stuff in ~/.local/share/virtualenv. And 8G in ~/.local/share/baloo — and I don't recall ever using that. I'm not going to even talk of ~/.cache/pip and ~/.cache/pre-commit (I guess that's the most misdesigned tool I've ever were forced to use) — but these are at least in the correct top-level directory.
Is it really that hard to implement some cache cleanup?
#Gentoo #Python #Linux #pip #VirtualEnv #PreCommit

@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.

@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

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

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

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

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

@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

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

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

@joe@toot.works
2024-05-03 12:24:28

I’m rewriting @… to use a new API (because the old one doesn't work right anymore), rewriting it to be in #Python instead of #Node, and moving it from #Pipedream to a local #Docker container on my homelab machine.
You can probably expect a few articles on @… about this.

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

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

@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

@scottmiller42@mstdn.social
2024-03-22 23:46:35

Every so often, I think about the abundance of free *, high-quality software development tools, and I'm just amazed.
35 years ago, something one-fourth as good as #Python #Spyder would've cost over $500 in today's money.
* Free as in beer, but in many cases, also free as in libre.…

@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

@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-07 13:10:02

The most recent #Django releases, 5.0.5 and 4.2.12 are broken. Most likely they were done on #Windows, and that obviously is sufficient to break stuff.
[UPDATE: 5.0.6 and 4.2.13 are good. Thanks a lot!]
So far, we've noticed the following issues:
1. The directory is named lowercase `django-X.Y.Z` instead of capital-case `Django-X.Y.Z` (the filename remains capital-case).
2. All files have CRLF line endings instead of LF.
3. All files that should have the executable bit, have lost it.
As a result, the releases don't pass their own tests.
I hope to report this upstream, but their Trac is down now. So you can't even download the releases right now.
#Gentoo #Python

@nobodyinperson@fosstodon.org
2024-02-13 15:28:49

#Python #IPython and #Jupyter will refuse to auto-complete a path if it contains an equal sign (=). 🙄

@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-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

@nobodyinperson@fosstodon.org
2024-02-13 16:32:53

Grr I let my data analysis run for 2h, just for it to blow up at the *last* crucial saving step with a stupid ImportError because I forgot to 'import pickle' 🤦 I should run #mypy more often... 😅
#Python #dataAnalysis

@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

@JGraber@mastodon.social
2024-03-01 19:00:57

#Python Friday #216: #Test Your #FastAPI Application

@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-03-04 17:33:24

So I'm trying to package #uv, this "future" of #Python packaging (read: another NIH in #RustLang), for #Gentoo. The experience so far:
1. "Out of space". Apparently need 8G to build it.
2. Tests fail without Internet access. Sure, why not use production #PyPI instance for testing.
3. Tests fail because PyPI sdist is missing files. Gotta switch to GitHub archive.
4. Tests fail because I didn't update crates for that one test from GitHub archive.
5. Tests fail because they *expect* Python 3.11.7 and Gentoo shamelessly is at 3.11.8. Sigh. github.com/astral-sh/uv/issues
Quality software, gotta admit.

@mgorny@social.treehouse.systems
2024-05-05 05:43:36

This function has a certain XKCD#221 vibe to it. Perhaps the package originates from Debian? (remember CVE-2008-0166?)
#Python #Gentoo #WTF

@mgorny@social.treehouse.systems
2024-04-05 15:36:30

After getting yet another bug report about #Python package (this time #VirtualEnv) failing to build, because the user did not have new enough #TroveClassifiers installed, I've filed a bug asking #Hatchling to make trove classifier validation either optional or non-fatal.
Right now this simply is not feasible. Technically, every package would need to specify a *minimal* `trove-classifiers` package dependency based on the classifiers they used, and we would have to keep these versions in every #Gentoo ebuild. However, that's unlikely to ever happen, so we'd actually have to check all listed trove classifiers and map them back to package versions. Or, more realistically, just always depend on the newest trove-classifiers available and hope we don't forget to update the dependency.
#PEP517 #packaging