#TIL today is the 9th year anniversary of Mastodon’s first post
TIL about the bulk import functionality in django-import-export library.
https://django-import-export.readthedocs.io/en/latest/bulk_import.html
Some caveats:
- set `batch_size` for better performance
- doesn't work with many-to-many relationships
- no `pre_save` and `post_save` signals sent (it' doesn't call `model.save()`)
That was a tricky one! If you have a complex raw SQL running in Django, you need to have a "primary key" added to the result (even if it doesn't make sense). I was selecting from a CTE, so I didn't have a primery key. Discovered that if I add `SELECT 1 AS id,` in the beggining of my query, Django is happy and everything works fine!
#TIL how to setup a Trusted Publisher on PyPI, so continuous integration tools (Github, Gitlab, etc) can easily push #python releases to PyPI without needing to generate and store secrets.
* https://docs.pypi.org/trusted-publishers/
* https://medium.com/@blackary/publishing-a-python-package-from-github-to-pypi-in-2024-a6fb8635d45d
I guess it has been around for a bit, but it was new to me...
PS. and `uv build; uv publish` is all that's needed.
TIL: uv --script
https://natknight.xyz/til-uv-script
💡 Wagtail tip: Need to fetch blocks by name in a #StreamBlock? Instead of iterating manually, use block_by_name.
I wrote a quick TIL on how to get the first block by name efficiently:
🔗 https://til.sanyamkhurana.com/#/topics/wagtail/get-blocks-in-streamblock-using-blocks-by-name-first-block-by-name
💡 #TIL: Enable Automatic Inline Annotations in PR using Ruff in GitHub Actions
Want to see linting issues directly in your PR instead of digging through logs? 🕵️♂️ With Ruff and GitHub Actions, you can enable automatic inline annotations, making it easier to spot and fix issues.
Check out the full guide here: 🔗 https://til.sanyamkhurana.com/#/topics/github-actions/enable-automatic-inline-annotations-in-pr-using-ruff
Random TIL 1
Coal can be classified by its "rank", which measures carbon content and heating value. In descending rank, the rocks are called Anthracite, Bituminous, Subbituminous and Lignite (from lat. lignum = wood). Generally, the deeper, the higher the rank (Hilt's law).
Today I learned #TIL: "How to fix VirtualBox on Fedora 40 with Kernel 6.12+"
👉 https://foosel.net/til/how-to-fix-virtualbox-on-fedora-40-with-kernel-612/
TIL: Python package metadata has at least 4 different representations
https://yossarian.net/til/post/python-package-metadata-has-at-least-4-different-representations/
Today I learned that uvx is an alias to uv tool run. As I wanted behavior similar to pipx install <something> the thing was to use uv tool install <something>
I often use the Solarized colour palette (always dark) in my editors and terminal windows, it is easy for the eyes, and I can work for many hours without being tired. I didn't know there is a history and methodology behind it.
👀 #TIL Monopoly wasn't invented by the Parker Brothers, nor the man they gave it credit for. In 1904, Monopoly was originally called The Landlord's Game, and was invented by a radical woman. Elizabeth Magie's original game had not one, but two sets of rules to choose from.
One was called "Prosperity", where every player won money anytime another gained a property. And the game was won by everyone playing only when the person with the least doubled their resources. A game of collaboration and social good.
The second set of rules was called "Monopoly", where players succeeded by taking properties and rent from those with less luck rolling the dice. The winner was the person who used their power to eliminate everyone else.
Magie's mission was to teach us how different we feel when playing Prosperity vs Monopoly, hoping that it would one day change national policies.
When the Parker Bros adopted the game, they erased the "Prosperity" rules and celebrated "Monopoly".
#ElizabethMagie #Monopoly #Landlord
HT Tumblr.com/soberscientistlife
#TIL that #Thunderbird lets me set #filters to move an #email to a particular place *when* I archive it, rather than immediately! So I can still read the emails as they come in, and then hit "archive" to have them automagically filed away 📁️
There are other triggers too, besides "as soon as the email comes in" and "when I archive" that I haven't explored yet. Thunderbird rocks! ✨️
https://blog.thunderbird.net/2024/11/maximize-your-day-make-important-messages-stand-out/
#TIL conda 25.1.1 has access to a #Python 3.13.2 runtime, but doesn't support installing it into conda base. I wouldn't wory too much as long long as the conda packages are kept up to date with a periodic `conda update --all` but the #semver failure bugs me. I expect minor & patch versions to be backwards-compatible.
I'm sure the reason is library dependencies, but that just begs the question. Do any #Pythonistas know why conda's base doesn't support the current stable runtime?
First time I had to use a parameterized fixture in pytest. That is such a handy feature right now, as I have to run my test suite with Tailwind CSS 3.x and 4.x.
https://docs.pytest.org/en/latest/how-to/fixtures.html#parametrizing-fixtures
Another day studying SQL and I discovered today a keyword that I really know nothing about! LATERAL
It appears to be something very useful to keep my queries shorter and more readable!
TIL: GitHub Actions is surprisingly case-insensitive
https://yossarian.net/til/post/github-actions-is-surprisingly-case-insensitive/
#TIL that ustwo games released Monument Valley 3, a sequel to one of my favorite mobile games.