#python
Using mocks in Python | Opensource.com
https://opensource.com/article/23/4/using-mocks-python #Python #mocks
Pillow 9.5.0 has been released!
https://pypi.org/project/Pillow/
✨ New: ✨
* Security updates
* Images in Quite OK Image format can be read
* Added dpi argument when saving PDFs
* Added corners argument to ImageDraw.rounded_rectangle()
* Added support for saving PDFs in RGBA mode
* Improved I;16N support
* And much more!
Release notes: https://pillow.readthedocs.io/en/stable/releasenotes/9.5.0.html




TechCrunch | Python 4 To Be Renamed to Viper And Introduce TypeScript support
https://www.techscrunch.dev/article/6427dc8a62a5b6758a10
Discussions: https://discu.eu/q/https://www.techscrunch.dev/article/6427dc8a62a5b6758a10
For those who are interested in analysing gps files using Python: I’ve updated the `bikeride` package (the fitparse package it used isn’t compatible with the current version of Python so I replaced it with fitdecode). https://github.com/DIRKMJK/bikeride
see also https://dirkmjk.nl/en/443/how-to-analyse-garmin-or-strava-activities-using-python
Mi primer CRUD con #Python . #Git #Programacion https://myblog.clonbg.es/#/crud_con_python https://clonbg.es

mktemp() is insecure, right? So let's replace it with secure mkstemp()!
Built on top of textual-canvas, which in turn is built on top of #Textual, I've just made the first proper release of textual-mandelbrot -- a #Python Mandelbrot set explorer for the #Terminal
https://pypi.org/project/textual-mandelbrot/
If you have pipx to hand you should be able to `pipx install textual-mandelbrot` and run `mandelexp` and get going with it.


Stack of detected #meteors looking South from Dunsink Observatory @diasdunsink on 31 March 2023. Dunsink Observatory @diasdunsink has a number of video cameras monitoring the night sky searching for meteors. This is from our #GlobalMeteorNetwork camera IE0001. #python #bot #Astronomy

Despite being busy with other things, the #panda3d editor FRAME esp. on the Node editor has seen a lot of progress. A lot of basic #python #ast features have been implemented and only few are left to probably be able to create some basic applications. After that everything will be merged with the main branch and FRAME and should be ready for testing ^^
@lispi314 sidenote: that #guile bootstrap path was developed for #guix :
GNU Mes (maxwell equations of software) provides a minimal #scheme interpreter and C #compiler with tooling to build #tinycc that can be used with the Mes C library to compile glibc-2.2.5, binutils-2.20.1, gcc-2.95.3 with which you can build the whole #GNU system.
Thanks to #GCCrs that will soon include #Rust
Thanks to #Python on Guile it includes a shortcut for compatible Python-based tooling.
#GCC
@dalias @jschauma
Damn; it's been a while since I've written that much #Python (and some Jinja) in one sitting...
@lispi314 Also see python-on-guile: https://gitlab.com/python-on-guile/python-on-guile
#Guile has a minimal #bootstrap path via MES: https://www.gnu.org/software/mes/
Python local packages directory proposal rejected (PEP 582)
https://discuss.python.org/t/pep-582-python-local-packages-directory/963?page=22
Discussions: https://discu.eu/q/https://discuss.python.org/t/pep-582-python-local-packages-directory/963?page=22
Been hacking on some @datasette / Dogsheep plugins this week!
- Improved date parsing
- virtual column for permalink for HN comments
It's great to do some open source #python work. Thanks for the ecosystem, @simon!
Time for another #introduction :verified:
I'm Asahi 95, the 95 in my name refers to #Windows 95 :windows: (I'm not entirely sure why I chose that, the name just stuck :blobcatmeltcry:)
I'm a person who is a tech enthusiast :ms_computer: and loves #Linux and #FOSS, although I still use some #proprietary #software from time to time :linux: :opensource:
I'm currently learning how to code, #Python at the moment :python:, so at some point I can start contributing to FOSS :programmer:
I joined the #Fediverse :fediverse: mainly because I wanted to get away from centralised services 🔒 and also want to interact with an open and diverse community :blobcathug:
I'm a person who is bisexual and wants to supports the #lgbtqa+ in any way possible :philly_pride:
That's pretty much it about me, I hope I can interact with everybody on the Fediverse and beyond! :blobcat:
Been experimenting with #Python scripting #Blender to create automatic rotating .gif visualization of #3Dprinting STL files.
It works! Just need to work on the shading and lighting a bit.


