social.dk-libre.fr is a Fediverse instance that uses the ActivityPub protocol. In other words, users at this host can communicate with people that use software like Mastodon, Pleroma, Friendica, etc. all around the world.
This server runs the snac software and there is no automatic sign-up process.
Python Tip #272 (of 365):
Do something or return something, but not both.
The list sort method returns None:
>>> numbers = [4, 2, 7, 1, 5]
>>> x = numbers.sort()
>>> print(x)
None
>>> numbers
[1, 2, 4, 5, 7]
The sort method modifies the list IN PLACE: mutating the list is its purpose.
Returning nothing indicates that an action happened.
append, extend, update, and most other mutating methods/functions follow this convention.
🧵 (1/3)
Python Tip #273 (of 365):
Avoid needless wrapper functions.
This lambda does nothing but call len:
sorted(words, key=lambda s: len(s))
So pass len itself:
sorted(words, key=len)
🧵 (1/4)
🐍🚀 Out now!
pepotron:
Open multiple PEPs like `pep 745 790`
Replace ghapi with urllib3
https://github.com/hugovk/pepotron/releases/tag/1.8.0
linkotron:
If no input given on CLI, read from clipboard
https://github.com/hugovk/linkotron/releases/tag/0.8.0
norwegianblue:
Show cycle name in EOL colour
https://github.com/hugovk/norwegianblue/releases/tag/0.26.0
pylast:
Only retry transient network failures
https://github.com/pylast/pylast/releases/tag/7.2.0
all of them:
Drop support for almost-EOL Python 3.10
https://devguide.python.org/versions/
#Python #release #norwegianblue #linkotron #pepotron #pylast #python310
Just released: humanize 4.13.0! 🚀
🤖 Optimise `naturalsize` algorithm by using `math.log`
🤖 Fix `precisedelta` rounding
https://github.com/python-humanize/humanize/releases/tag/4.13.0
#Python #humanize #release
Just released! 🚀
After one sequential-only CI failure, two artifacts builds, one GitHub outage, two fixes for the Windows installer build, four Windows builds, and a NuGet outage:
🐍 Python 3.15 alpha 2!
🔬 PEP 799: A new high-frequency statistical sampling profiler
💬 PEP 686: Python now uses UTF-8 as the default encoding
🌊 PEP 782: A new PyBytesWriter C API to create a Python bytes object
⚠️ Better error messages
https://discuss.python.org/t/python-3-15-0a2/104948?u=hugovk
Just released! 🚀
🎶 pylast 7.0.0
🎤 A #Python interface to @lastfm and Libre.fm
🗑️ Remove `SCROBBLE_SOURCE_*` and `SCROBBLE_MODE_*` constants. Last used in 2017, you probably weren't using them
📻 Add `chosen_by_user` parameter to `scrobble`. Set to false if you don't have "direct" control over the source, like radio or a stream.
🐍 Add support for Python 3.15
📼 Test against recorded API instead of live
🦀 Replace pre-commit with prek
Thanks to @scy!
https://github.com/pylast/pylast/releases/tag/7.0.0
#release #LastFM
Just released! 🚀🐍
Python 3.14.1
Waiting for the .1 to upgrade? This one's especially for you!
🥧 Deferred type annotation evaluation!
🥧 T-strings!
🥧 Zstandard!
🥧 Syntax highlighting in the REPL!
🥧 Colour in unittest, argparse, json and calendar CLIs!
🥧 UUID v6-8!
🥧 And much more!
https://discuss.python.org/t/python-3-14-1-is-now-available/105163
Just released! 🚀🐍
Python 3.14.2 (and 3.13.11)
Waiting for the .2 to upgrade? This one's especially for you!
So soon? We found some regressions, so here’s an expedited pair of releases. They also come with bonus security fixes.
https://discuss.python.org/t/python-3-14-2-and-3-13-11-are-now-available/105214?u=hugovk
Just released! 🚀
Python Docs Sphinx Theme
This is the theme for the Python documentation (and others)
* Add support for green, red and yellow side borders for code examples
* Add Portuguese translation
* Add support for Python 3.15
https://github.com/python/python-docs-theme/releases/tag/2025.12
Just released! 🚀
🐍 Python 3.15 alpha 3!
https://discuss.python.org/t/python-3-15-0-alpha-3/105325?u=hugovk
🔬 PEP 799: A new high-frequency statistical sampling profiler and dedicated profiling package
💬 PEP 686: Python now uses UTF-8 as the default encoding
🌊 PEP 782: A new PyBytesWriter C API to create a Python bytes object
🎨 Colour code snippets in argparse help: https://bsky.app/profile/savannah.dev/post/3m7svdqdeqs2x
⚠️ Better error messages
#Python #Python315 #CPython #release #PEP799 #PEP686 #PEP782 #argparse
Just released! 🚀
🤖 Humanize 4.15.0
This does stuff like turning a number into a fuzzy human-readable duration ("3 minutes ago")
https://github.com/python-humanize/humanize/releases/tag/4.15.0
* Add locale support for decimal separator in `intword`
* Add support for Python 3.15
* `naturaldelta`: round the value to nearest unit that makes sense
* Fix plural form for `intword` and improve performance
* Replace `Exception` with more specific `FileNotFoundError`
* Replace pre-commit with prek
Just released! 🚀
stravavis 0.6.0: create visualisations of Strava activities
* add option to select visualisations/allow --bbox as file/support 3.13-3.14/drop 3.9
https://github.com/marcusvolz/strava_py/releases/tag/v0.6.0
termcolor 3.3.0: ANSI formatting for the terminal
* add italic/fix error handling
https://github.com/termcolor/termcolor/releases/tag/3.3.0
pylast 7.0.1: A Python interface to Last.fm
* fix type hints
Just released! 🚀
pypistats 1.12.0
CLI for PyPI download stats
support 3.15
drop 3.9
improve verbose output
declare type hints
replace dateutil+six dependencies with stdlib
replace httpx with urllib
replace pre-commit with prek
Just released! 🚀
norwegianblue 0.24.0
CLI to show end-of-life dates
show spinner when querying
support 3.15
replace dateutil+six dependencies with stdlib
replace httpx with urllib3
replace pre-commit with prek
🐍🚀 Out now: Python 3.15 beta 1!
🧊 This is the feature freeze, and now it's *your* turn to test out all the amazing things we've been baking for the past 12 months!
💤 Lazy imports!
🧊 frozendict builtin!
💂 sentinel builtin!
📉 Tachyon profiler!
🖼️ Frame pointers everywhere!
🧳 Unpacking in comprehensions!
8️⃣ UTF-8 default encoding!
🆕 Startup config files!
⌨️ Loadsa typing!
🎨 More colour!
https://discuss.python.org/t/python-3-15-0-beta-1-is-here/107231
Please report bugs, we'll fix for the big October release.
🐍🚀 Out now: Python 3.14.5 final!
♻️ This now has the new (old) garbage collector, and the official macOS installer has been updated to use Tcl/Tk 9.0.3 instead of 8.6.17.
https://discuss.python.org/t/python-3-14-5-is-here-with-a-new-old-garbage-collector/107304
Today I (Re-)Learned about the `sep` and `end` parameters to Python’s `print`.
`end=‘’` is useful to allow `print`statements not to add a newline. But you can also use it to add something else instead. That makes more sense if you also consider that…
`sep=` allows you to have a separator. For instance, you can print a list vertically with `sep=‘\n’`:
`print(*range(1,10), sep=‘\n’, end=‘’)`
The `*` before `range` expands the content of `range` into multiple arguments to `print`.
And a couple more parameters whose defaults are often OK, but also is good to know about:
`flush` défaults to `False`, but using `print(flush=True)` can help get quicker output from a Python script before waiting for automatic flushing of standard out.
And `file` defaults to `sys.stdout`, but you might want to use something like `print(“Error or debug info”,file=sys.stderr)` to print to the standard error stream, so that if you pipe stdout somewhere else, you still get the stderr messages (or redirect them separately). Of course, you can also have that file-like object passed from elsewhere.
#TIL #TIRL #TodayILearned #TodayIRelearned #Python #PythonPrint
Python Tip #271 (of 365):
Return, don't print.
If your function only seems to "work" in the REPL, it may be printing when it should be RETURNING.
The print function "outputs" to the TERMINAL.
The return statement "outputs" to the code that called your function.
The Python REPL blurs this distinction by printing every non-None return value:
>>> nth_fibonacci(20)
6765
Was that printed, or returned? It's unclear.
🧵 (1/3)
📣 Join me on Thursday, 8th October, in Lisbon for a small software engineering meetup!
Looking forward to meeting more folks out there.
https://adamj.eu/tech/2026/09/28/python-mini-meetup-lisbon/
#SoftwareEngineering #Python #Django #Lisbon #Lisboa #Portugal
“It has nothing to do with binary numbers or ones and zeroes.”
Read more 👉 https://pym.dev/binary-search/
After all, a recent version of Ruff (fast Python linter written in Rust) imported in Debian unstable repository #Debian #Python https://tracker.debian.org/pkg/ruff
What's New in Python 3.15:
🌊 wave 🌊
* Added support for IEEE floating-point WAVE audio (WAVE_FORMAT_IEEE_FLOAT) in wave.
* Added Wave_read.getformat(), Wave_write.getformat(), and Wave_write.setformat() for explicit frame format handling.
* Wave_write.setparams() accepts both 7-item tuples including format and 6-item tuples for backwards compatibility (defaulting to WAVE_FORMAT_PCM).
Why Innsbruck? 🏔️
Because a DjangoCon should come with a pretty great backdrop.
✨ A beautiful historic city
🏔️ The Alps right outside your door
🚋 Easy to get around
☕ Plenty of places to meet, chat and recharge
💻 And, of course, a whole community of Django people coming together
Ready to discover Innsbruck with us?
Python Tip #270 (of 365):
Move and copy files with pathlib.
In Python 3.14, Path objects gained move and copy methods, and copy works on whole directories:
>>> from pathlib import Path
>>> taxes = Path("taxes")
>>> taxes.copy("taxes-backup")
PosixPath('taxes-backup')
🧵 (1/3)
“The reproducibility of pseudorandom numbers is useful for automated tests and for debugging.”
Read more 👉 https://pym.dev/random-numbers/
Make sure to compile your wheel dependencies with -O2 to get 2-3x speedup for free! 🚀
multibuild's defaults now also include -O2, so if you use that, update.
https://github.com/python-pillow/Pillow/pull/10060
#Python #PythonPillow #Pillow
@carlton @djangomed @judy2k I’m glad a) there are still people caring about new #Python packages and b) see the to-me obvious value in this. Lots of empty stares. 😅
What's New in Python 3.15:
unicodedata
* Unicode database updated to v17
* New iter_graphemes() iterates over grapheme clusters (UAX #29); grapheme_cluster_break(), indic_conjunct_break() & extended_pictographic() give character properties
* New isxidstart()/isxidcontinue() check UAX #31 identifier characters
* New block() returns a character's Unicode block
(Contributed by @stanfromireland, Serhiy Storchaka & Guillaume Sanchez)
Python Tip #269 (of 365):
Walk directory trees with Path.walk.
The walk method (Python 3.12+) is the pathlib version of os.walk:
>>> taxes = Path("taxes")
>>> for directory, sub_directories, files in taxes.walk():
... print(directory, sub_directories, files)
...
taxes ['archived', '2026'] []
taxes/archived ['2017'] []
taxes/archived/2017 ['invoices'] []
taxes/archived/2017/invoices [] ['soylent.pdf']
taxes/2026 [] ['expenses.csv', 'dividends.csv']
🧵 (1/3)
What's New in Python 3.15:
collections
* Added collections.Counter.__xor__() and collections.Counter.__ixor__() to compute the symmetric difference between Counter objects. (Contributed by Raymond Hettinger.)
“When exactly parentheses improve readability is a bit fuzzy and it's definitely subjective.”
Read more 👉 https://pym.dev/unnecessary-parentheses/
Python Tip #268 (of 365):
Show relative paths with relative_to.
Absolute paths are noisy:
>>> print(path)
/home/trey/taxes/archived/2017/invoices
>>> taxes
PosixPath('/home/trey/taxes')
>>> print(path.relative_to(taxes))
archived/2017/invoices
🧵 (1/3)
📰 Issue 356: New technical governance approved for Django
https://django-news.com/archive/issue-356-new-technical-governance-approved/
“A queue is often called a FIFO data structure: first in, first out.”
Read more 👉 https://pym.dev/stacks-and-queues/
New post: A master class in decorators, patching and tracing.
Seventy free, hands-on workshops. Start with decorators using only the Python standard library, move on to decorators, monkey patching and object proxies with wrapt, then finish with patching, testing and tracing using wrapture.
Run them on Binder, in Codespaces, or in your browser. Nothing to install.
https://grahamdumpleton.me/posts/2026/09/a-master-class-in-decorators-patching-and-tracing/
“If an object quacks like a duck, it may be used as if it's a duck.”
Read more 👉 https://pym.dev/all-iteration-is-the-same/
Python Tip #267 (of 365):
Change file extensions with with_suffix.
A ".rst" file path that needs to turn into a ".md" file path:
>>> from pathlib import Path
>>> old_path = Path("/home/trey/projects/uvrs/readme.rst")
>>> old_path.with_suffix(".md")
PosixPath('/home/trey/projects/uvrs/readme.md')
🧵 (1/4)
I'm looking for work, please boost!
I'm a software engineer with 35 years of experience. I've worked across an unusually wide range of domains: mobile game backends, privacy-preserving data platforms, high-throughput COVID testing infrastructure, email and account systems, e-payment processing, job marketplace systems, and bioinformatics. I pick up new domains quickly and have a history of doing it repeatedly. I understand how to turn business needs into engineering requirements.
I prefer to work remotely but I am open to an in-office job in the Philadelphia area or especially in Philadelphia itself. I've often worked remotely since the 1990s and can operate with minimal supervision. Several of my favorite projects were self-directed: I identified the need, built the thing, and shipped it. My preferred time zone is America/New_York, but I'm flexible.
Some of the many, many technologies I've used are: Python, Perl, TypeScript/JavaScript, Haskell, Go, C, Java. Postgres, MySQL, SQLite. Flask, SQLAlchemy. AWS (Lambda, S3, RDS, SQS, EC2). Docker, Git. Github and Gitlab.
I've also repeatedly picked up new languages and stacks as needed: Haskell for differential privacy research, TypeScript for a 24/7 AWS Lambda system, Flask for my most recent employer. I've become productive with new systems over and over, and I can do it quickly.
I'm a published author (Higher-Order Perl, Morgan Kaufmann), longtime blogger, and conference speaker with a reputation for making complex ideas clear.
I am a U.S. citizen.
My résumé is at https://
plover.com/~mjd/cv/Mark%20Jason%20Dominus.pdf
mjd@pobox.com
Thanks!
#OpenToWork #remoteWork #softwareEngineering #Python #backend #hiring
#fediHire
#getFediHired
Thanks to all the busy bees at #DjangoonTheMed DEP0021 is coming to secure your Django supply chain: https://github.com/codingjoe/deps/blob/sri/draft/0021-subresource-integrity.md
Special thanks to @mdn for working providing excellent community documentation on SRI.
What's New in Python 3.15:
unittest
* unittest.TestCase.assertLogs() will now accept a formatter to control how messages are formatted. (Contributed by Garry Cairns.)
* unittest.TestCase.assertWarns() and unittest.TestCase.assertWarnsRegex() no longer swallow warnings that do not match the specified category or regex. Nested context managers are now supported. (Contributed by Serhiy Storchaka.)
Keep in mind that because the loops in a comprehension must be in the same order as equivalent for loops, it does read a little funny.
Read more 👉 https://trey.io/aeo9fg
Python Tip #266 (of 365):
Reread a file with seek(0).
Try to .read() a file twice, and you'll get nothing the second time:
>>> f = open("my_file.txt")
>>> f.read()
'This is my file 👋\nThis is line 2\n'
>>> f.read()
''
Python keeps track of your position within a file as you read.
When you're at the end, another read returns an empty string.
The seek method changes that position.
🧵 (1/2)
What's New in Python 3.15:
pdb
* Use the new interactive shell as the default input shell for pdb. (Contributed by Tian Gao.)
@dolanor No, it's still pip if you want to use pip. Or conda if you want to use conda. But there are other options for people who have a reason to use them or just prefer something different.
If anyone is telling you that you shouldn't be using pip (or, I imagine, conda) anymore, that it's deprecated or disfavored or obsolete or "on its way out" or anything of that nature, they don't know what they're talking about and you shouldn't listen.
Seems like there's a heightened number of PyPI CDN Edge Errors at the moment, and the PyPI web UI is failing at login and search for me.
“For true randomness, you can use the secrets module, which generates cryptographically secure random numbers.”
Read more 👉 https://pym.dev/random-numbers/
Tonight we had dinner together with members of @pescara and @djangomed participants who just arrived in Pescara 🍕
A nice way to meet up over dinner by the beach, catching up with old friends and meeting new ones. 🍻
And now we’re ready: Django on the Med 2026 starts tomorrow morning! 🏖️
📅 Applications close at the end of Tuesday (**today**), September 22, 2026, anywhere on Earth (AoE).
Want to be our first Django Software Foundation Executive Director and lead our foundation? It's your last call to apply!
https://www.djangoproject.com/weblog/2026/sep/16/executive-director-search-extended/
One week until Python 3.15.0 final!!
https://hugovk.dev/next-release/
What are you most looking forward to?
https://docs.python.org/3.15/whatsnew/3.15.html
Python Tip #265 (of 365):
Use next() to get the first line in a file.
Reading a CSV file and need to skip the first row of headers?
Pass your file object (or csv.reader object) to the built-in next function:
headers = next(reader)
File objects keep track of your position within an open file, so the next time you read (or loop) you'll start up where you left off.
🧵 (1/3)
PSF Diversity & Inclusion Workgroup के Monthly Office Hours अगले हफ्ते PSF Discord पर! September 29th 1PM UTC को #psf-diversity में जुड़ें। बातचीत करें, सवाल पूछें और Python में अपने projects, open source contributions या learning journey शेयर करें! 🐍🌍 #Python
https://pyfound.blogspot.com/2026/07/the-psf-d-workgroup-are-starting-office.html
The PSF Diversity & Inclusion Workgroup monthly office hours are next week on the PSF Discord! Join us on September 29th 1PM UTC in #psf-diversity to chat, ask questions, and share what you're working on 🐍🗺️ #Python
https://pyfound.blogspot.com/2026/07/the-psf-d-workgroup-are-starting-office.html
And @akx has updated the Babel project's security policy in a similar way:
I had my little agent friend whip up a trust-me-bro #benchmark for Django task frameworks.
Happy to see my human coding skills are still worth something.
“To navigate block-by-block, you can use Ctrl+P to go to the previous block and Ctrl+N to go to the next block.”
Read more 👉 https://pym.dev/repl-features/
The last mile of a long road: faster NumPy in the browser https://lobste.rs/s/zakub6 #python
https://notebook.link/blog/the-last-mile-faster-numpy
Python Tip #264 (of 365):
Don't use the file readlines method.
Do this:
lines = list(file)
Not this:
lines = file.readlines()
Both give the same list of lines. So why prefer list?
Files are iterables of lines, and list(...) is THE way to say "loop over this iterable and store the results in a new list".
With file.readlines(), it's not as obvious that we're making a list.
🧵 (1/2)
RE: https://fosstodon.org/@mattip/117302818665471015
Oh, welcome back PyPy 👋
PyPy 8.0.0 is out with Python 3.12 support, so it looks like Django can finally start testing against PyPy again.
Python Tip #260 (of 365):
Bookmark a date format cheat sheet.
Is "%M" month or minute? Is "%H" 12 or 24 hour time? Which one shows a long month name? And a short one?
You COULD memorize all of Python's many date/time format codes, but is that worth it?
It might be worth memorizing the formats you use all the time ("%Y-%m-%d" and "%H:%M:%S" maybe).
But for MOST formats, you can look them up when you need them.
🧵 (1/3)
What do you call __these__ in #Python?
| magic methods: | 6 |
| special methods: | 0 |
| dunder methods: | 61 |
| show results: | 1 |
Closed
Python Tip #263 (of 365):
Parse messy dates with the third-party dateutil library.
Its parse function guesses the format from the string itself:
>>> from dateutil.parser import parse
>>> parse("September 20, 2026")
datetime.datetime(2026, 9, 20, 0, 0)
>>> parse("20 Sep 2026 14:30")
datetime.datetime(2026, 9, 20, 14, 30)
>>> parse("9/20/26")
datetime.datetime(2026, 9, 20, 0, 0)
https://dateutil.readthedocs.io
🧵 (1/4)
I woke up to find my PR merged and deployed, giving https://www.python.org/blogs/ a fresh take and fixing the "Latest News" section on the homepage.
It was confusingly linking to Python Insider's homepage, even though it was only one of several data sources.
We were also only showing the latest five posts. Six if we include the top header, and I'd like to fix the spacing.
https://github.com/python/pythondotorg/pull/3092
Thank you to everyone involved.
🔧 I’m excited to host this optimization workshop in Lisbon next month.
Come join me to learn about profiling and optimizing Python code, and maybe even contribute to Django itself.
https://adamj.eu/tech/2026/09/19/python-optimization-workshop-lisbon/
“Pretty much every time I make a temporary file, I need to close the file without actually deleting it so that I can then pass the filename off to other code that actually uses the file.”
Read more 👉 https://pym.dev/temporary-files/
Python Tip #262 (of 365):
Parse dates with date.strptime.
In Python 3.14+, the date class got its own strptime class method:
>>> import datetime as dt
>>> dt.date.strptime("2026-08-19", "%Y-%m-%d")
datetime.date(2026, 8, 19)
🧵 (1/2)
Wow Python 3.7 qui tombe sous les 2 % d’utilisateurs :
https://git.afpy.org/mdk/python-versions
Oui oui c’est pas une faute de frappe, je parle bien de 3.7, pas 2.7.
(3.12 a ~34% des utilisateurs)
“Of course, at some point in your Python coding journey, you will probably find some opportunities to make classes.”
Read more 👉 https://pym.dev/friendly-classes/
📰 Issue 355: DjangoCon Europe 2027 in Innsbruck and Django Probe
https://django-news.com/archive/issue-355-djangocon-europe-2027-in-innsbruck/
Python Tip #261 (of 365):
Use Python's zoneinfo module when working with time zones.
>>> from zoneinfo import ZoneInfo
>>> pacific = ZoneInfo("America/Los_Angeles")
>>> meeting = datetime(2027, 3, 13, 9, 0, tzinfo=pacific)
>>> print(meeting)
2027-03-13 09:00:00-08:00
🧵 (1/5)
We've updated our security policy on how to report vulnerabilities:
https://github.com/python-pillow/Pillow/pull/10018
Much of this based on the good stuff in the CPython security policy:
https://devguide.python.org/security/policy/
Yesterday's 82 reports totalled 226,620 words (144,437 without code), an average of 2,764 each (1,761 without code).
Moby Dick is 212,796 words (A Tale of Two Cities is 135,886 words).
I've asked the reporter to re-run their tools and update/close as necessary.
What's New in Python 3.15:
os
* Add os.statx() on Linux kernel versions 4.11 and later with glibc versions 2.28 and later. (Contributed by Jeffrey Bosboom and @vstinner)
* os.makedirs() function now has a parent_mode parameter that allows specifying the mode for intermediate directories. This can be used to match the behavior from Python 3.6 and earlier by passing parent_mode=mode. (Contributed by Zackery Spytz and @gpshead)
New post: Writing a workshop for JupyterLab.
The second post on jupyterlab-workshop builds a small pytest workshop from nothing, covering the manifest, pages, actions that run commands and write files for the learner, checks that gate progress until the work is done, giving the workshop a Python environment of its own, and the lint and self-test that catch problems before a learner does.
https://grahamdumpleton.me/posts/2026/09/writing-a-workshop-for-jupyterlab/
“Note that the utilities in Python's random module generate pseudorandom numbers, not true random numbers.”
Read more 👉 https://pym.dev/random-numbers/
The PyLadiesCon web portal was spammed. 2,249 fake accounts created. Four months before anybody noticed. My write up and reflection about this incident.
@webology @JessicaTegner when I read grok I think about this old but active Python project I heard about for the first time long time ago from @faassen 🧌
https://pypi.org/project/grok/
✨ I plan to do a proper write-up, but @django new sponsor pages are up and highlight plans in a much easier-to-grok format. https://www.djangoproject.com/sponsor/
Shout-out to @ericholscher for driving this and pulling it all together.
@nessita for helping to prioritize it and the last mile.
Also, to our Fundraising WG (present and past) members for working on the prospectus for over a year to give us data and features to work with.
Want to test your knowledge of datetime formatting, parsing, and arithmetic in #Python?
I just made a 17-question quiz for you: https://pym.dev/quiz/datetime
A warning: it's a bit tricky, even for an experienced Python developer... partly because it DOES test your knowledge of various format codes that I wouldn't usually memorize.
If you want to get practice with the questions you get wrong afterward, you can find 3 free datetime Daily Recall packs linked at the end of the quiz.
🧵 (3/3)
Python Tip #260 (of 365):
Bookmark a date format cheat sheet.
Is "%M" month or minute? Is "%H" 12 or 24 hour time? Which one shows a long month name? And a short one?
You COULD memorize all of Python's many date/time format codes, but is that worth it?
It might be worth memorizing the formats you use all the time ("%Y-%m-%d" and "%H:%M:%S" maybe).
But for MOST formats, you can look them up when you need them.
🧵 (1/3)
@treyhunner What do you think of this idea from @bswck?
When you paste code into the REPL, it'll strip any `>>>` / `...`/ output you'd inadvertently copied.
Could be useful for learners?
https://github.com/python/cpython/issues/157612
#Python #REPL
The PSF is excited to announce the results of the 2026 election for the PSF Board! Sending a big thank you to the candidates, our outgoing Board members, and our community for participating this year- we are so grateful to be in community with all of you 💙💛 #Python
https://pyfound.blogspot.com/2026/09/announcing-2026-psf-board-election.html
The PSF is pleased to announce the results of the inaugural election for the Python Packaging Council! Sending a big thank you to the candidates and our community for participating in this long awaited election. We're excited to see the council start its work! #Python
https://pyfound.blogspot.com/2026/09/announcing-2026-python-packaging.html
I'm a software developer and sysadmin who could really use being #fedihired.
What I'd really like to do is Rust, but once you ignore the dubious scammy stuff, there seems to be nothing out there. Prove me wrong with a counterexample!
I've spent decades fixing Enterprise mudballs mostly written in #Perl. If you've got a crufty legacy system that everybody else is too scared to touch, I'm your man. I love fixing stuff like that.
I've also done commercial #Scala, #Python, #C/#C++, and although I don't usually admit it on my CV but these are now Trying Times when everything is on the table, even #PHP (the longest six months of my life).
Perl naturally leads into Unix system administration and infrastructure. I've built and maintained mail clusters, VoIP systems, network monitoring, DNS management platforms, that sort of thing. If it's non-sexy but something which needs to be done, I'm there.
Available immediately, for contract or permie, onsite in Amsterdam/Randstad or remote to anywhere.
Drop me a private mention or mail peter@mooli.net if you have or know of something.
Python Tip #259 (of 365):
Use datetime arithmetic and comparisons to check whether a date is within a range.
Sputnik launched before the moon landing:
>>> sputnik_launch = datetime(1957, 10, 4)
>>> moon_landing = datetime(1969, 7, 20)
>>> sputnik_launch < moon_landing
True
One datetime is "less than" another when it represents an earlier moment in time.
🧵 (1/3)
New blog post introducing jupyterlab-workshop, a JupyterLab extension I wrote for guided interactive workshops.
Instructions sit in a side panel. Each step is a clickable action that does something real in the JupyterLab session beside it, and the workshop checks what you did before you move on. A workshop is a directory of Markdown files and runs wherever JupyterLab does: mybinder, Codespaces, and even JupyterLite in the browser.
https://grahamdumpleton.me/posts/2026/09/introducing-jupyterlab-workshop/
Oohh, Daksh's Django Commons lightning talk from @europython is published 🥳
https://www.youtube.com/watch?v=cNkCy7a41xQ&t=2107s
If you're maintaining a #Python or #Django package and would like to make a community package, there's a home for you.
🧪 I just released unittest-parametrize 1.9.0.
This package helps you make parametrized tests that work with the grain of unittest, but can still be run with pytest.
This release adds new skip/expected_failure features, fixes a bug when using Coverage.py's dynamic contexts, and tidies up error messages and usage docs.
https://github.com/adamchainz/unittest-parametrize/blob/main/CHANGELOG.rst
“The syntax for adding a new key-value pair to a dictionary is actually the same as the syntax for updating the value for an existing key.”
Read more 👉 https://pym.dev/using-dictionaries-in-python/
“The last plate that's added to the top of the stack will be the first plate removed from the top of the stack.”
Read more 👉 https://pym.dev/stacks-and-queues/
Python Tip #258 (of 365):
Format dates with f-strings.
datetime objects support the same format codes in f-string format specifiers that the strftime method uses:
>>> deadline = datetime(2046, 10, 31, 15, 46)
>>> f"{deadline:%m/%d/%Y %I:%M %p}"
'10/31/2046 03:46 PM'
🧵 (1/3)
Strings in Python have a startswith method that will check whether a given string is a prefix of our string
Read more 👉 https://trey.io/dley4p
Python Tip #257 (of 365):
Consider "import datetime as dt".
The fact that the datetime module and the datetime class are spelled the same way is VERY confusing.
You could use a "from" import:
from datetime import datetime
Now datetime means the class.
But if later on you also want the date class, you're importing that name too, and hoping no local date variable ever shadows it. I definitely use the variable name date, so this is a problem for me.
🧵 (1/3)
Hey #Python devs,
Remember when Pillow took over PIL's space?
Do we have that for the requests + httpx + httpx2 space yet?
I have hit my point where having all three installed spark no joy for me.
I don't even care who wins or loses this package off, but I do not need all three installed, and I'll keep my personal preference to myself.
Thid party packages are very opinioned which is why I have all three. I do not want or need all three.
What's the solution?
The next #PyData #Helsinki #meetup is on Tuesday 22 September at Reaktor, Yliopistonkatu 4.
We'll hear about building a super 8 film scanner at home, how to actually get an intuition for survival models, and what happens when you let a reinforcement learning agent loose on the Pokémon TCG. Plus a lightning talk, snacks, drinks and another round of the (in)famous PyData Helsinki quiz!
Sign up now!
https://pydata-helsinki.fi/events/2026-09-22-reaktor/?utm_source=fediverse
#Python
Another week another #Django package 🎉
📣📣 ATTN PSF Voting Members: The 2026 PSF Board election vote closes tomorrow, September 15th- but don't wait, go vote today! If you affirmed your intention to vote in this year's election or voted last year, check your email for voting instructions 🗳️ #Python https://pyfound.blogspot.com/2026/09/the-2026-psf-board-election-is-open.html
We're deprecating and removing the IM ("IFUNC Image Memory") image format from @pillow. We're doing this with a two-year deprecation rather than the usual one-year.
https://pillow.readthedocs.io/en/latest/deprecations.html#im-image-format
If you need it, please let us know! But unless you're calculating molecular sizes of DNA restriction fragments in Linköping, Sweden in the 1990s, probably not. 🐍🧬
https://github.com/python-pillow/Pillow/pull/9849#pullrequestreview-5167307282
We may deprecate some of the other obscure plugins.
https://github.com/python-pillow/Pillow/issues/9101#issuecomment-4134756068
Python Tip #256 (of 365):
Avoid circular imports by decoupling your modules.
Two modules that import each other will break.
In users.models:
from .tasks import send_welcome_email
And in users.tasks:
from .models import User
ImportError: cannot import name 'User' from partially initialized module 'users.models' (most likely due to a circular import)
🧵 (1/3)
Are developer workshops still relevant when anyone can ask an AI? A write-up of my PyCon AU 2026 talk.
Reading and doing are different things, and AI hasn't touched the doing. AI makes workshop content correct, but not teachable. And the self-serve end is the part under pressure, which raises the question of why I released 24 free wrapture workshops anyway.
https://grahamdumpleton.me/posts/2026/09/hands-on-learning-in-the-age-of-ai/
“That allows for the practice of goose typing, meaning practicing duck typing with the built-in isinstance function.”
Read more 👉 https://pym.dev/goose-typing/
What's New in Python 3.15:
shelve
* Added new reorganize() method to shelve used to recover unused free space previously occupied by deleted entries. (Contributed by Andrea Oliveri.)
* Add support for custom serialization and deserialization functions in the shelve module. (Contributed by @furkanonder.bsky.social.)
I had an idea that was vaguely inspired by the #linkdump s that the #indieweb is fond of, and by @hyde posting a little snippet about how to export open browser tabs to a text file.
I made a silly thing that didn't need making that logs and graphs how many open browser tabs I have.
A tiny bit of #python, a little bit of #bash and a cron job, and some #d3js
https://tlohde.com/open-tabs/
#LookWhatIMade #JustBrowsing #blog
I added `picows` support to the UNICORN Binance WebSocket API.
The benchmark started as a simple library comparison and ended up improving UBWA itself too.
Results:
⚡ up to **2× throughput** on small Binance messages
🧠 about **26% lower average CPU usage**
📨 **138M+ live messages** per implementation
✅ no picows-specific stalls or unrecoverable streams in the 24h soak
`websockets` still remains the default for now.
Why?
Because 24 hours and 138 million messages are strong evidence, but they are not the same as months of production use across many different systems.
So picows is opt-in until broader real-world usage proves it further.
Full benchmark, bugs found, proxy changes and reasoning:
#Python #PythonDev #WebSockets #WebSocket #Asyncio #Performance #Benchmark #Optimization #OpenSource #FOSS #Linux #Backend #BackendDevelopment #Networking #Trading #AlgoTrading #CryptoTrading #Binance #FinTech #DevOps #Programming #Cython #HighPerformance #LowLatency
Python Tip #255 (of 365):
Declare your public API with __all__.
from math import sqrt
__all__ = ["nth_lucas", "sum_of_squares"]
phi = (1+sqrt(5))/2
def nth_lucas(n):
return round(phi**n + (-1/phi)**n)
def sum_of_squares(*nums):
return sum(n**2 for n in nums)
🧵 (1/6)
“If you find subprocess.run to be a little too verbose, you might consider writing a custom wrapper function or two for your own use cases.”
Read more 👉 https://pym.dev/running-subprocesses-in-python/
I'm seeing more and more Oepn Source project migrating to Codeberg.
I missed the Python library gallery-dl migrated a few months ago https://github.com/mikf/gallery-dl/issues/9374
I used it to download my pictures from conference repository (e.g. flickr) and it worked very well.
wrapture is now at 1.0.0b1, along with the wrapture-instrumentation, aws, postgresql and mysql packages. I am happy with the APIs, so what it needs now is people trying it on real code and reporting what works and what doesn't.
New post rounds up the ten blog posts so far, the packages and docs, plus 24 hands-on workshops you can run in your browser on mybinder with nothing to install.
https://grahamdumpleton.me/posts/2026/09/trying-out-wrapture/
Python Tip #254 (of 365):
Use a module instead of a singleton class.
When you import a module, Python creates a module object. Import it again (even under a different name) and you get THE EXACT SAME OBJECT:
>>> import events
>>> import events as again
>>> again is events
True
So instead of a class that's only ever meant to have one instance:
class EventTracker:
...
tracker = EventTracker()
More: https://pym.dev/making-singletons/
🧵 (1/2)
You mostly don't need to think about a function's enclosing scope or the think about the closure that it makes.
Read more 👉 https://trey.io/4u4pj0
L'édition 2026 de la PyConFR aura lieu à Biarritz 🌊 le week-end de la Toussaint (du jeudi 29 octobre au dimanche 1er novembre) !
La PyConFR est la conférence annuelle francophone dédiée au langage de programmation Python 🐍 et à sa communauté, entièrement gratuite car organisée par les bénévoles de l'AFPy (Association Francophone Python) avec le soutien de sponsors (voir plus bas).
L'événement se déroule donc sur 4 jours en se divisant en deux parties :
Vous trouverez plus d'informations sur la PyConFR sur le site de l'événement.
La conférence est gratuite mais l'inscription reste obligatoire, afin de nous aider à prévoir le nombre de participant·e·s et d'adapter l'événement en fonction.
Lors de votre inscription, vous pourrez aussi choisir de commander un t-shirt de l'événement (15€) et une place pour la soirée du samedi qui aura lieu à la brasserie SPOT à proximité du lieu de conférence (30€).
Inscriptions à la PyConFR 2026
Le programme des différents sprints, conférences et ateliers qui auront lieu pendant l'événement a été publié : https://www.pycon.fr/2026/fr/schedule.html.
Vous pourrez y retrouver les descriptions complètes des interventions ainsi que les biographies des orateurs et oratrices.
Les sujets sont majoritairement en français (l'association s'adresse principalement à la communauté francophone) mais une salle de conférence est réservée aux sujets en anglais pour notre public non-francophone.
L'association, dans le but d'augmenter la diversité de l'événement, fait tenir par des femmes les trois conférences plénières proposées pendant la PyConFR.
Les conférences plénières annoncées cette année sont :
Embracing Weird Code, d’Ivana Kellyer
Le rêve de tout enfant - devenir DBA ?, de Karen Jex
Être un·e allié·e du numérique pour tou·te·s en environnement hostile, de Morgane Rozenn Hauguel
L'événement existe grâce aux dons des sponsors qui permettent chaque année de couvrir les différentes dépenses liées à l'organisation (locaux, assurance, captation vidéo, boissons, bourses, etc.).
Si vous, votre entreprise ou l'un de vos contact souhaite participer au financement de cet événement, vous pouvez contacter le trésorier de l'AFPy (tresorier@afpy.org) pour discuter des modalités.
Les différents niveaux de sponsoring et les contreparties associées sont détaillées sur cette page.
Télécharger ce contenu au format EPUB
Commentaires : voir le flux Atom ouvrir dans le navigateur
The Python Steering Council election is on!
https://hugovk.dev/blog/2025/steering-council-election/
This year we have six candidates for five seats.
This chart shows when the nominations arrived: six is fewer than previous years but they didn't all wait until the last three days.
This year we're also using a new "Multi-winner Bloc STAR" voting system: you give between 0-5 stars per candidate.
If you're in the core team, remember to vote by Friday!
🗳️ I've voted in @ThePSF board election!
🗳️ And in the inaugural Packaging Council election!
🗳️ Remember to vote!
#Python #PSF #election #packaging #PackagingCouncil #vote
🗳️ I've voted!
The Python Steering Council elections are underway, and there are eight excellent candidates. We'll be in safe hands whichever five are elected.
This year we have 87 eligible core dev voters, compared to 85 last year.
https://peps.python.org/pep-8105/#candidates
https://hugovk.github.io/python-steering-council/
Edit: 🧵 Thread continued from: https://mastodon.social/@hugovk/111415531562893054
Voted in the Python Steering Council election! 🐍🗳✅
https://mastodon.social/@hugovk/115688213247426019
#PythonSteeringCouncil #Python #SteeringCouncil #vote #election
📣📣 ATTN PSF Voting Members: The inaugural Python Packaging Council election vote closes next Tuesday, September 15th- but don't wait, go vote today! If you affirmed your intention to vote, check your email for voting instructions 🗳️ #Python
https://pyfound.blogspot.com/2026/09/inaugural-python-packaging-council.html
Voting is open for the PSF Board of Directors Election until Tuesday, September 15th, 2:00PM UTC! To all our affirmed and pre-affirmed voters, make sure you check out the candidates and make some time to vote before then 🗳️ #Python https://pyfound.blogspot.com/2026/09/the-2026-psf-board-election-is-open.html
Last post in the wrapture tracing series: OpenTelemetry export.
One table in the config and the same events that printed a tree feed a backend while the application runs. Requests become SERVER spans named by route, a failing request carries the 500 and the exception the framework swallowed, and one trace id is shared by the files, the outbound headers and the exported spans, so two services join as one trace.
https://grahamdumpleton.me/posts/2026/09/opentelemetry-export-in-wrapture/
“You can store the data as attributes on each instance of your class, and you can store the functionality as methods on the class itself.”
Read more 👉 https://pym.dev/when-are-classes-used/
Python Tip #253 (of 365):
Avoid import side effects in your Python modules.
As a general rule, the top level of a module should only DEFINE things. Define functions, classes, constants and any other objects meant to be accessed after import. But don't print, prompt for input, write to files, etc.
🧵 (1/3)
If you're interested in #Python #Education and #Teaching Programming, you might be interested in this: A Reading Club going over the "Big Book of Computational Pedagogy"
In 20 minutes I'll be hosting our third week of reading, and this week we're covering "Semantic Waves" on pg46, and "Go Unplugged" on pg49.
This reading club is hosted on the Guild of Educators Discord server: https://guildofeducators.org/join_us and you're welcome to join even if you haven't read the section.
This week Guild of Educators will be covering Cognitive Load Theory
https://downloads.ctfassets.net/oshmmv7kdjgm/5I0kitx6JdV2mhA00baN5P/abf448f0660817021ffaaaa6ece509ae/Hello_World_The_Big_Book_of_Pedagogy.pdf#%5B%7B%22num%22%3A638%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22Fit%22%7D%5D
It's wonderfully short and as always, even if you haven't read the section you're welcome to join and listen in
https://guildofeducators.org/join_us#:~:text=Join%20our%20Discord%20server
It starts in just under an hour at 15:00 UTC, please join us if you're interested!
Do you know your regular expressions in Python? Do you know the unusual thing re.match() does? Or what soft deprecation is? I've written about the changes coming up in Python 3.15 to help clear things up a bit.
🐍 Check out @sethmlarson's talk at @europython 2026: "Learning from the not-so-secret Python security 'cabal'". This talk is a deep dive into how CPython handles coordinated vulnerability disclosure, how the #Python security team is organized, and what it takes to run a sustainable disclosure program. https://www.youtube.com/watch?v=Xmr89QEr720
Python Tip #252 (of 365):
Use ALL_CAPS names for module-level constants.
MAX_RETRIES = 5
DEFAULT_TIMEOUT = 30
https://pym.dev/python-doesnt-have-constants/
Python doesn't have constants. There's no keyword that stops a variable from being reassigned:
>>> MAX_RETRIES = 5
>>> MAX_RETRIES = 10
The all-caps name is purely a convention. It's a signal to readers of our code meaning "this value isn't meant to change".
🧵 (1/2)
Fourth post in the wrapture tracing series: finding slow code.
One endpoint is slow and there are three layers it could be. A stopwatch in each is a code change in a layer that should not know it is being measured; a profiler sees every frame and cannot tell one request from the next. Self time for the handful of methods you chose says which one is slow in its own right, rather than slow because of what it calls.
https://grahamdumpleton.me/posts/2026/09/finding-slow-code-with-wrapture/
“The continue statement doesn't break out of its loop; it just skips to the next iteration of the loop.”
Read more 👉 https://pym.dev/breaking-out-of-a-loop/
Voting is open for the PSF Board of Directors Election until Tuesday, September 15th, 2:00PM UTC! To all our affirmed and pre-affirmed voters, make sure you check out the candidates and make some time to vote before then 🗳️ #Python https://pyfound.blogspot.com/2026/09/the-2026-psf-board-election-is-open.html
⏳ I just released time-machine 3.5.1 with 13 bug fixes.
Two were reported by humans. The rest came from prompting Claude Fable with just "Find and fix bugs".
None of them had a huge impact (this is a test library, after all), but they were all mistakes. The worst would leave time mocked after a test tearDownClass() failure, which would be pretty hard to debug.
Crazy times. These machines can help us build the highest-quality software, if we want.
https://time-machine.readthedocs.io/en/latest/changelog.html
“Let's say we have some text that was retrieved from a database, and the original text came from a form submission in a web browser. Web browsers often represent line breaks as a carriage return character, followed by a line feed character.”
Read more 👉 https://pym.dev/splitlines/
Third post in the wrapture tracing series: tracing Flask.
A WSGI app routes the interesting facts around the return value, so a plain wrapper on it records nothing useful. One config entry naming the Flask instrumentation gives one tree per HTTP request instead, with the view, the template render and the shop's own calls beneath it, and the failing request saying both that it answered 500 and that a KeyError was why.
https://grahamdumpleton.me/posts/2026/09/tracing-flask-with-wrapture/
When OpenAI bought Astral, I feared this was a way to influence the future of #Python. Their latest blog post about Packaging Council endorsements is a clear sign in that direction.
And it's no surprise that it's the only post not written by a person ("The Astral Team").
The next @pillow release will use lazy imports on Python 3.15, meaning `from PIL import Image` with no further use takes only 10 ms instead of 25 ms! ⚡️🦥⚡️
Python Tip #251 (of 365):
Avoid wildcard imports.
Using star imports, like "from something import *", makes for fragile code.
The Zen of Python ends with "Namespaces are one honking great idea -- let's do more of those!"
Each module automatically makes a namespace, which is great: same-named variables in different modules never accidentally collide.
A wildcard import BREAKS that namespacing: "import *" dumps every name from one module into another.
🧵 (1/3)
🎙️ Check out the "Security and Ethics in the Age of Generative AI" panel from @europython 2026! The PSF's @miketheman and @sethmlarson join other awesome folks from the #Python community to dig into how generative AI is reshaping cybersecurity, from ecosystem-level risks to practical lessons to the ethics of AI. https://www.youtube.com/watch?v=4cfgbo912rg
Python Tip #250 (of 365):
Sort your import statements in a meaningful way.
The usual convention (from PEP 8): standard library first, then third-party packages, then your own code, with a blank line between each group.
import json
import secrets
from django.http import Http404, HttpResponse
from django.shortcuts import redirect
from exercises.models import Exercise
🧵 (1/3)
Second post in the wrapture tracing series: zero-code tracing.
The application you need to see inside is often one you cannot, or should not, edit. The bindings and sink move into a wrapture.toml next to the project, and the program runs untouched under python -m wrapture, or with no launcher at all through autowrapt. Also: streaming the trace to JSON Lines and asking it questions with jq.
https://grahamdumpleton.me/posts/2026/09/zero-code-tracing-with-wrapture/
“Note that passing generator expressions into iterable-accepting functions and classes makes something that looks a bit like a custom comprehension.”
Read more 👉 https://pym.dev/custom-comprehensions/
[$] CERN's migration path from CentOS Linux to Debian
The European Laboratory for Particle Physics, usually just called CERN, is not only the birthplace of the World Wide Web, it is home to the Large Hadron Collider (LHC), the world's [...]
Voting is open for the Python Packaging Council until Tuesday, September 15th, 2:00PM UTC! To all affirmed voters, make sure you check out the candidates and make some time to vote before then 🗳️ #Python https://www.python.org/nominations/elections/2026-python-packaging-council/nominees/
Python Tip #249 (of 365):
Monkey patch cautiously... and only in your automated tests.
Monkey patching means fundamentally changing how a module or class works WITHOUT editing its code, by reassigning one of its attributes at runtime.
In automated tests, monkey patching can simplify things.
🧵 (1/4)
New series on the tracing side of wrapture, starting with live tracing.
Nothing about a binding is specific to testing: it observes a call site and emits events, and what happens to them is decided by whoever is listening. Take away the timeline, register a sink, and the same three bindings from the testing series narrate the shop as it runs, declined card and all.
https://grahamdumpleton.me/posts/2026/09/live-tracing-with-wrapture/
“When looking for an element within a sorted list, binary search can be much faster than regular iteration.”
Read more 👉 https://pym.dev/binary-search/
Out of curiosity, I have asked Claude to rewrite a tiny little SSH wrapper from Python to Go and Rust to check performance.
Results:
* Python = 20ms
* Go = 3ms
* Rust = 1.5ms
It's totally useless if you have Mitogen because it opens the SSH connection once but if you don't, every single ms counts.
Python Tip #248 (of 365):
Run "pytest --pdb" to drop into PDB when a test fails.
With "--pdb", pytest starts PDB in post-mortem mode (see tip #169) as soon as a test fails or raises an exception.
I find this much nicer than sprinkling print calls through a test and re-running it.
You can inspect objects, call functions, walk up the stack, and poke at things in real time instead of re-running repeatedly.
https://mastodon.social/@treyhunner/116772494442077774
🧵 (1/3)
“The print function will automatically convert whatever object you give it to a string because it needs to be a string in order to be printed.”
Read more 👉 https://pym.dev/print-features/
I've been looking for a #WiFi networks channels analyzer app for the #Linux desktop, like those found on F-Droid (such as WiFiAnalyzer), and couldn't find one on Flathub.
Then, searching more broadly, I discovered that Daniel Nylander, oldtime Swedish translator in #GNOME, has built exactly such an app in recent months, in #Python + GTK4 + libadwaita!
I tried it out (just do "cd src/ && python app.py"), it works well.
Flatpak enthusiasts, see https://github.com/yeager/wifi-analyzer/issues/2
Peut-on utiliser l'intelligence artificielle sans vendre son âme aux GAFAM et sans livrer les données de ses auditeurs à la Silicon Valley ?
Dans son rapport d'activité 2025-2026, Radio Cause Commune détaille sa stack technique 100% libre et auto-hébergée dans le 18ᵉ arrondissement de Paris. 1/x
#OpenSource #LogicielLibre #SouverainetéNumérique #Python #SelfHosted #RadioTech #NextJS #CauseCommune
I like what Astral is doing from a tech perspective, but I'm not sure this sits right with me.
When Astral was a small company, it was one thing, but now that Astral is OpenAI, it kind of rubs me the wrong way.
Is this just me?
I'm glad they endorsed their own employee, though.
That would have been awkward AF if they didn't. 🍿
(Btw, I throw no shade on anyone from the list or who is running. I just find this to be incredibly cringe to do without reading the #Python room.)
Python Tip #247 (of 365):
Test file processing code with tempfile.
from pathlib import Path
from tempfile import TemporaryDirectory
def test_make_rst_from_md_file():
with TemporaryDirectory() as directory:
md_path = Path(directory, "example.md")
md_path.write_text("# Example markdown file")
make_rst_from_md_file(md_path)
assert md_path.with_suffix(".rst").is_file()
🧵 (1/4)
“If you need to distinguish between Linux and Mac, you need either the sys.platform string or the platform.system() function.”
Read more 👉 https://pym.dev/operating-system-checks/
New screencast on creating temporary files & directories in Python:
https://youtu.be/dVGNVcy5NqY
If you'd rather read than watch, there's also an article version:
https://pym.dev/temporary-files
It can be time to update the "Python wrapper around the libmemcached interface" in Django
https://pypi.org/project/pylibmc2/
The weekend is great time to get to know the candidates who are running for the PSF Board of Directors this year! Find their statements on the 2026 nominees page 🤩 If you affirmed your intention to vote in this year's election or voted last year, make sure to check your email 📩 #Python
https://www.python.org/nominations/elections/2026-python-software-foundation-board/nominees/
Python Tip #246 (of 365):
Measure your test coverage, including BRANCH coverage.
$ coverage run --branch -m pytest
$ coverage report
Or with the pytest-cov plugin:
$ pytest --cov --cov-branch
Code coverage lets you know WHICH lines of code were run by your automated tests.
For Python, coverage.py is great for measuring this.
Lines that are missing coverage are NEVER EVEN RUN by your tests. Code that isn't run is code that isn't tested.
🧵 (1/4)
Python Morsels now includes Daily Recall: a spaced repetition system for Python & Python-adjacent learning.
It's basically Whereabouts.Earth but for Python.
I've been talking about this idea for YEARS, dogfooding it for months, and now it's finally live.
If you'd like to improve your uv, pytest, Python, etc. skills, I'd love you to try it & leave feedback!
https://treyhunner.com/2026/09/python-morsels-now-has-spaced-repetition/
“Note that while auto-formatters will affect blank lines between classes and functions, most blank lines are under your control.”
Read more 👉 https://pym.dev/embrace-whitespace/
Fourth post in the wrapture unit testing series: beyond callables.
Not everything a test controls is a call: attributes, environment variables, settings dicts imported by reference, registry entries, generators. wrapture spells each as a binding with one lifecycle, and a binding can observe as well as hold: it can even tell you a loop stopped early and left its generator half-consumed.
https://grahamdumpleton.me/posts/2026/09/beyond-callables-in-wrapture/
Default values are great, but they have one gotcha that Python developers sometimes overlook.
Read more 👉 https://trey.io/rbi1o4
Python Tip #245 (of 365):
Use approximate comparisons for floating point numbers in your tests.
As noted back in tip #203, floating point numbers have precision gotchas:
>>> one_two = 0.1 + 0.02
>>> one_two == 0.12
False
>>> one_two
0.12000000000000001
🧵 (1/3)
Third post in the wrapture unit testing series: phased behaviour.
Testing retry logic, circuit breakers and polling loops means a collaborator that behaves differently as the test progresses: fail twice then succeed, open after the third error, report pending until told otherwise. wrapture spells that as phases on a binding, changing on a count, a condition, an exhausted sequence, or a signal from elsewhere in the test.
https://grahamdumpleton.me/posts/2026/09/phased-behaviour-in-wrapture/
🎲 Just released pytest-randomly 5.0.0
The headline breaking change fixes combination with other test reordering plugins, including pytest-django. Previously, the same seed could produce different test orders between nearly-identical environments. Oops!
Software is never finished: even this 11 year old well-scoped plugin needs the occasional big fix!
“It's often more readable to give a name to an object instead of just a number.”
Read more 👉 https://pym.dev/avoid-indexes-in-python/
Second post in the wrapture unit testing series: recording calls.
What wrapture's timeline and tape actually record, what one event holds, and the whole-tape views that answer questions about the flow between calls rather than any one of them. Worked through on a resource leak, the kind of bug where the failure is an absence and asserting on an absence needs a record of what really happened.
https://grahamdumpleton.me/posts/2026/09/recording-calls-with-wrapture/
RE: https://mastodon.social/@hugovk/117196019583423218
Here's how to join the cool testers' club! 😎
https://hugovk.dev/blog/2026/help-test-python-315/
#Python #Python315 #GitHub #GitHubActions
🐍🚀 Out now: final Python 3.15 release candidate!
It's your last chance to say that YOU helped test 3.15 before the big day on 1st October!
How?
💡 Try out the new features
💡 Try your project with it
💡 Add 3.15 to your CI
💡 Library maintainer? An extra task for you: upload wheels to PyPI, especially binary wheels
🐞 Report bugs!https://discuss.python.org/t/python-3-15-0-candidate-2-is-here/108841?u=hugovk
In return?
😎 Join the cool testers' club!
🦥 Lazy imports
🧊 frozendict
💂 sentinel
🏎️ Tachyon
🫶 and much, much more!
Four years ago I published a post on how to manage #Python dependencies in as “boring” a manner as I could manage.
Today I’ve published a revised version catching up on developments in the ecosystem since then:
https://www.b-list.org/weblog/2022/may/13/boring-python-dependencies/
Python Tip #151 (of 365):
For truly unpredictable randomness, use the secrets module
Python's random module relies on pseudo-randomness, meaning it generates numbers in a predictable order. If someone can guess the random "seed" (it's based on the current time) they can predict the numbers produced.
For true randomness, use Python's secrets module instead.
🧵 (1/3)
Python Tip #244 (of 365):
Use a seed to test code that relies on randomness.
import random
def generate_code():
characters = "ABCDEFGHJKLPQRTUVWXY234679"
return "".join([random.choice(characters) for _ in range(16)])
def test_generate_code():
random.seed(5)
assert generate_code() == "YJ6P9462VAT7H2BF"
The utilities in Python's random module generate PSEUDORANDOM numbers using a deterministic algorithm.
🧵 (1/3)
I was trying to explain why I don't really use Python's match statements much and by explaining my take on them came around from a very mild dislike to an equally mild like
very mildly confusing
(this was after running https://github.com/15r10nk/matchify on my main code base to see what strong use of match statements looks like – obviously not all of the changed statements were good or sensible, but I'm coming around to liking some of them)
ATTN PSF Voting Members: The inaugural Python Packaging Council election vote is open now until September 15th! If you affirmed your intention to vote in the election, you should have an email with voting instructions 🗳️ Learn more on the PSF blog. #Python https://pyfound.blogspot.com/2026/09/inaugural-python-packaging-council.html
ATTN PSF Voting Members: The 2026 PSF Board election vote is open now until September 15th! If you affirmed your intention to vote in this year's election, or voted last year, you should have an email with voting instructions 🗳️ Learn more on the PSF blog. #Python
https://pyfound.blogspot.com/2026/09/the-2026-psf-board-election-is-open.html
🐍🚀 Out now: final Python 3.15 release candidate!
It's your last chance to say that YOU helped test 3.15 before the big day on 1st October!
How?
💡 Try out the new features
💡 Try your project with it
💡 Add 3.15 to your CI
💡 Library maintainer? An extra task for you: upload wheels to PyPI, especially binary wheels
🐞 Report bugs!
https://discuss.python.org/t/python-3-15-0-candidate-2-is-here/108841?u=hugovk
In return?
😎 Join the cool testers' club!
🦥 Lazy imports
🧊 frozendict
💂 sentinel
🏎️ Tachyon
🫶 and much, much more!
Python Tip #243 (of 365):
Write automated tests.
You can test manually (run your code to make sure it works), or write automated tests: code that tests your code, like this:
def test_no_tax():
assert calculate_total([3.50, 13.75], apply_tax=False) == 17.25
Every time you change your code, your automated tests can tell you whether you broke something... without you needing to manually check every possible scenario.
🧵 (1/3)
First follow-up to the wrapture announcement: unit testing with wrapture.
I take one small piece of code and write its tests twice, once with unittest.mock and once with wrapture, focusing on the cases where the difference is structural: where wrapping the real code rather than replacing it lets a test say something substitution cannot.
More posts on the testing side coming over the next few days.
https://grahamdumpleton.me/posts/2026/09/unit-testing-with-wrapture/
“The sorted function accepts an optional reverse argument.”
Read more 👉 https://pym.dev/sorting-in-python/
I finally got around to working on my bike mapping project enough to publish the results...
I take the GPX files from my bike rides, run some Python scripts, and get these maps.
It's still not done, but I've procrastinated enough and wanted to get something out there since I've been working on it since last fall.
“The name deque stands for "double-ended queue", meaning deque objects are actually a sort of hybrid structure: they can be used as a stack, used as a queue, or used as both:”
Read more 👉 https://pym.dev/stacks-and-queues/
Python Tip #242 (of 365):
Prefer isinstance over type for type checking.
Do this:
isinstance(value, int)
Not this:
type(value) == int
Unlike comparing with type(...), using isinstance respects inheritance.
A "type(...) == ..." check fails for subclasses:
>>> counts = Counter("hello")
>>> isinstance(counts, dict)
True
>>> type(counts) == dict
False
Checking with type means nobody can inherit from your class without breaking your type check.
🧵 (1/2)
Thank you all for participating in today's workshop on open source contribution and #django!
#python #pyladies #opensource #sprint #womenintech #genderminoritiesintech #djangopony
What's New in Python 3.15:
locale
* setlocale() now supports language codes with @-modifiers. @-modifiers are no longer silently removed in getlocale(), but included in the language code. (Contributed by Serhiy Storchaka.)
* Undeprecate the locale.getdefaultlocale() function. (Contributed by @vstinner.)
“When you need to look up one value based on another in Python, you can use a dictionary as a mapping of key-value pairs.”
Read more 👉 https://pym.dev/using-dictionaries-in-python/
Python Tip #241 (of 365):
Let dataclasses write your dunder methods.
The dataclass decorator writes __init__, __repr__, and __eq__ for you:
from dataclasses import dataclass
@dataclass
class Comment:
text: str
line: int
Back in tips 63, 64, and 66 I recommended giving every class an initializer, a friendly string representation, and (sometimes) a custom sense of equality.
That's three methods of boilerplate for even a simple class:
🧵 (1/3)
«htmx and Django LiveView, side by side»
If you use htmx and are considering migrating to Django LiveView, this is for you: not an exhaustive comparison, but a run-through of the most common cases and how each one solves them.
https://en.andros.dev/blog/94d14a9e/htmx-and-django-liveview-side-by-side/
Python Tip #240 (of 365):
Dunder methods are meant to be defined, but not called.
Do this:
str(today)
Not this:
today.__str__()
Why avoid calling dunder methods?
Mostly because you're not supposed to.
Dunder methods are a contract between Python and whoever wrote the class: Python calls them, we use the operations they power.
🧵 (1/3)
“So if you need a stack-like structure in Python, use a list.”
Read more 👉 https://pym.dev/stacks-and-queues/
Dires les pythoneux, y'a un moyen de savoir de quel fichier (d'un répertoire donné) on doit importer les modules qu'on veut utiliser ?
J'avais du code qui fonctionnait avec une version précédente de FreeOrion mais depuis ils ont complètement réorganisé les modules donc y'a plus rien qui marche...
Python Tip #239 (of 365):
When implementing __eq__, return NotImplemented for objects you don't know how to work with.
Filling in __eq__ on yesterday's Version class (__lt__ would need the same check):
class Version:
... # self.parts is (major, minor, patch)
def __eq__(self, other):
if not isinstance(other, Version):
return NotImplemented
return self.parts == other.parts
🧵 (1/3)
“But duck typing and the isinstance function are not mutually exclusive.”
Read more 👉 https://pym.dev/goose-typing/
My screencast on Python's special NotImplemented value is now public.
Screencast: https://youtu.be/wI4K7faxZ_Q
Article: https://pym.dev/when-to-use-notimplemented/
NotImplemented is something you'll want to know if you ever implement __eq__ or various other "operate on another object"-style dunder methods.
This:
>>> 2 == 2.0
True
Isn't the same as:
>>> (2).__eq__(2.0)
NotImplemented
🔤🦥 isort 9.0 0 now supports Python 3.15 and sorting lazy imports 🎉
https://github.com/PyCQA/isort/releases/tag/9.0.0
#Python #Python315 #isort
🇪🇺🐍📽️ The EuroPython videos are all out!
https://www.youtube.com/playlist?list=PLd3Y9yzyC5Uo
Reply with your picks and let's build a thread of recommendations!
Python Tip #238 (of 365):
Don't write ordering methods by hand.
Want your objects to support <, >, <=, and >=?
You don't need to write them all!
Implement __eq__ and ONE ordering method (like __lt__), then decorate with functools.total_ordering:
@total_ordering
class Version:
...
def __eq__(self, other): ...
def __lt__(self, other): ...
🧵 (1/3)
Hit by the Patroni HTTP API stuck issue, again.
I have upgraded dozens of servers from Patroni 4.1.0 to 4.1.5 without issue last week. This morning, I continued to upgrade a couple more clusters. Today, we had two different freshly upgraded clusters down because the Patroni HTTP API is unresponsive. HAproxy stopped to send traffic because it thinks nodes are down, but Patroni and PostgreSQL looks healthy.
This issue has been on and off for the last 10 years I've been using Patroni. Apparently, it's caused by a recent change in Python that brings back the issue.
https://github.com/python/cpython/issues/140746
https://patroni.readthedocs.io/en/latest/
I'm on call tonight. I've been paged twice already. I have set up the MALLOC_ARENA_MAX=1 and PG_MALLOC_ARENA_MAX environment variables on the last failing cluster and hope I'll have a good night sleep before pushing them everywhere tomorrow 🤞🏻
“What if we only want to continue onward if the subprocess exited successfully?”
Read more 👉 https://pym.dev/running-subprocesses-in-python/
I redesigned the Django LiveView website. I hope you like it!
A more nuanced view of LLMs https://anarc.at/blog/2026-08-25-llm-nuance #llm #analysis #debian-planet #python-planet #free-software #debian #copyleft #copyright #linux
Python Tip #237 (of 365):
Need a read-only attribute? Use a property.
Properties are read-only by default:
>>> s = Square(4)
>>> s.length
4
>>> s.length = 10
Traceback (most recent call last):
...
AttributeError: property 'length' of 'Square' object has no setter
🧵 (1/3)
Any #Debian users also using the #Python bindings for #mapnik? If you didn't know, `python3-mapnik` has been removed from the unstable and testing releases; it still works in stable.
I have spent a few days building new packages based on the 4.3.0 release. I'm looking for potential testers; it WorksForMe™, but I want to make sure it doesn't break other setups. Have in account that this release has made some changes to the bindings, so your code might not work as is (mine didn't).
The PSF Board election vote kicks off in a week 🗳️🐍 In an effort to promote informed voting, the PSF Board Election Team has invited this year’s candidates to participate in a written interview. Check out the interviews on the PSF blog ⬇️
https://pyfound.blogspot.com/search/label/2026-psf-board-election-candidate-interview
“In Computer Science, stacks and queues are data structures that are optimized to make it inexpensive to remove either the most recently added item or the least recently added item.”
Read more 👉 https://pym.dev/stacks-and-queues/
Python Tip #236 (of 365):
Don't write getter and setter methods in Python.
If you need to customize what happens when an attribute is accessed or assigned, use a property.
In Java, it's best practice to use getters and setters instead of direct attribute access, in case you ever need to customize them.
In Python, we just use attributes.
When we DO need to customize attribute access, we make a property. Here's one that rejects negative stock values:
🧵 (1/4)
Three days left until the first #CodeIsArt no-gen-AI meetup in #Lyon! We meet in Le Taille Crayon on Monday at 19:00.
We will have a third presentation: using #Python to write macros for #LibreOffice. That is in addition to the previous two: a comparison of #Python and #Go, and building a community around the #F3D open source app.
If you are interested: please register, see https://stolat.town/@marcink/117079431946180511
If you know someone who might be: please help us by boosting or forwarding the link!
In the #Python Discord, someone was trying to understand how Python code is executed without ever being turned into native CPU instructions. So I wrote a tiny programming language compiling to bytecodes. 300 lines of Python.
https://nedbatchelder.com/blog/202608/micro_language_implementation_calcium
“Even if our code was inside a function, it is sometimes useful to break out of a loop without also returning from our function.”
Read more 👉 https://pym.dev/breaking-out-of-a-loop/
Python Tip #235 (of 365):
Don't use super() when "self" would work instead
super() has one primary job: calling the parent class's version of a method you're overriding.
A super() call that isn't doing that job probably shouldn't be there.
Here's a subclass of a tree-like Node class:
class DoublyLinkedNode(Node):
...
def parents(self):
return super().parents()
That parents method shouldn't exist. Each parent method is inherited by default.
🧵 (1/3)
Python Tip #234 (of 365):
Don't inherit from list or dict. You could end up with some weird bugs.
Say we make a bi-directional dictionary by customizing __setitem__:
class TwoWayDict(dict):
def __setitem__(self, key, value):
super().__setitem__(key, value)
super().__setitem__(value, key)
>>> d = TwoWayDict()
>>> d[3] = 8
>>> d
{3: 8, 8: 3}
And it seems to work... except when it doesn't:
>>> d.update({9: 7})
>>> d
{3: 8, 8: 3, 9: 7}
🧵 (1/3)
“And if you find yourself wanting to ask about the common or unique values between two collections, you can use set arithmetic.”
Read more 👉 https://pym.dev/practical-uses-of-sets/
Django 6.1 was released this month 🎉 with exciting features such as database-level delete options, fetch modes, or UUID7() database function 🤩 Big thanks to all 210 contributors who pushed 907 commits and to the other anonymous heroes who made it possible 👏 👏 💚 #django #python
https://gist.github.com/felixxm/8f6689ee2a62f1742923462fe600e9b4
10 years of public speaking and 10 years of Ice cream selfie.
Next one's at PyCon Portugal
See you there?
JupyterLite 0.8 is here, and it's a big one for running Jupyter fully in the browser with zero server setup.
New in this release: a Copy Shareable Link button for REPLs, a refreshed loading screen, file system reliability fixes, an in-browser terminal running real WebAssembly tools (ls, git, vim, grep, and more), more kernels through jupyterlite-xeus, and Python 3.14 via the updated Pyodide kernel.
9 new features, 11 bug fixes, 13 contributors.
Try it now, no install needed: jupyter.org/try-jupyter
#Python Friday #345: Reading #EPUB Files with EbookLib
https://pythonfriday.dev/2026/08/345-reading-epub-files-with-ebooklib/
Hey @freakboy3742 it can be interesting collecting all mobile apps written in Python like this attempt done for gtk4 based android application
https://gtk4android.geopjr.dev/
#Python #Android #Mobile #Gtk4
Python Tip #233 (of 365):
Don't return self from a method just to allow method chaining.
In Python, methods that mutate an object usually return None.
Functions and methods either RETURN a thing or DO a thing, but usually not both.
You may be tempted to make a mutating method return self so that calls can be chained:
tasks = (
TodoList()
.add_task("Publish weekly email")
.add_task("Record screencast")
)
This works, but it's VERY unconvntional!
🧵 (1/4)
Je vous raconte, c'est tordu.
J'exécute subprocess.Popen(["ipython", "kernel", f"-f={cfg}"]) pour lancer un kernel #Python et m'y connecter plus tard.
Si cfg est un chemin relatif (genre "./toto"), rien à signaler. Mais si cfg est un chemin absolu (genre "/home/azerty/foo/toto"), alors mon son parent ("foo") reçoit le bit t. C'est n'importe quoi...
Pour arranger les choses, les dev de #ipython ont limité la soumission de bugs aux devs du projet. Bah on va vivre avec ça du coup...
¡Para la próxima semana el grupo de trabajo de Diversidad e Inclusión de PSF tendrá un espacio en el Discord de la PSF!
Únete el August 25 9 PM UTC en el canal #psf-diversity para charlar, hacer preguntas y compartir en qué estás trabajando 🐍🗺️
https://pyfound.blogspot.com/2026/07/the-psf-d-workgroup-are-starting-office.html
The PSF Diversity & Inclusion Workgroup monthly office hours are next week on the PSF Discord!
Join us August 25 9 PM UTC in #psf-diversity to chat, ask questions, and share what you're working on 🐍🗺️
#Python
https://pyfound.blogspot.com/2026/07/the-psf-d-workgroup-are-starting-office.html
#fedihire #hiring #python #django #aws
UK based only - Senior Developer for The Electoral Commission // £70,000 // fully remote possible, hybrid at UK hubs also fine if your preference.
Fancy working with interesting data problems, and services that need to scale to millions of voters? You'll help bring a major voter-information service in-house and shape what comes next.
YOUR COUNTRY NEEDS YOU! We all need you. Plz.
Interested? I'm sole recruiter for this > thayer@team-prime.com CVs pls!
I built a new thing, an idea I have wanted to try for a long time.
Since writing wrapt, the idea was to build on it for two jobs I saw as one: unit testing in the spirit of mock, and tracing execution across real code. Same bindings for both, no changes to the code being observed. wrapture is the answer I ended up with.
First alpha on PyPI. Curious what people make of it.
[$] Representing Python paths using pathlib
At the outset of his PyCon US 2026 talk, Trey Hunner said that his goal was for attendees to stop representing filesystem paths as strings and to use pathlib instead. That's kind [...]
Python Tip #232 (of 365):
Try to avoid static methods in Python.
A static method is a function that HAPPENS to live on a class. It doesn't know the instance (or class) it's called on.
They're usually helper functions that live on a class for organizational reasons:
class Hasher:
...
@staticmethod
def _checksum_matches(hash_object, checksum):
checksum_bytes = bytes.fromhex(checksum)
return checksum_bytes == hash_object.digest()
🧵 (1/3)
Nouvelle instance (comment ça 10 jours ?), nouvelle intro !
Admin sys Linux/BSD et adepte du logiciel libre.
Je bricole et, code en Python
je parle parfois de science.
Je préfère l’intelligence artisanale à l’intelligence artificielle.
Héberger ses données plutôt que de les offrir aux GAFAM.
Team #ergol et je m'interresse aux #poticlavier
#Linux #BSD #FOSS #SelfHosting #Python #Homelab #introduction
RE: https://mastodon.world/@hamatti/117127427365915452
Some neat startup script tips in here, and for Python 3.15 you could do this for nicer pprint output:
pp = Printer(expand=True, indent=4)
Does your local meetup community need a website? Because I have just the theme for you.
Every community I've helped run has needed a website, and every time, we'd spent time hours browsing for themes and ended up rebuilding it from scratch, because none of the themes are meant for communities. Until now.
Introducing "Popular", a static site theme built especially for community & meetup groups, works in Hugo & Astro.
Blog: https://mariatta.ca/posts/no-more-rebuilding-the-community-website/
Python Tip #231 (of 365):
Use class methods as alternate constructors.
>>> s = Square.from_area(100)
>>> s.length
10.0
The classmethod decorator makes a method that's meant to be called on the class itself (not on an instance):
import math
class Square:
def __init__(self, length, color=None):
self.length = length
self.color = color
@classmethod
def from_area(cls, area, color=None):
return cls(math.sqrt(area), color)
🧵 (1/4)
“You can think of abstract base classes that rely on registering as similar to an opt-in duck.”
Read more 👉 https://pym.dev/goose-typing/
The Python Morsels REPL now runs on the new pyrepl! In browsers that don't support JSPI.
As of very recently, both Chrome and Firefox support the JavaScript Promise Interface, which is what's needed to get pyrepl (the new REPL in Python 3.13+) to work in WebAssembly.
it falls back to the old REPL.
Thanks to @ambv & whoever else helped (can't seem to find the PR) with getting pyrepl working in the browser!
@fitheach Try list-table or csv-table instead:
https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#tables
#markup #Python
#PyPI runs on ~zero AWS cost thanks to @fastlydevs caching 99% of traffic + AWS credits covering the rest. Huge thanks to both! But 2026 broke an 8-year streak: AWS spend is up 69% YoY as agents & CI runs surge.
@Monorepo, PSF Director of Engineering, on what's changing: https://pyfound.blogspot.com/2026/08/how-aws-powers-pypi-and-psf.html
Gunicorn now categorises "Framework returns content on HEAD requests" as a bug, and warns about it for every request.
Django's position is "Web servers should automatically strip the content of responses to HEAD requests while leaving the headers unchanged".
So, that's fun! 🫠
(Screenshot shows ASGI commit, but it was added to WSGI too.)
Python Tip #230 (of 365):
Use a single underscore prefix for internal attributes.
This _digits attribute is private... but only by convention:
import re
class PhoneNumber:
def __init__(self, number):
self._digits = re.sub(r"\D", "", number)
...
This (not fully implemented) class includes str() and an area_code attribute as its public interface:
>>> wh = PhoneNumber("(202) 456-1414")
>>> print(wh)
202-456-1414
>>> wh.area_code
'202'
🧵 (1/3)
✍️ I used my leet prompt engineering skillz to fix a bunch of bugs in django-upgrade
https://adamj.eu/tech/2026/08/18/django-upgrade-1.32.0-44-bug-fixes/
Alright Fedi, I'm looking for a job out of AI hell. I know chances aren't great for anyone right now, but I'm taking mine anyway.
I'm a (senior?) #Python developer with 10 years of experience in both #DataScience and #SoftwareEngineering (with a preference for the latter). I can find my way around #Rust and don't shy away from #JavaScript. I've done a bit of #React lately and haven't found it terrible.
I thrive in team environments where I have time both to work on my own and in pairs or mobs ( https://mob.sh is a great tool I'd use again, but IntelliJ's Code With Me works too).
My greatest passion is automating the tasks around coding away - testing, building, deploying code with either the shortest set of commands or just fully automated from a pipeline on pull/merge requests.
I won't say no to places that require me to use AI, but I have a strong preference to be able to write my code myself.
Would love boosts for reach! Also thanks for reading 💖
“We can automatically decode the output of this process using the default character encoding, by specifying text=True when we call subprocess.run:”
Read more 👉 https://pym.dev/running-subprocesses-in-python/
«Finger: the 1971 social network that never died»
It will surprise more than a few of you to hear that the first social network dates back to 1971; no accounts, no algorithm, no central server, just a plain text file you control.
https://en.andros.dev/blog/54572bc7/finger-the-1971-social-network-that-never-died/
[$] Bootstrappable builds: how and why
This year's edition of the Free and Open Source Software Yearly conference, better known as "FOSSY", moved north to the beautiful (and enormous) campus of the University of British [...]
Ich habe mir letzte Woche von einem LLM ein kleines Pythonscript erstellen lassen. Es sollte meine .ssh/config auslesen, dort jeden eingetragenen Host finden, und dann für jeden Host einen übergebenen Befehl ausführen. Also ich rufe "./remote.py apt update" auf, und dadurch soll für jeden Host "ssh hostname apt update" aufgerufen werden. Bis alles funktioniert hat, dauerte es ca. 20min. Leider waren da recht komplexe Regular Expressions drinnen (ein Kenntnis die ich immer noch nicht erlangt habe) und ich habe nicht wirklich jede Zeile verstanden was dort vor sich ging. Wenn ich mich selbst hinsetze und das schreibe, was ich gerade versucht habe, brauche ich auch 20min. Habe dabei aber wieder etwas mehr Python gelernt anstatt prompts so zu formulieren, dass auch das dabei herauskommt was ich möchte. Ein weiterer Vorteil: ich verstehe jede Zeile meines Scripts.
Mein Script ist übrigens eine Zeile kürzer wie das generierte, auch wenn das nur das "import re" ist, welches wegfällt. Ich programmiere ja viel Automatisierungen in der Industrie. Da sind wir es gewohnt lieber eine Zeile mehr zu programmieren, dafür ist es lesbarer für die Person, die das nach uns maintainen muss.
Um fair zu sein sollte ich sagen, dass ich einige Fehler schon umgehen konnte, weil das LLM die schong emacht hatte, ich also eventuell selbst 5 - 10min länger gebraucht hätte.
#linux #homeserver #python #scripting
Bei uns steht eine #Langzeit #Messung an - die ist weit weg - läuft n Jahr 24/7
Mein Ich von 201x würd hier #LabVIEW Programm schreiben und ne #Windows Kiste verwenden mit ner remote Desktop Lösungen aka anydesk
Mein 2025 Ich hat schon dazu gelernt und ich hab n schickes #Python Programm entwickelt... Auf dem #Mac - aber das ist lief auch schon testweise aufm #raspi
Da wir das irgendwo Vorort Aufbau wollen wäre Laptop die beste Lösung - also mal im Schrank geschaut was da noch so ist: hp probook 650 g1 - i5 4gen 8gb RAM SSD drin - #hardwarereuse
Debian mit KDE Plasma darauf - #hermes_agent installiert - und dann wurde mir erst klar wie genial das wieder mal ist... #debian13 #linux
Hermes mit #glm52 hat Programm gecloned und automatisch in Betrieb genommen - hätte ich auch noch hinbekommen - Zeit gespart
Mit Hermes und der Kommunikation über Matrix brauchen wir uns keine Gedanken über Netzwerk-Ports machen im Ziel Gebäude - alternativ können wir tailscale nach Installatieren #easydeployment
Mit Hermes hab ich ein System das die Messung überwachen kann - läuft noch alles? Und dann direkt Bescheid sagt #watchdog
Noch verrückter - er kann mir dort Vorort auch debuggen und ggf fehler beheben obwohl das Gerät schon 400km weg von mir ist - wie wenn ich davor sitze #softwareengineering
Ich mach das mit den VServer Tag täglich - aber das mein Messtechnik Job so viel einfacher wird - das wird mir jetzt erst klar
Könnte theoretisch 100 solche Messungen betreuen 🤯
Python Tip #229 (of 365):
Don't overuse classes.
Writing Python code does NOT require writing classes.
Unlike many programming languages, you can accomplish quite a bit in Python without ever making a class.
The most common reason to write a class is that a framework REQUIRES one (like Django's Model classes).
The best reason to write your OWN class: you have data and functionality that clearly belong together.
🧵 (1/3)
RE: https://fosstodon.org/@dongheena/117110919917203349
🐍🇰🇷🏃♂️ Thanks to all the sprinters for contributing to #CPython, and to @dongheena for running this with me!
#PyConKorea #PyConKorea2026 #PyConKR #PyConKR2026 #MakeItHappy #PyCon #Python
Maintenant que les démarches administratives sont faites, je peux enfin l'annoncer : je suis maintenant en freelance !
Développeur spécialisé dans le Web avec PHP (vanilla & Symfony) et Python (surtout avec Flask), avec de solides connaissances en JS (vanilla & Vue.js), je réalise tous les développements en tenant compte des besoins en accessibilité, en écoconception et du RGPD dès la conception.
Réalisations entièrement faites par un cerveau biologique.
Not going to make it to Chicago for DjangoCon US 2026? That's ok, I mean I'll miss you, but did you know you can watch all of the talk lives for cheap? Grab a ticket and help support the conference and community! https://ti.to/defna/djangocon-us-2026 #django #python
Python Tip #228 (of 365):
Don't catch NameError exceptions. 🧵
This is an issue:
try:
start, end = parse_date(row["start"]), parse_date(row["end"])
except (ValueError, TypeError, KeyError, NameError):
print(f"Invalid date on line {n}", file=sys.stderr)
continue
A NameError is raised when a variable isn't defined... which usually means a variable name was MISSPELLED.
🧵 (1/3)
You've all started testing the #Python 3.15 release candidate, right?
Oh, you can't because it's not on AWS Lambda? Good news, it's now available along with Node.js 26 as a preview:
https://aws-news.com/article/2026-08-15-introducing-public-preview-runtimes-on-aws-lambda-starting-with-nodejs-26-and-python-315
Python Tip #227 (of 365):
Don't rely on clever implementation details. 🧵
In CPython, two 3's are identical:
>>> x = 3
>>> y = 3
>>> x is y
True
But two 300's are not always identical:
>>> x = 300
>>> y = 300
>>> x is y
False
Don't rely on this. Compare numbers with ==.
In CPython, integers from -5 to 256 are created on launch, so every 200 is identical to every other 200.
Bigger numbers are only identical sometimes:
>>> x, y = 300, 300
>>> x is y
True
🧵 (1/2)
Alex Martelli coined the term "goose typing" to describe this ability in Python to practice duck typing while also using isinstance and issubclass.
Read more 👉 https://pym.dev/goose-typing/
Fun first day at #PyConKorea, meeting the local community and especially hearing how they're not only building but sustaining communities:
🐍 @dongheena building a #Python language support team, starting informally to encourage participation
🐍Luna building PyLadies Seoul through asking for help and learning to teach
🐍 Jiwoo Oh, Jiyoung Hwang & Juyeong Lee jumped right into a big open-source project and learned early the importance of collaboration
Python Tip #226 (of 365):
Don't assign to global variables from within a function.
You CAN do this in Python. But you really shouldn't.
Yesterday's tip noted that assignments within a function NORMALLY make local variables.
But they don't always...
Python's "global" statement is the exception:
>>> phrase = "Hi world"
>>> def set_phrase(name):
... global phrase
... phrase = f"Hello {name}"
...
>>> set_phrase("Trey")
>>> phrase
'Hello Trey'
🧵 (1/2)
📰 Issue 350: Django moves to an annual release cycle
https://django-news.com/archive/issue-350-django-moves-to-an-annual-release-cycle/
“When I need to run multiple subprocesses within the same Python script, I often find myself passing the same keyword arguments over and over to the run function.”
Read more 👉 https://pym.dev/running-subprocesses-in-python/
And here are my bike riding numbers from 2025. I started having back/leg/nerve pain at the end of November. It will always bother me that I didn't get 2,000 miles in 2025.
(August is when I started riding an ebike and commuting to work and riding a lot, lot, lot more!)
My bike riding has been poor this year, due to spinal stenosis and then spinal surgery in June... but hopefully the numbers will go up for the rest of the year.
(And who knows? Maybe I'll update some of the Python code that generates these.)
sincewhen now includes features that are removed from Python and their removal version.
https://pym.dev/since or "uvx sincewhen"
If you catch features it doesn't handle that you think it should, let me know.
⬆️ I updated django-cli-no-admin last night to support Django 6.1, Python 3.15, and Python's free-threaded versions.
Given the nature of the project, that means pyproject.toml updates 😬
I also tried out the trusting publisher thing, and it worked too. 🎉
À #Lyon le centre Léon Bérard a un poste de data engineer
https://www.centreleonberard.fr/travailler-au-centre-leon-berard/data-engineer-python-fh
#python #job
Python Tip #225 (of 365):
Avoid creating local variables that share a name with a global variable.
This is called SHADOWING, and it can make for confusing code.
Assigning to a variable inside a function normally makes a LOCAL variable:
>>> phrase = "Hi!"
>>> def set_phrase(name):
... phrase = f"Hello {name}"
>>> set_phrase("Trey")
>>> phrase
'Hi!'
The global phrase never changed. The function makes a LOCAL phrase that disappears when it returns.
🧵 (1/3)
We're also excited to announce the nominees for the inaugural Python Packaging Council 🤩 make sure to check out everyone's nomination statements to learn more about this years candidates! (And make sure to affirm your intention to vote by August 25th, 2 PM UTC!) #python https://pyfound.blogspot.com/2026/08/announcing-packaging-council-election.html
“It's actually possible to use isinstance and practice duck typing at the same time!”
Read more 👉 https://pym.dev/goose-typing/
We're also excited to announce the nominees for the inaugural Python Packaging Council 🤩 make sure to check out everyone's nomination statements to learn more about this years candidates! (And make sure to affirm your intention to vote by August 25th, 2 PM UTC!) #python https://pyfound.blogspot.com/2026/08/announcing-packaging-council-election.html
We're excited to announce the nominees for the 2026 PSF Board Election 🤩 make sure to check out everyone's nomination statements to learn more about this years candidates! (And make sure to affirm your intention to vote by August 25th, 2 PM UTC!) #python
https://pyfound.blogspot.com/2026/08/announcing-psf-board-candidates-for-2026.html
Are you ready to take your first steps in open source contribution? 🧑💻 Or already contributing, but curious about Django? 🦄
Either way, we are looking forward to seeing you at our workshop on August 29th!
https://www.meetup.com/pyladies-zurich/events/315215379/
#pyladies #python #opensource #django #genderminorityintech #womenintech #webdev
Python Tip #224 (of 365):
Constants that are specific to a class often belong ON that class.
class Circle:
max_radius = 100
def __init__(self, radius):
if radius > self.max_radius:
raise ValueError(f"Radius can't exceed {self.max_radius}")
self.radius = radius
But, why make max_radius a class attribute instead of a module-level MAX_RADIUS constant...?
🧵 (1/3)
I decided to play with a silly idea: reorganizing #Python's junk drawer module (I say "junk drawer" affectionately here).
https://treyhunner.com/2026/08/reorganizing-pythons-sys-module/
📦 New package day! This time a Rusty rewrite of the emoji package: 3.5x faster for conversion, 70 times faster for deconversion, and using about 40% less memory.
@diazona @stylus Here's the recent big one https://blog.pypi.org/posts/2026-07-22-ui-updates/
#Python #PyPI
“But self-concatenation doesn't copy anything, so don't try to use it to make lists of mutable values like lists-of-lists.”
Read more 👉 https://pym.dev/self-concatenation/
#CodeIsArt no-gen-AI meetups: it is now possible to sign up for the first event!
On keskonfai: https://keskonfai.fr/events/6e9b14ad-9803-4100-988b-59dfe69e2e5d
On meetup.com: https://www.meetup.com/code-is-art/events/316076339/
Use either to sign up (preferably in advance so that we know how many people to expect), boost if you know anyone who might also be interested, maybe suggest a talk if you would like to share something interesting? And show up at Taille Crayon on the 24th, 19:00, see you there!
🟣 Nouveau journal de bord sur le blog !
Aujourd'hui je vais vous parler un peu d'une amélioration que j'ai développé pour ma lib rst2gemtext suite à un besoin de @Dryusdan, d'un petit changement que j'ai apporté au blog, et d'une réflexion que j'ai eu sur la langue dans laquelle je publie suite à la lecture d'un article de @Edent
Bonne lecture ! 😁
Python Tip #223 (of 365):
Consider copying mutable arguments in your class initializers.
What happens if two objects are given the SAME list?
>>> initial_tasks = ['Watch screencast', 'Brush teeth']
>>> mon = TodoList(initial_tasks)
>>> tue = TodoList(initial_tasks)
It depends...
🧵 (1/4)
“When you need to launch a subprocess from within Python, I recommend using the run function from Python's subprocess module.”
Read more 👉 https://pym.dev/running-subprocesses-in-python/
Want to know how many cores on your CPU with #Python? You can use the multiprocessing module for that 🐍🔥
«HTML over WebSockets: real-time SPAs with barely any JavaScript»
Building a SPA usually means a JS framework, a JSON API, and two codebases forced to agree on a contract; there is another way that skips all three, and it is not new.
https://en.andros.dev/blog/ef4968f5/html-over-websockets-real-time-spas-with-barely-any-javascript/
#Web #JavaScript #Python #Django #WebSockets #DjangoLiveView
Python Tip #222 (of 365):
Be careful with mutable default values in function definitions.
This class has a bug:
class TodoList:
def __init__(self, tasks=[]):
self.tasks = tasks
def add_task(self, task):
self.tasks.append(task)
Every TodoList object made without arguments shares the SAME list:
>>> mon = TodoList()
>>> tue = TodoList()
>>> mon.add_task("Work on Python exercise")
>>> tue.tasks
['Work on Python exercise']
🧵 (1/3)
“Python's f-strings are great, but if you just need to smoosh a few values together with spaces between them, consider passing separate arguments to print.”
Read more 👉 https://pym.dev/print-features/
Who would expect that my tiny contribution would be merged into Python 🐍 🎉 Be patient folks, there is no rush 🧘 #Python
Last year @yossarian wrote a brief post on the surprising complexity of the #Python "splitlines()" method. As a busy Unicode pedant, it took me a while to write up something explaining *why* it's complex, but here it finally is:
Release season is on ✨
And now it’s time for django-never-cache 0.1.3 🐍
This release adds support for Django 6.1, includes a few cleanups and improvements, and now also publishes PyPI attestations automatically, improving transparency and supply-chain verifiability.
🔗 https://github.com/trottomv/django-never-cache/releases/tag/0.1.3
#Django #Python #PyPI #OpenSource #SupplyChain #TrustedPublishing
Need more information on running for the inaugural Python Packaging Council? Check out our blog post: https://pyfound.blogspot.com/2026/07/get-ready-python-packaging-council.html
Need more information on running for the PSF Board? Check out our blog post: https://pyfound.blogspot.com/2026/07/get-ready-psf-board-nominations-opening.html
You have a little more than 24 hours left to submit a PSF Board or Python Packaging Council nomination for yourself or someone else 🩵🐍💛 Submit your nominations by tomorrow, Tuesday, August 11th, 2:00 pm UTC! #Python
https://www.python.org/nominations/elections/
Python Tip #221 (of 365):
Implement appropriate dunder methods.
Dunder methods are a contract between your class and the Python interpreter.
• __add__ & __radd__ power +
• __eq__ powers ==
• __len__ powers len()
Dunder methods are what third-party library authors use to make their objects feel like NATIVE Python objects.
Django QuerySet objects support indexing, iteration, len(...), and truthiness.
And Pandas DataFrames support a whole BUNCH of syntax.
🧵 (1/2)
“In addition to os.name and sys.platform, there's an even higher level approach to find the platform that your code is running on, with the platform module.”
Read more 👉 https://pym.dev/operating-system-checks/
Python Tip #220 (of 365):
Trying quack like a duck? Seek help.
When implementing a common Python protocol (a sequence, a mapping, etc.), inherit from the matching abstract base class (ABC):
from collections.abc import MutableSequence
class MyCustomList(MutableSequence):
...
Benefits:
1. isinstance & issubclass checks work well (i.e. isinstance(x, Sequence))
2. Python will complain LOUDLY if you forget to implement a required method for the protocol
🧵 (1/3)
✍️ I just released a new version of my little Python profiler, tprof, with less overhead for more accurate results.
“As you write your code, pause and ask: “what should stand out here at a glance?””
Read more 👉 https://pym.dev/embrace-whitespace/
RE: https://mastodon.social/@djangonews/117044723592407007
New Django just dropped! 🙌🏻 🚀
I’m happy to see an implementation of one of my accessibility feature requests in there as well: `django.db.models.fields.BLANK_CHOICE_LABEL`.
I don’t have the spoons to explain it right now, but the backstory is in the ticket.
Paolo Melchiorre boostedDjango 6.1 released https://www.djangoproject.com/weblog/2026/aug/05/django-61-released/
New article on goose typing in Python (yes, that's actually a thing).
You can duck typing WHILE type checking.
Python Tip #219 (of 365):
Validate your ducks with goose typing.
You can use isinstance() WHILE duck typing. This is called goose typing (coined by Alex Martelli).
>>> from collections.abc import Iterable
>>> isinstance([1, 2, 3], Iterable)
True
Point doesn't inherit from Iterable:
class Point:
def __init__(self, x, y): self.x, self.y = x, y
def __iter__(self): yield from (self.x, self.y)
And yet...
>>> isinstance(Point(1, 2), Iterable)
True
🧵 (1/3)
🎨 I’m really enjoying the redesigned PyPI project pages. Thanks to Nicole Harris and team for making these improvements!
Blog post:
Python Tip #218 (of 365):
Don't needlessly convert between data types.
Looping over a file once? There's no reason to convert it to a list first:
for line in my_file:
print(line, end="")
Another example: if you're looping over a set, there's no reason to convert it to a list either:
>>> colors = {'red', 'blue', 'yellow'}
>>> for color in colors:
... print(color)
...
red
yellow
blue
"for" loops don't need a list. They accept ANY iterable.
🧵 (1/2)
🆙 Updated my post on unittest base test cases with a new preferred technique: using a plain class as a container.
https://adamj.eu/tech/2025/05/30/python-unittest-common-tests/
Python 3.15.0 release candidate 1 is out!
https://www.python.org/downloads/release/python-3150rc1/
Test your code against it and let the core devs know if you find bugs!
If you have uv, getting it is easy:
uv self update
uv python install
That even works if you already have an alpha or beta version installed (it'll upgrade it for you).
RE: https://fosstodon.org/@ThePSF/117044410884871074
For #Python devs who like to fill out surveys... ✅
The 2026 Python Type System & Tooling Survey is live 🐍📝❓ No typing experience needed—your perspective as a #Python dev matters most. Take a couple minutes to help improve Python typing for all!
https://www.surveymonkey.com/r/python_typing
This survey was developed with support from the Pyrefly team at Meta, the PyCharm team at JetBrains, the Python team at Microsoft, and the typing community on discourse.python.org.
The 2026 Python Type System & Tooling Survey is live 🐍📝❓ No typing experience needed—your perspective as a #Python dev matters most. Take a couple minutes to help improve Python typing for all!
https://www.surveymonkey.com/r/python_typing
This survey was developed with support from the Pyrefly team at Meta, the PyCharm team at JetBrains, the Python team at Microsoft, and the typing community on discourse.python.org.
Python Tip #217 (of 365):
Think in terms of the minimum viable duck.
In other words: "what's the least this object needs to do to work in this context?"
For example, csv.reader is usually given a file object... but it accepts ANY iterable of delimited lines:
>>> import csv
>>> rows = ['a,b,c', '1,2,3']
>>> list(csv.reader(rows))
[['a', 'b', 'c'], ['1', '2', '3']]
🧵 (1/4)
🐍🐍🚀🚀 Out now: Python 3.14.7 and 3.13.15!
https://discuss.python.org/t/python-3-14-7-and-3-13-15-are-now-available/108420
Peter's PEP 797 – Shared Object Proxies was also the first PEP rejected for 3.16 as well! ✌️
https://peps.python.org/pep-0797/
#Python #Python316 #PEP797
Forget Python 3.15 (don't forget it, please test!), the first PEP for Python 3.16 has been accepted:
PEP 828 – Supporting ‘yield from’ in asynchronous generators, by Peter Bierma
TIL that #Python's `pathlib.Path` is expensive compared to plain `str`ings. I tested by `.walk()`ing a 2 level directory structure with 40M files and it took 9m. When I tried with `os.walk()`, it only took 1m. Of course, I tested this several times to avoid cold vs hot cache.
Tritium#python@libera.chat tracked it down to the constructor to `pathlib.Path`, which does a lot of things than being just a `str`:
Python Tip #216 (of 365):
In Python, we often care more about the behavior of an object than its type.
We say "if it looks like a duck and quacks like a duck, it's a duck".
When we check for duckness, we don't test DNA, we observe behavior.
Instead of asking "what TYPE can I use here?", ask "does my object have the BEHAVIOR that's expected here?"
🧵 (1/3)
Some things sooner than others:
3.15 RC 1 is out, but we'll wait until tomorrow to do 3.13 and 3.14 so we can include this fix for macOS that will become a problem in mid-September:
https://github.com/python/cpython/issues/153711
3.15 will have another release (1st Sept) before then, but 3.13 and 3.14's next one is in October, so better wait for the fix.
🐍🚀 Out now: Python 3.15 release candidate 1!
Please test and report bugs!
We strongly encourage maintainers of to prepare their projects for 3.15 during this phase, and publish Python 3.15 wheels on PyPI to be ready for the final release of 3.15.0, and to help other projects do their own testing.
Any binary wheels built against Python 3.15.0 release candidates will work with future versions of Python 3.15.
https://discuss.python.org/t/python-3-15-0-release-candidate-1-is-here/108395?u=hugovk
The nomination period for the PSF Board and Python Packaging Council elections is open now, closing next Tuesday, August 11th, 2:00 pm UTC 📝🐍 Don't wait until the last minute, though! Nominate yourself or someone else today: https://www.python.org/nominations/elections/ #Python
🔒🐍 Coming soon, Python 3.15 release candidate 1! The 3.15 branch is now locked until 3.15.0 final in October.
https://discuss.python.org/t/the-3-15-branch-is-locked-for-rc1/108389
Also coming soon: Python 3.13.15 and 3.14.7.
https://hugovk.dev/next-release/
#Python #Python315 #Python314 #Python314 #release
Jag har också en kurs som hjälper Scratch-generationen att ta steget över till #Python genom den välbekanta miljön. Kursen innehåller även grundläggande hårdvaruprogrammering för att göra inlärningen rolig. Kurserna startar i slutet av augusti. Dela gärna så att fler föräldrar får se detta. #Stockholm #Solna #Sverige
Python Tip #215 (of 365):
Know what it means to be a "sequence" in Python.
Lists, strings, and tuples are all sequences:
>>> fruits = ["apple", "lemon", "pear"]
>>> coordinates = (1, 8, 2)
>>> greeting = "Hi y'all!"
A sequence is an ordered collection that:
1. Has a length
2. Can be indexed from "0" up to one less than its length
3. Can be looped over
>>> len(fruits)
3
>>> fruits[0]
'apple'
>>> for c in coordinates: print(c)
1
8
2
🧵 (1/3)
“The defaultdict is very handy, but I find that it's rarely useful enough that I feel the need to use it.”
Read more 👉 https://pym.dev/default-dictionary-values/
✍️ New post demonstrating the runtime advantage of my package time-machine over its inspiration, freezegun.
https://adamj.eu/tech/2026/08/03/python-time-machine-o1-freezegun-on/