home.social

Clément Robert :python:

View on fosstodon.org
  1. I fell down a rabbit hole of build backends for Python packages and wanted to experiment with . Two weeks later, and I finally have a + project for zen-gardenning (and I'm soooo far behind on my github backlog 🙈).

    Anyway, I'm pretty happy about it, so in case anyone would like to try it out, here’s what I believe is now the fastest and most portable implementation of Line Integral Convolution on PyPI: introducing `rLIC`

    github.com/neutrinoceros/rlic

  2. I can't quite convince myself yet that all inheritance/coupling is intrinsically bad, but I'm more and more recognising abstract base classes (ABCs) and classes as anti-patterns because they hinder , which to me is key to quality software; and mixins are by construction impossible to test on their own, and both patterns only make sense if a language supports inheritance, so it seems that the simplest option to avoid them is to get rid of inheritance altogether.

  3. Update: 0.5.9 solves this problem ! This means I can (almost) use uv everywhere in my workflows. The only remaining exceptions are debug builds, pre-releases and versions older than 3.8, all of which I can still get through !

  4. @__sharky__ @bouncing
    As far as I understand, stuff like `setattr` or any sort of cache needs to be handled with care in multi-threading. Again, this is already true with the GIL, it's just that I never considered the possibility of my code running concurrently at all and just gave me the push I needed to think about it. I also maintain packages filled with C and Cython extensions, so I need to know this stuff anyway.

  5. @bouncing no, you're right ! It’s just that my own pure Python libraries were *not* thread safe yet since I never considered it before.

    Yet, being marked as experimental (and overall brand new) I don't think it’d hurt to also test pure Python projects that already claim thread safety: you may discover the GIL was actually hiding bugs, or better yet, you might find edge cases where Python itself breaks.

  6. Resources that helped me a lot getting started:

    How to even get in CI, by @hugovk
    dev.to/hugovk/help-test-python

    and the dedicated blog by the Quansight team
    py-free-threading.github.io/

    Many thanks to the authors !

  7. Getting my packages ready for (PEP 703) means I need to learn all-things-threads for the first time.
    This wasn't obvious to me at first, but you can't just run your existing *single-threaded* tests suite: you also need to check how your objects behave in a multi-threaded context.
    So you need new tests. Where should you even start ? A good strategy is to write tests around mutating methods. And boy am I glad that I already had an aversion for mutability.

  8. 0.2.15 is out and includes a new tool that I’ve wanted for so long: `uv pip tree` displays the whole dependency tree in your current virtualenv !

    pypi.org/project/deptree/ Already implemented this but it's much more convenient to have a version of this tool that doesn’t actively “pollute" the environment it’s meant to display.

    kudos to @charliermarsh and team 🎉

    github.com/astral-sh/uv/releas

  9. Today I'm celebrating my first can-of-worms bug (a bug that’s discovered while fixing another bug) in ! 🎉

    It’s a bit paradoxical: these situations are not exactly pleasant to work through, but I find that it’s actually a signal of extreme that it’s only happening *now*, after two months on the job just tracking down ! 🪲

  10. I wonder what ’s plan is to handle the transition to 2.0 (expected to land about a month from now). My guess is that all build-time dependent packages will probably need to be rebuilt ? I don’t really know who/where to ask about this, so any help would be welcome !

    (If Numpy 2.0 is news to you and makes you nervous I suggest reading github.com/numpy/numpy/issues/)

  11. New bio !
    This week was my last as a researcher, and starting tomorrow I'll work as a contractual research software engineer for the project !
    I am thrilled about onboarding this thriving community and excited that fixing bugs is now my job instead a distraction from it !