I added a new feature to my preflight script
https://whatiswrongwithyourdog.netlify.app/posts/preflightpart2/
MIT Turbocharges Python’s Notoriously Slow Compiler
https://spectrum.ieee.org/python-compiler
Discussions: https://discu.eu/q/https://spectrum.ieee.org/python-compiler
sketch_2023_03_31 #Processing #Python #py5 #トゥートProcessing #TootProcessing #generativeArt #creativeCoding
import py5
margin = 60
def setup():
py5.size(800, 800)
py5.no_loop()
def draw():
py5.background(0)
grid(margin, margin, py5.width - margin * 2)
def grid(xo, yo, largura_total, n=3):
w = largura_total / n
color_step = 255 / n
for j in range(n):
x = xo + w * j
for i in range(n):
y = yo + w * i
py5.fill(i * color_step, # red
j * color_step, # green
255 - i * color_step) # blue
if w > 10 and py5.random(9) > 5:
grid(x, y, w)
else:
py5.circle(x + w / 2, y + w / 2, w * 0.98)
def key_pressed():
py5.save_frame('###.png')
redraw()
py5.run_sketch()




Tomorrow in San Diego... just a few spots left!
"Building a Python-Backed Frontend with HTMX and TailwindCSS"
And guess who's still trying to cram stuff in... 😅
"Why do you need a snake when you already have a panther??"


It's #InternationalTransgenderDayOfVisibility!
The #Python community could not be what it is today without the work of prominent trans Pythonistas. Just off the top of my head: @naomiceder https://cohost.org/hawkowl @gingerjess @astraluma and I'm sure I'm missing dozens if not hundreds more.

I built a Hosted Python bot that responds to my iMessages
https://www.getclearspace.com/beeper
Discussions: https://discu.eu/q/https://www.getclearspace.com/beeper
End of an era. https://github.com/pypa/pip/pull/11874/files

Here’s an experimental Python library that uses OpenAI/GPT to scrape websites and extract structured data without prior knowledge of page structure.
Are you an open source professional looking to work from home? Check out the remote positions available now on #OSJobHub https://opensourcejobhub.com/jobs/?q=remote #jobs #career #TechJobs #Python #Linux #developer #SoftwareEngineer #sales #marketing #RemoteWork #WFH #OpenSource

The interactions between type & object are also interesting.
All #Python classes are instances of object:
>>> isinstance(object, type)
True
But all objects are instances of object:
>>> isinstance(type, object)
True
Including object!
>>> isinstance(object, object)
True
The strangest #Python built-in? type!
It reveals an objects' type:
>>> type("hi!")
<class 'str'>
Or dynamically makes a class:
>>> C = type("C", (), {})
>>> C
<class 'C'>
Also it *is* a class:
>>> type
<class 'type'>
So its type is type! 😦
>>> type(type)
<class 'type'>
It's types all the way down in Python 🐢🐢🐢🐢
>>> type(type(type(type(type(type(type(type(type))))))))
<class 'type'>
@manujarvinen For these kinds of 2D things, I would simply use #python and #cairo module.
New #python video - visualizing the volume element in spherical coordinates with @WebVPython - just for fun.

Source code for Twitter's Recommendation Algorithm https://github.com/twitter/the-algorithm-ml #webdev #programming #coding #python #ml
For anyone who can code a simple turn-based network game server:
The #FujiNet project needs one example game server:
* Game of Poker (start with 5 card stud)
* 8 Players max
* Connect over HTTPS
* GET game status in JSON
* POST your move in JSON
* Have logic to enter and exit game.
* All game logic handled on server, client is just display.
* Post a chat msg
Doesn't matter the language, #nodejs, #python, whatever. Ping back, if you can do it. #retrogaming #retrocomputing

