nedbat, Are you sure you know how #Python decorators work? This should be no problem! 😈 🤯 🤓
villares, Portuguese Code at: https://github.com/villares/sketch-a-day/tree/main/2024/sketch_2024_06_04
More sketch-a-day: https://abav.lugaralgum.com/sketch-a-day
I really need your support to keep going, if you can, donate any amount at: https://www.paypal.com/donate/?hosted_button_id=5B4MZ78C9J724 #Processing #Python #py5 #CreativeCoding
hugovk, 📣🐍📚 Calling all Python library maintainers!
Python 3.13 is now in beta, with the second of four beta releases out later today!
It's now time to start testing your libraries with 3.13 and report any problems back to CPython so they can be fixed before the big October release. And make any updates you need to upgrade your library; keep an eye out for removals and deprecations.
Here's how to test 3.13 on GitHub Actions:
hynek, @hugovk My understanding is they already fixed it months ago. Guessing their release process is painful.
cfbolz,
Posit, posit::conf(2024) virtual tickets are now available!
Join us on August 12-14—from all over the world—to live stream the incredible talks and keynotes that will be taking place in Seattle.We understand that not everyone will be able to make the trip to Seattle this year, so we’re excited to offer a fully virtual offering for everyone as an alternate option.
REGISTER: https://posit.co/conference/
Posit, And if you’re available on June 6, join the Data Science Hangout where you can ask any questions you may have about posit::conf(2024) directly to the conf committee including Hadley Wickham, Posit’s Chief Scientist. https://posit.co/data-science-hangout/
pytexas, Reminder that the PyTexas Meetup is tonight! Come by and chat, hangout, and hear about a journey building an AI app. We'll get started chatting around 7:30pm CST and move on to the main presentation at 8:00pm.
See y'all there!
desertplains,
desertplains, @tshirtman @diazona humm interesting. I hope I'm not abusing from your good will but, would you mind to elaborate a bit more, or even send some article for reference? I got curious with the "arbitrarily large numbers". Tks.
tshirtman, @desertplains
https://docs.python.org/3/library/stdtypes.html#typesnumeric says "Integers have unlimited precision" which is to mean it can use as much memory as needed to store bigger values (until your operating system refuses to give more memory to your process). it's not like the C int type, for example, which will have minimum and maximum possible values.
@diazona
treyhunner, (edited ) New article on Python's many command-line tools 📣
Did you know that #Python 3.12 comes bundled with 50 command-line tools? 😮
An HTTP server, a sqlite prompt, a code profiler, and so much more! ✨
treyhunner, @hugovk Ooh! I missed this new feature!
This one actually seems really handy 💖
$ python3.13 -m random 6
1
$ python3.13 -m random 3.14159
3.0145311549545397
$ python3.13 -m random this is great
isI will definitely be updating this article before October. 😁
sonicrocketman, @treyhunner Congrats on making HN! Very useful stuff. I use http.server and sqlite a lot. Some are new to me though.
villares, Portuguese Code at: https://github.com/villares/sketch-a-day/tree/main/2024/sketch_2024_06_03
More sketch-a-day: https://abav.lugaralgum.com/sketch-a-day
I really need your support to keep going, if you can, donate any amount at: https://www.paypal.com/donate/?hosted_button_id=5B4MZ78C9J724 #Processing #Python #py5 #CreativeCoding
cheukting_ho, Hey, do you want to vote in the upcoming @ThePSF elections? Don't forget to affirm your intention to vote (please check your email, including spam). Deadline: June 25th 2024. Not a member yet? Check how you can become a voting member here: https://buff.ly/3X2cLhL #Python
leahawasser, I wrote an overview of @pyOpenSci s second (and my second) experience at #pyconus2024 https://www.pyopensci.org/blog/recap-pyos-pyconus-2024.html
we had a great time with a record amount of sprinters, open space attendees AND i gave my first talk! I can't wait for next year! #python #openscience #opensource
Jigsaw_You, NumPy 2.0 is planned to be released on June 16, 2024. 👍
flypig, The #ResearchEngineering and #ToolsPracticesSystems teams from #TheAlanTuringInstitute wrote up about our experiences at #FOSDEM2024 ... we talk about #OpenResearch, #Python, #HPC and #LinuxOnMobile. Happy memories! #FOSDEM
pyconau, 🎤 Ready to take your public speaking skills to the next level? PyCon AU has your back!
Whether you're a Student, Educator, Graduate, or Professional, we want YOU! We're seeking talks from first-time or seasoned speakers, and we have a fantastic mentoring program to help your proposal shine.
Read more about it here: pycon.org.au/program/#mentors-and-feedback
webknjaz, One friend of mine wrote a blog post on his @homeassistant setup:
"Home Assistant helps me survive during missile and drone attacks. Here is how." https://denysdovhan.com/home-assistant-config/config/war/
#python saving lives IRL y'all!
jscholes, Needed to rename a test fixture in a #Python file, and find/replace wasn't up for the job. So I decided to give #VSCode a go:
I started by pressing Ctrl+F2, for "Change All Occurrences". I think that is basically find/replace, and hence didn't do what I wanted.
Instead, I installed the recommended Python extension, and pressed F2 for "Rename Symbol". That claims to have only made one change, and the references to the function are still using the old name.
So, consider me confused. I'm using #pytest, whereby the test fixtures are referenced as function arguments rather than being called directly. Maybe that's what VS Code is struggling with? Either way, I've now spent more time on this than just manually editing the text.
nedbat, @jscholes Pytest's style of associating fixtures with tests is quirky, and confuses most language tooling.
nedbat,
bbelderbos, Ever wondered how to debug a hanging test in #Python?
pip install pytest-timeout
pytest --timeout=N_SECONDSTo dump the whole stack trace you can add
--timeout_method=thread
as well.Here is an example:
bbelderbos, Related article: https://pybit.es/articles/pytest-timeout/
mitten, So I’m trying to write some little static designs with py5 in Thonny, and when I run the program, the sketch window opens but closes immediately, so I can’t really see what I’ve drawn. It only seems to happen when there is no “def draw():” component in the program (so, non-animated programs which only have the “def setup():” part). Is there a setting somewhere to tell Thonny to keep the sketch result open after running? #py5 #Python #Thonny
villares, @InstantArcade @mitten
Cheers Instant Arcade!
Welcome to the py5 community!
villares, @InstantArcade @mitten Oh, I'm just an enthusiast who uses it everyday, and I feel part of the #py5 community and try to contribute to it! The creator & maintainer is Jim, @hx2A, and the official Mastodon account is @py5coding 😊
levlaz, spent an hour debugging jinja template before realizing I was passing in the list variable but not by name. :facepalm: #python #programming
anderseknert, @levlaz I spent half an hour the other day debugging an issue where none of the changes I did seemed to make any difference. Turned out that file was in a different directory than the one I was in.
levlaz, @anderseknert I swear this happens to be once a month 😅
Especially with go because Im always opening sub dirs in their own vscode instance because I am too dumb to get go.work to work for me consistently in complex projects.
ronald, I created a #python script to generate a custom #emulationstation collection of all 5-star #retrogaming games present on #steamdeck. this is a great way to have the best games easily at hand, especially when using large collections.
how to do it?
- copy the script from https://pastebin.com/rjam3wYp and name it create.py
- run it on your steamdeck by running 'python create.py'
- start emulationstation, enable custom collections and voila! all the best games now show in a single list!
steamdeckhq, @ronald oh this looks so interesting! So this downloads games for you completely and sets it up with ES-DE?
ronald, @steamdeckhq it is more of a specialized tool. What it does is after you are done setting up, have games, scraped metadata etc you can run this to generate a playlist like shown in the screenshot which contains only the 5 star games. Emulation station does not offer this as a filter by itself so this is a way to still get that list without manually having to add all the 5 star games through the UI one by one.
jezdez,
pradyunsg, @jezdez IIRC, this comes out of docutils and isn't configurable on Sphinx's end AFAIK. You need some alphabetical character and a unique slug to docutils to not fall back to idN. Link below for the source of truth for this behaviour.
And, the core logic for "let me pick an id" is at https://github.com/docutils/docutils/blob/ff0b419256d6b7bfdd4363dd078c2255701de605/docutils/docutils/nodes.py#L1346 AFAIK. None of the settings are exposed by Sphinx.
treyhunner, For single-line comments, Python uses the octothorpe character (#), also known as pound, number sign, crunch, and of course, the hashtag character
Read the full article: Multiline comments in Python
▸ https://trey.io/a5O8qe
cm_jc, @treyhunner like this?
treyhunner, @cm_jc yup just like that. Multi-line strings are great as strings.
They're also great as docstrings: https://pym.dev/docstrings/?watch
But I wouldn't use them as an equivalent to "multi-line comments" in another language (unless everyone else on your team reading your code is already bought in on that odd use).
grrrck, I made a little TikTok about my all-time favorite new #Shiny feature: dark mode! ☀️🌙
This one is for Shiny for #Python, but the #RStats version will be dropping soon so follow the @Posit channel to make sure you catch it!
https://www.tiktok.com/t/ZTL7qM1SK/
pybonacci, I am completely happy using pip, conda/mamba to manage my dependencies and environments.
Lately (and not so lately) I've seen poertry, pixi, hatch, pipenv, pdm, rye, uv,... Of course I feel I'm missing something. What are your thoughts/comments about these tools?
mathsppblog, Just used
operator.itemgetter
to reorder values of a dictionary.Quite neat snippet of code:
from operator import itemgetter d = {"a": 1, "b": 2, "c": 3} it = "cab" print(itemgetter(*it)(d)) # (3, 1, 2)
willmcgugan, @mathsppblog Clever
sethmlarson, Want to follow along with Nate Ohlson who's working on adopting hardened compiler options for #Python as a part of Google Summer of Code 2024? They're publishing to Mastodon!