Masthash

#python

Don Watkins
32 minutes ago
Pillow
1 hour ago

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

#PythonPillow #Python #Pillow

9.5.0
Deprecations
PSFile
The PSFile class has been deprecated and will be removed in Pillow 11 (2024-10-15). This class was only made as a helper to be used internally, so there is no replacement. If you need this functionality though, it is a very short class that can easily be recreated in your own code.
API Additions
QOI file format
Pillow can now read images in Quite OK Image format.

Added dpi argument when saving PDFs
When saving a PDF, resolution could already be specified using the resolution argument. Now, a tuple of (x_resolution, y_resolution) can be provided as dpi. If both are provided, dpi will override resolution.

Added corners argument to ImageDraw.rounded_rectangle()
ImageDraw.rounded_rectangle() now accepts a keyword argument of corners. This a tuple of Booleans, specifying whether to round each corner, (top_left, top_right, bottom_right, bottom_left).

JPEG2000 comments and PLT marker
When opening a JPEG2000 image, the comment may now be read into info. The comment keyword argument can be used to save it back again.

If OpenJPEG 2.4.0 or later is available and the plt keyword argument is present and true when saving JPEG2000 images, tell the encoder to generate PLT markers.
Security
Clear PPM half token after use
Image files that are small on disk are often prevented from expanding to be big images consuming a large amount of resources simply because they lack the data to populate those resources.

PpmImagePlugin might hold onto the last data read for a pixel value in case the pixel value has not been finished yet. However, that data was not being cleared afterwards, meaning that infinite data could be available to fill any image size. This has been present since Pillow 9.2.0.

That data is now cleared after use.

Saving TIFF tag ImageSourceData
If Pillow incorrectly saved the TIFF tag ImageSourceData as ASCII instead of UNDEFINED, a segmentation fault was triggered.

The correct tag type will now be used by default instead.
Other Changes
Added support for saving PDFs in RGBA mode
Using the JPXDecode filter, PDFs can now be saved in RGBA mode.

Improved I;16N support
Support has been added for I;16N access, packing and unpacking. Conversion to and from L mode has also been added.

BGR;* modes
It is now possible to create new BGR;15, BGR;16 and BGR;24 images. Conversely, BGR;32 has been removed from ImageMode and its associated methods, dropping the little support Pillow had for the mode.

With that, all modes listed under Modes can now be used to create a new image.
Markus Lauber
1 hour ago

#Python graphics are made easy with #KNIME’s #lowcode approach. From scatter, violin and density plots to PNG files and Excel exports, these examples will help you transform your data into actionable insights. Also, find out what it is about Kernel-Density-Plots and Penguins ...

https://medium.com/p/841df87b5563

Python Weekly
2 hours ago
dirkmjk
2 hours ago

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

#python #cycling #garmin

see also https://dirkmjk.nl/en/443/how-to-analyse-garmin-or-strava-activities-using-python

Dave Pearson
3 hours ago

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.

A Mandelbrot set being plotted in a terminal.
A Mandelbrot set being plotted in a terminal.
Dunsink Meteor Bot
3 hours ago

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

4 hours ago

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 ^^

#foss #gamedev #codegeneration

Arne Babenhauserheide
5 hours ago

@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

Hugo Slabbert ⚠️
5 hours ago

Damn; it's been a while since I've written that much #Python (and some Jinja) in one sitting...

Kenneth Freeman
6 hours ago
David Brownman
6 hours ago

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!

Asahi 95
7 hours ago

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.

Astra Kernel :verified:
7 hours ago

✨ Programming languages used in twitter algorithms (From GitHub)

Where is Go?

#rustlang #python #scala #java #cpp #programming #golang

Programming language in twitter algorithm

Scala 53.8%
 
Java
29.7%
 
Starlark
6.3%
 
Python
4.7%
 
C++
2.4%
 
Rust
1.5%
 
Other
1.6%
Energy in the EU
8 hours ago

Electricity prices (öre/kWh) for Stockholm (Zone 3), Sweden on 2023-04-01
Posted with #python and #mastodon API

Column chart showing electricity prices (öre/kWh) for Stockholm (Zone 3), Sweden on 2023-04-01.The lowest price is 37.74 öre/kWh at 14:00 and the highest price is 66.43 öre/kWh at 09:00
Zac
9 hours ago
Python Weekly
10 hours ago

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()

generative composition with recursive grids of colored balls on a black background
generative composition with recursive grids of colored balls on a black background
generative composition with recursive grids of colored balls on a black background
generative composition with recursive grids of colored balls on a black background
AskUbuntu
10 hours ago

Python script juju ssh into compute not executing #scripts #python #juju

https://askubuntu.com/q/1461831/612

@mos_8502 omg. I'm debugging my #python circular buffer right now

Mario Munoz
11 hours ago

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... 😅

https://www.meetup.com/pythonsd/events/291829162/

#Python #Developers

Cowboy Cat Ranch
11 hours ago

"Why do you need a snake when you already have a panther??"

#cats #python #Python #blackcats #catsofMastodon

It took me longer to make than I would've liked, but I'm happy to have made this little tool for myself. :D #python #selenium

Glyph
12 hours ago

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.

@Kencf618033

"Success! Thanks for filling out the form!"

They're so polite.

---

#PunchANazi #Data #WebDev #TransGenocide #Trans #LGBT #LGBTQ #LGBTQIA #Allies #Ally #Python

PyCharm IDE terminal showing a number of identities on the left, the bigot site on the right showing "Success! Thanks for filling out the form!"
Python Weekly
14 hours ago
Joshua Wood
14 hours ago

Here’s an experimental Python library that uses OpenAI/GPT to scrape websites and extract structured data without prior knowledge of page structure.