Showing off my #PyCascades badges collection 😎💜🐍
https://www.instagram.com/reel/Cqdoh58vh17/?igshid=YmMyMTA2M2Y=
@pycascades #Python #PythonCommunity
Nou projecte! Aquest codi fa seguiment de les variacions dels seguidors del nostre compte a #Mastodon i ens publica els resultats en un missatge privat.
https://git.mastodont.cat/spla/followers
El podem executar en la #Raspberry si volem.
Pyodide: now with 3.11 🚀
https://blog.pyodide.org/posts/0.23-release/
#Python #wasm
Hey #Python community - I have questions.
https://spectrum.ieee.org/python-compiler
This is amazingly awesome... right? It seems amazingly awesome.
Dis mastodon, on m'a demandé de récupérer des fichiers sur un disque dur qui déconne.
J'ai utilisé photorec, mais la personne à qui je rends service aimerait que les #photos récupérées soient un tant soit peu rangées.
J'ai pas trouvé de #script et j'ai pas le temps d'essayer d'en coder un.
Tu aurais ça sous la main ?
Un bout de code #bash ou #python qui pourrait trier les photos dans une arbo année/mois en fonction de la date de prise de vue des données #exif ?
Repouets et boosts appréciés.
Estic pensant que potser seria útil fer un programa #Python que et notifiqui amb un missatge directe qualsevol variació en la teva pròpia llista de seguidors.
Podria ser interessant per qui li agradi entendre perquè de vegades puja i de vegades baixa.
After CS50, I made a word game with Flask
Discussions: https://discu.eu/q/http://www.49letters.com
Codon: "#Python-based compiler that allows users to write Python code that runs as efficiently as a program in C"
Python cheatsheet
Credits: https://hackuniversity.io/image/188933816312
#python #code #coding #dev #cheatsheet #cheatsheets #webdev #development #programming

sketch_2022_03_29 #Processing #Python #py5 oddly satisfying palette of 100 colors

I also spent a little time getting spun back up this week to make some contributions to the #TwistedKlein #Python web framework, and fell down a very deep dark rabbit hole and banged my head on this very unpleasant shaved yak at the bottom. Not quite sure what to do about it yet, since the bug clearly isn't *in* Klein, as such…
https://github.com/twisted/klein/pull/571/files#diff-3a8f5e353590fbdd9f23585e61ec55f6dd40ce5b6445c19e1c5bbcee27ad54c0R151-R159
I don't know if the world needed a rambling post about single-file executables in #python but I've seen like five gripes about this in the last week and I do not want to post any more unexplained snark about it, so, I dusted off this draft and spent waaaaay too much time editing it into something halfway presentable.
As a wise woman once said, “This is my one big shot; if this list doesn’t hurt your opinion of [single file executable distributions], nothing ever will”
Full house tonight at #PhillyPUG, our first #Python meetup since 2019 in #Philadelphia. Thanks to everyone who came out, and our partners, DataPhilly and presenters Paul Chan and Dawn Wages!

Portable Python Projects by Mike Riley @mriley
Fun. Hands-on. Useful.
Control your home or office #IoT devices exactly the way you want instead of relying on an expensive mysterious box of third-party technology to do it for you.
https://pragprog.com/titles/mrpython/portable-python-projects?view_title
I’m working on my blog #Python script right now and each time I think of a feature to add, that makes me think of a bajillion other ones I should add.
If I don’t stop myself I fear this small script is going to end up being a full operating system 🙃 :python:
And following up on yesterday's Data Wrangling comparisons across #Javascript, #Rstats, #Python, #SQL, and #Excel by @allison_horst, here is a dive into Descriptive Statistics across the same set of tools https://observablehq.com/@observablehq/descriptive-statistics-translations
Latest COVID-19 children (0-19 year) deaths for England - 213.
Last updated on 25/03/2023
#COVID19 #python #pandas
newDeaths28DaysByDeathDateAgeDemographics
https://coronavirus.data.gov.uk/details/developers-guide/main-api#structure-metrics



