I made a little thing:
You can now type check your Jupyter notebooks
github.com/beartype/ipy...
I made a little thing:
You can now type check your Jupyter notebooks
github.com/beartype/ipy...
The video for my PyCon JP 2024 talk "Crimes with the Python syntax" is out now!
youtu.be/fxiE6Tb5ofk
Happy new year! Let's hope for a great 2025.
And if improving your #Python skills is part of your plan for the new year, check out my starter pack of Python teachers, authors, and speakers.
go.bsky.app/M5WjB4s
w
BTW thanks to folks pointing this out to me, I did find a solution to avoid CSS duplication between light/dark when user overrides are involved. Basically light-dark(...) does respect color-scheme.
TIL about `copy.replace()` in Python 3.13
Trying to edit a NamedTuple or frozen dataclass in Python is much simpler now: there's a new `__replace__` method on them, and the right API to use it is:
>>> v
Vector(x=1, y=2)
>>> import copy
>>> copy.replace(v, x=3)
Vector(x=3, y=2)
Something special is cooking...
Two tricks from the builtin `configparser` Python module that everyone should know:
- If you're parsing a .ini file with comments, remember to set the `inline_comment_prefixes` param to ignore inline comments
- Use `config.getboolean()` to parse '1', 'true', 'yes' etc. to True
Python achievement unlocked - use `functools.cmp_to_key` for the first time:
docs.python.org/3/library/fu...
Converts a comparison function into a key function - useful for an Advent of Code problem this year!
TIL even if a python package is nested inside a monorepo on github, you can install it with pip:
pip install git+github.com/<user>/<monorepo>#subdirectory=my/nested/package
this is horrifying, and I doubt I could help, but do let us know when you have a solution!
TIL about the pytest.mock.usefixtures decorator
I continue to believe pytest has a feature for every conceivable use case.
why not just .split()
building a fully complaint python parser for fun
atproto aha moments:
- you can host your data
- it's just json
- it's typed but any app dev can invent those types
- records have URIs
- records are signed so cacheable without trust
- relay aggregates everyone’s events into a global stream
- backends subscribe to relay and update local DBs
In case you wondered how to apply PEP 639 (better PyPI license metadata) in the most common case, here's an example: github.com/python-attrs...
And here's how it looks like on PyPI (see Meta section): test.pypi.org/project/attr...
Just found out about `SimpleParsing`, it's an extension of `argparse` but with type annotations and dataclass support, I like its API.
github.com/lebrice/Simp...
Saw this release https://github.com/Yubico/python-fido2/releases/tag/1.2.0 and was excited to see stuff about WindowsClient extensions and "Extension APIs have been redesigned", thinking that maybe https://github.com/Yubico/python-fido2/issues/185 was finally addressed, but instead I see […]
I wrote a blog post explaining what the #PSF Conduct WG does since I have heard some people get it wrong.
snarky.ca/what-the-psf...
i still prefer the first one. and i believe abspath is unnecessary starting from python 3.10 or something?
removing abspath also means you never touch the filesystem for this line of code so it'll be significantly faster too.
this reminds me of pep 718: peps.python.org/pep-0718
While library maintainers would love this feature, I wonder what impact it will have on beginners when they accidentally do response.json["data"] instead of response.json()["data"], and instead of Python erroring, it gives a weird return value.
This perfectly shows how every language feature has a significant cost. In this case, Python choosing every runtime value (including function objects) to have a truth value (being True for most stuff) means errors like this can slip by.
I wonder what Python would look like without "truthiness".
and now we put a bow on it: @python.org
okay i need to try that next time!
they serve bentos on the shinkansen??
Hey! I’m Anthony.
I work on #Python stuff at Microsoft.
I wrote a book once about the Python compiler, blog sometimes and appear at the odd tech conference.
Unsure if you've seen this: jellezijlstra.github.io/why-cant-we#...
OMG I DON'T HAVE TO SORT __all__ AND __slots__ BY HAND ANYMORE!
I was annoyed literally every time I had to do it.
astral.sh/blog/ruff-v0...
I re-read @hynek.me 's article on SemVer and this cracked me up
"...your users will know what’s going on. But they won’t be happy about it and it may bring some negative vibes to your tropical vacation, financed by the millions you’ve made from maintaining a FOSS project."
hynek.me/articles/sem...
thredo but written with asyncio as its backend is a really interesting project right now. unfortunately i haven't been able to find the time for it in the past few months :^)