@willmcgugan@mastodon.social
@willmcgugan@mastodon.social avatar

willmcgugan

@willmcgugan@mastodon.social

CEO / Founder of Textualize.io Hyperborean Python expert, author, humanist, husband, and sometimes wildlife photographer. He/him

Please use GitHub issues for tech support

This profile is from a federated server and may be incomplete. Browse more on the original instance.

mathsppblog, to python
@mathsppblog@fosstodon.org avatar

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,
@willmcgugan@mastodon.social avatar

@mathsppblog Clever

willmcgugan, to random
@willmcgugan@mastodon.social avatar

Props to @darrenburns for risking self immolation to work on textual-autocomplete!

https://github.com/darrenburns/textual-autocomplete

willmcgugan,
@willmcgugan@mastodon.social avatar

@espositocode yes, you can do that now with inline mode.

willmcgugan, to python
@willmcgugan@mastodon.social avatar

I lived streamed coding a TUI for a coffee "shop".

https://youtu.be/bdOrzkmJ6Lk?t=151

willmcgugan,
@willmcgugan@mastodon.social avatar

The app is currently online, for a little while at least.

Sorry mobile users, you will probably need a desktop browser.

https://textual-web.io/coffee-live/hw2e40guat37

willmcgugan,
@willmcgugan@mastodon.social avatar

New URL

https://textual-web.io/coffee-live/shop

I'll keep it online for a few hours at least (it's running on my laptop).

willmcgugan,
@willmcgugan@mastodon.social avatar

@pawamoy Pretty much. Just for fun though. It’s far from complete.

willmcgugan, to python
@willmcgugan@mastodon.social avatar

I'm going to be live-streaming working on a app. 2pm UK time (about 20 mins from now).

https://www.youtube.com/watch?v=mX74SALm9MU&ab_channel=WillMcGugan

willmcgugan, to random
@willmcgugan@mastodon.social avatar

I fixed 2 bugs today. Coincidentally, the two bugs in combination produced the correct behaviour in my app. 🤷‍♂️

willmcgugan,
@willmcgugan@mastodon.social avatar

@josevnz It was a bit like having an out by 1 bug, and an out by -1 bug. 🤷‍♂️

bbelderbos, to python
@bbelderbos@fosstodon.org avatar

Did you know you can use #Python's zipapp 🐍 module to make an executable zipfile? 💡

See the example below where I create one combining 1. an Amazon affiliation link generator script of mine + 2. a PyPI package 🎉

willmcgugan,
@willmcgugan@mastodon.social avatar

@bbelderbos A very cool feature! I don't see these much in the wild.

willmcgugan, to random
@willmcgugan@mastodon.social avatar

@mkennedy @brianokken Wouldn't be surprised if this is already on your radar. Pretty cool stuff!

https://wasmer.io/posts/py2wasm-a-python-to-wasm-compiler

willmcgugan, to random
@willmcgugan@mastodon.social avatar

Developers over 40. What advice would you give to developers just starting their career?

willmcgugan, to random
@willmcgugan@mastodon.social avatar

Here's a Markdown tip which I don't think is well known.

Triple backticks marks a code block. But if your code happens to contain three backticks you can use quadruple backtacks (or more) for the code block.

i.e.

print("```")  
willmcgugan, to python
@willmcgugan@mastodon.social avatar

I published a thing. Not an official @textualizeio project, just a personal thing.

It's an alternative way of declaring class attributes, that adds validation and watching.

It's a bit experimental. Let me know what you think!

https://github.com/willmcgugan/declare

willmcgugan,
@willmcgugan@mastodon.social avatar

@davidbrochart Yep. Similar goals, and works in a similar way. Just without Textual's runtime.

willmcgugan, to random
@willmcgugan@mastodon.social avatar

Double plus good!

Convinced Claude Opus that 2 + 2 is in fact 5.

willmcgugan, to python
@willmcgugan@mastodon.social avatar

Here's how to style inline TUI apps in #textual

Really looking forward to seeing what folk build with this. I haven't quite seen anything like it in the wild.

https://textual.textualize.io/how-to/style-inline-apps/

#python

willmcgugan, to python
@willmcgugan@mastodon.social avatar

How do you go about evaluating a #Python module for your project?

i.e. by what criteria would you consider before adding a library to your dependancies?

willmcgugan,
@willmcgugan@mastodon.social avatar

@dabeaz Only use libraries written by David Beazley. Got it. 😜

willmcgugan, to python
@willmcgugan@mastodon.social avatar

New feature in the works! What do you think?

video/mp4

willmcgugan,
@willmcgugan@mastodon.social avatar

@adamchainz RecursionError 🤔

willmcgugan,
@willmcgugan@mastodon.social avatar

This was an April Fools. Thanks to everyone who played along!

hugovk, to python
@hugovk@mastodon.social avatar

We got a human-submitted, AI-generated PR for @pillow that claimed to speedup an internal function by 54%.

It presented no benchmark script, so I benchmarked and found no noticeable improvement.

The PR claimed the "new optimized code was tested for correctness" and offered some "Generated Regression Tests" that it declared passed.

I ran them. After fixing an import error, the tests failed for both the PR and main.

No thank you, Codeflash AI.

https://github.com/python-pillow/Pillow/pull/7915

willmcgugan,
@willmcgugan@mastodon.social avatar

@hugovk @pillow Feels like those automated linting services that make arbitrary changes or break things. But worse. This made you do work to reject it!

willmcgugan, to random
@willmcgugan@mastodon.social avatar

The next version of will have an "inline" mode. Basically any Textual app can run under the prompt, with full mouse support.

This really seems to be capturing people's imagination. So many possibilities here...

https://www.youtube.com/shorts/dxAf3vDr4aQ

willmcgugan,
@willmcgugan@mastodon.social avatar

@pawamoy it does deserve a blog post! I’m afraid you were a bit off. It’s actually simpler than that. No alternate buffer involved.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • thenastyranch
  • modclub
  • mdbf
  • everett
  • Youngstown
  • rosin
  • slotface
  • love
  • khanakhh
  • kavyap
  • ngwrru68w68
  • ethstaker
  • DreamBathrooms
  • anitta
  • magazineikmin
  • tester
  • tacticalgear
  • InstantRegret
  • osvaldo12
  • Durango
  • cubers
  • normalnudes
  • Leos
  • cisconetworking
  • GTA5RPClips
  • provamag3
  • JUstTest
  • All magazines