Deaths within 28 days for COVID-19 in England
Weekly deaths = 753
7-day average = 107
Last updated on 2023-03-30
https://coronavirus.data.gov.uk/details/whats-new/record/4d64ce27-f18c-4908-b204-23c11da2da9c
#COVID19 #python #pandas

Now ntoll is live talking about #pyscript in the #Stockholm #Python User Group meeting.

Hey #Python folks (and I'm looking especially at you @treyhunner) what's the most #pythonic way to “write to file if it exists, else create it and then write to it”?
`open(filename, ‘x’)` only works once, AIUI. I want a code snippet (or library!) that will work every time
Trying to reproduce a Vera Molnar print
https://tinyurl.com/moldura-molnar
#Processing #Python #pyp5js #py5
Pythonic Programming by Dmitry Zinoviev @aqsaqal
Make your good Python code even better. Polish, secure, and speed-up your applications with proven pythonic programming tips .
https://pragprog.com/titles/dzpythonic/pythonic-programming?view_title
Created a simple YouTube downloader
https://www.tubemate4u.com/youtube
Discussions: https://discu.eu/q/https://www.tubemate4u.com/youtube
🐍+🦀 => Making Python 100x faster with less than 100 lines of Rust

I've pushed a new release of Textual.
Some really cool stuff in this release.
Multiple layers with an alpha channel, composited together. In a *terminal*?! 🤯
https://textual.textualize.io/blog/2023/03/29/textual-0170-adds-translucent-screens-and-option-list/

Blog Post: Making Python 100x faster with less than 100 lines of Rust
https://ohadravid.github.io/posts/2023-03-rusty-python/
Discussions: https://discu.eu/q/https://ohadravid.github.io/posts/2023-03-rusty-python/
Now that it's been 8 months since I gave my #kiwipycon keynote on #python's preference for rigidity, maybe I can watch it again to see where I disagree with myself now?
(It's a good talk, you should watch it)

If you're using #Python and you ever found yourself wanting for stack frame objects to be weak-referenceable, let us know this would be a helpful feature here:
Data wrangling essentials: comparisons in #JavaScript, #Python, #SQL, #Rstats, and #Excel by @allison_horst https://observablehq.com/@observablehq/data-wrangling-translations
Last week at the #wasmio #wasmio23 conference our friends over at the VMWare Wasm Labs (🌐 wasmlabs.dev) presented about bringing interpreted languages to #WebAssembly — such as #ruby, #python, #php, and more, soon even comparably obscure languages like #tcl!).
Okay that was quite enough hashtags for now, but if your first thought was “…but why?!”, that's an easy answer: you want to meet your users where they are! What's better, telling your future users off with "sorry you will need to learn Rust/JavaScript/whatever first", or telling them "You know Python? Great, we support Python!"?
Exactly.
On the other hand, if your first thought was “okay... but how??” boy have I got a blogpost for you! Here we talk about how we use the Wasm Labs team's work in our extension engine at Suborbital:
https://blog.suborbital.dev/bringing-python-to-se2-with-webassembly

JS developers who focus on Single Page Apps are trying to rebrand standard web applications as “multi-page apps”. Don’t play along. Don’t use their words. Just call them web applications or web apps . SPAs are actually non-web apps if you think about it. They don’t actually leverage links, which are a key feature of the web.
I unravelled the `del` statement in #Python : https://snarky.ca/unravelling-del/
This should be the last update to my syntactic sugar blog series since no one had any other suggestions after my talk at #pycascades At least my #PyCon US talk will be a bit more accurate. 😁
Amusing to read this article from @passle about #TypeScript from a #Python perspective: https://dev.to/thepassle/using-typescript-without-compilation-3ko4
Looks like parts of the #JavaScript ecosystem are abandoning TypeScript and putting types in docstrings and header files.
Meanwhile, in Python we are going in the opposite direction: moving types from docstrings to signatures (making them hard to read, quite frankly), and giving up on using stubs because of #MyPy https://github.com/python/mypy/issues/5028
Could we do things differently? #DEVCommunity
Welcome to the PyPI Blog - The #Python Package Index https://blog.pypi.org/posts/2023-03-21-welcome-to-the-pypi-blog/