r/Python 5d ago

Daily Thread Sunday Daily Thread: What's everyone working on this week?

Weekly Thread: What's Everyone Working On This Week? ๐Ÿ› ๏ธ

Hello /r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!

How it Works:

  1. Show & Tell: Share your current projects, completed works, or future ideas.
  2. Discuss: Get feedback, find collaborators, or just chat about your project.
  3. Inspire: Your project might inspire someone else, just as you might get inspired here.

Guidelines:

  • Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
  • Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.

Example Shares:

  1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
  2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
  3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!

Let's build and grow together! Share your journey and learn from others. Happy coding! ๐ŸŒŸ

12 Upvotes

10 comments sorted by

7

u/Chuyito 5d ago

My python code does about 6 billion updates/inserts per day to a mysql across 500 k8s pods.

My dba just proved to me that some of the critical inserts take less than a millisecond via sql editors, but take 10 milliseconds via python's mysql-connector-python. The sql workbench is also on a 1gb NIC whereas my python is on 2.5G NICs.

  • Connection pooling didn't make any noticeable difference.
  • Reusing a single long lived connection per pod saved about 0.5ms down to 9.5ms, but nowhere near workbench speeds.

So... I suppose my next bet is to figure out if prepared statements from Python do any magic

4

u/zby 5d ago

Working on an basic LLM observability and debugging tool with local storage: https://github.com/zby/llm_recorder/

I use it mostly for replaying interactions with LLM when debugging, sometimes after modifying them.

3

u/q-rka 4d ago

I plan to finish Advent of Code. But too lazy.

3

u/LuckyHuckleberry9285 3d ago

I've taken it upon myself to make/create a social media app for the ground up, didn't have a real grasp of python so I figured this was a good approach. I started from no knowledge 2 months ago using custom tkinter. Pymongo and Flask. Kinda learning Frontend, Backend, and API stuff. Just since today I dropped custom tkinter for pyside6 and it's just beautiful. I'm a learn thru doer, and I honestly think I've had massive growth since starting this

2

u/reckless_commenter 1d ago edited 1d ago

tkinter is a trap. It's presented as a lightweight, convenient, universally-available UI library. In reality, it's incredibly poorly written, totally unintuitive, buggy as hell, and doesn't even run everywhere since MacOS has been shipping completely broken versions of tkinter.

I'm not surprised that pyside is better because literally everything is better than tkinter.

If you tire of pyside and want to try something else, other options exist. If you'd writing a windowed app for Xwindows / Wayland, PyQt is the standard recommendation - very well-developed, very rich, looks nice. If OTOH you're developing graphics for a full-screen game or terminal-mode context like a kiosk, PyGame is a great choice.

2

u/poopatroopa3 5d ago

Bored, solving Codewars problems. Let me know if anyone needs help.

2

u/OnionNeither5274 4d ago

A few things going on this week - improving the performance of our trading systems at work to handle higher volume (weโ€™re not doing the sorts of numbers where language matters.. yet. Although I have a feeling we will be doing those kind of volumes within the next two years or so) & upgrading an ancient django project from v2 to v5

2

u/reckless_commenter 1d ago

I've spent the past few months working on a portable, fully self-contained LLM: taking a Raspberry Pi 5, putting ollama and whisper on it, and designing an end-to-end pipeline of voice recording, transcription, LLM querying, and spoken output via espeak-ng, all executed by a back-end process on some cores while presenting a nice, responsive PyGame UI on other cores.

It's been a long slog through ghoulish technical issues, especially finding a way to power the Raspberry Pi 5 with a clean 5.1V/5A power source that doesn't dip into undervoltage at full load. Secondarily, I've run into a bunch of issues with the basics of sound recording through sounddevice / soundfile / pulseaudio / alsa that have made me come to loathe the underdeveloped, buggy sound infrastructure.

(Fun fact: OpenAI whisper can transcribe audio files stored in the file system. If you don't want to bother with the file system, you can record to a BytesIO stream and pass that to whisper... but only if it's 16kbps, which is an unstated limitation of parsing in-memory data but not for ordinary WAV files written to the file system. The error messages won't indicate that, though - they complain about the array containing a numpy float dtype that doesn't match a numpy float32 dtype in another array. Also, pulseaudio refuses to record at 16kbps. Also also, downsampling an in-memory numpy array from 44.1khz to 16kbps turns out to be surprisingly difficult, even with scipy. I blew four hours on all of that before deleting it all and just writing the fucking wav file to the file system and immediately re-reading it.)

Anyway, I'm pleased to report complete success - after one more long night of coding, I finally have a fully working portable LLM. Now I get to experiment with different ollama models, system prompts, RAG, and other fun features. It's been a hell of a slog, but it finally paid off.

1

u/andrewthetechie 18h ago

re: powering the pi, check this out https://forums.raspberrypi.com/viewtopic.php?t=357129

I've found it a lot easier to find a reliable 5v supply that's not USB and then crimp on some dupont headers. You want something that can do at least 5a. https://www.digikey.com/en/products/detail/mean-well-usa-inc/RS-25-5/7706180?gQT=1 is a good option

For writing your wavs, what if you write them to a tmpfs in memory? That would save you wear and tear on your SD card and be much faster