https://jamesturk.github.io/scrapeghost/

#Tech #Journalism #OpenAI #Python

Open Source JobHub
15 hours ago

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

(person sitting at a computer with 3 screens with a cat sitting on the floor) Want to work from anywhere? Find remote jobs now -- Open Source JobHub
Trey Hunner 🐍
15 hours ago

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

Trey Hunner 🐍
15 hours ago

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'>

Blender Dumbass
15 hours ago

@manujarvinen For these kinds of 2D things, I would simply use #python and #cairo module.

Rhett Allain
15 hours ago

New #python video - visualizing the volume element in spherical coordinates with @WebVPython - just for fun.

https://youtu.be/_AW7_YdS4Mk

Zac
16 hours ago

Updated my preflight script so that it can now optionally list the status of all of the files in a Hugo content directory. It uses the Rich library to format the data.

#python #rich #hugo

A screenshot of the terminal output of a python script. It shows a table with a list of file names on the left and a green or red dot to indicate the file status on the right
stark@ubuntu:~$ :idle:
16 hours ago

@pamelafox

The #Flask and #Python debugging has saved me numerous times before. I can't work without it!

Ronalds Vilciņš
17 hours ago

Source code for Twitter's Recommendation Algorithm https://github.com/twitter/the-algorithm-ml #webdev #programming #coding #python #ml

Thomas Cherryhomes
17 hours ago

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

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.

#Python #seguidors #seguiment

20 hours ago
(python shell)
>>> 7**(788/4) % 787
568.0
>>> 788/4
197.0
>>> 7**(197) % 787
105
>>>
Alex
20 hours ago

Hey #Python community - I have questions.

https://spectrum.ieee.org/python-compiler

This is amazingly awesome... right? It seems amazingly awesome.

Tom23
22 hours ago

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.

#seguidors #followers

Python Weekly
1 day ago

Codon: "#Python-based compiler that allows users to write Python code that runs as efficiently as a program in C"

https://spectrum.ieee.org/python-compiler

Alexandre B A Villares 🐍
1 day ago

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

# on the left, the code below inside Thonny IDE, on the right, a grid of 100 colors generated by the execution of the code.

size(600, 600)
for j in range(10):
    x = 50 + 50 * j
    for i in range(10):
        y = 50 + 50 * i
        fill(20 + i * 25,   # red
             20 + j * 25,   # green
             255 - i * 25)  # blue
        square(x, y, 50)
Glyph
1 day ago

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

Glyph
1 day ago

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”

https://blog.glyph.im/2023/03/no-exe-is-an-island.html

FlipperPA
1 day ago

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!

Pragmatic Bookshelf
2 days ago

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

#Python

Em :official_verified:
2 days ago

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:​

David Napoli
2 days ago

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

codetholdory :mastodon:
2 days ago

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

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
codetholdory :mastodon:
2 days ago

Latest hospital admissions for COVID-19 in England
Admissions = 886
7-day average = 901
Last updated on 2023-03-27
#COVID19 #python #pandas

Latest hospital admissions for COVID-19 in England
Admissions = 886
7-day average = 901
Last updated on 2023-03-27
codetholdory :mastodon:
2 days ago

Latest total deaths with COVID-19 on the death certificate UK - 219466 deaths.
Weekly deaths - 619.
Last updated on 2023-03-17
#COVID19 #python #pandas

Latest total deaths with COVID-19 on the death certificate UK - 219466 deaths.
Weekly deaths - 619.
Last updated on 2023-03-17
#COVID19 #python #pandas
codetholdory :mastodon:
2 days ago

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

Deaths within 28 days for COVID-19 in England
Weekly deaths = 753
7-day average = 107
Last updated on 2023-03-30
Kushal Das :python: :tor:
2 days ago

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

Speaker Ntoll and participants in the zoom call in the meetup
phildini @ the shop
2 days ago

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

Pragmatic Bookshelf
3 days ago

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

#python

Astra Kernel :verified:
3 days ago

🐍+🦀 => Making Python 100x faster with less than 100 lines of Rust

https://ohadravid.github.io/posts/2023-03-rusty-python/

#rustlang #rust #python #programming

Will McGugan
3 days ago

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*?! 🤯

#Textual #Python

https://textual.textualize.io/blog/2023/03/29/textual-0170-adds-translucent-screens-and-option-list/

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)

https://www.youtube.com/watch?v=GCgzTWrwzxs

Started work on the #nbpy sponsorship prospectus yesterday.

And because we want our sponsors to share our vision of an inclusive event that respects our attendees, this appears before even a single price is listed:

(#phpledge #python @phpledge)

Health and Safety Policy

North Bay Python's organizers are cognizant of the ongoing COVID-19 pandemic, and strongly believe that nobody should need to take undue risk to their health to benefit from professional development opportunities.
Łukasz Langa
3 days ago

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:

https://github.com/python/cpython/issues/102960

Flaki
3 days ago

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

Rafael Fernández López and Asen Alexandrov from VMWare on-stage at Wasm I/O 2023 in Barcelona about the WebAssembly Language Runtimes project. Slides show large PHP, Ruby & Python logos, a table that lists the version of the language available through this project (PHP 8.2.0, Python 3.11.1, Ruby 3.2.0), and the accompanying text:
What? — WebAssembly Language Runtimes
Pre-compiled binaries, ready to use
Build popular language interpreters:
• Up-to-date
• Tested
• Automated builds
Andrew Woods
3 days ago

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.

#WebDev #PHP #Ruby #Python

Brett Cannon
3 days ago

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. 😁

https://snarky.ca/tag/syntactic-sugar/

Juan Luis
4 days ago

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

Ricardo B�nffy
4 days ago