If you can, best is to always spawn them in a task group (either using anyio or Python 3.11's task groups).
This prevents tasks from being garbage collected, but also prevents situations where components can create tasks that outlive their own lifetime. Plus, it's a saner approach when dealing with exception handling and cancellation.
Perhaps I just don't get them, but task groups never really made sense to me.
The whole beauty of async tasks is that you can spawn, retry, and consume them lazily. When you create a task group, you again end up waiting on a single long-running last task, desperately trying to fix individual failures and retries that hold up the entire group.
I've gone very recently through a rewrite from Rocket to Axum and very much love it so far.
The initial motivation was the need for web socket support, which Rocket doesn't have (yet). But I love how simple it is, and also that it does not want to be the entry point of the application. (I like an http server that's a library that can be embedded at any place in the application.) Another great thing is the examples/ directory in the Axum repository.
I had to use the latest version from GitHub though to get some of the features I needed, but maybe that's not the case anymore.
Same experience here. Canvas rendering is much faster for terminal apps if done well. I think also VS code uses a canvas for its terminal because its superior performance.
No, there is nothing to remember. Every decent HTML templating engine these days will handle all free form text as unsafe and escape it automatically. The same for SQL libraries.
Input sanizitation doesn't work, because it doesn't know what is dangerous and what is not dangerous. That depends completely on the output domain, and at the point where the inputs are received, the output domain is often unknown. Data can flow through many layers of business logic and then be passed to an SQL query, an HTML templating engine or anything else.
If you don't consider database strings to be free form text when constructing HTML, then there's a good chance there will be vulnerabilities anyway, regardless of whether any sanitization has been applied.
This has absolutely nothing to do with shitty validation rules. It has to do with what you're outputting it as.
If you're outputting it to HTML, commas are fine. If you're outputting it to CSV, commas are bad. And your validation rules suck if you don't allow commas in any text field because it might be output to CSV someday.
Unicode RTL override can be dangerous in filenames (in the sense of confusing humans, not computers). It is necessary to preserve in content management systems dealing with bidi content.
Of course you can try to have different validations on your model, but then you need to make sure to know all output domains on the model level instead of doing it when handing over to the view.
Hi, I'm the author of prompt_toolkit. A library that does something similar for Python. Don't hesitate to copy anything you need. It took me a few iterations to get the API as I wanted.
One thing I underestimated was the importance of having all readline key bindings available. People are really sensitive when certain functionality that they are used to is missing. (And you've no idea how much functionality there is in readline until you have to implement it.)
Thanks jonathan, I'll be sure to take a look. Having feature parity with GNU Readline is something I'm hoping to have in the future, it's a lot of work but it's open source so Im sure I'm not alone :)
>When several clients are attached to the same session, each client can watch a different window. When clients are watching different windows, every client uses the full terminal size.
Yes, but it's unsafe for another reason. The new syntax can be verified statically by tools like Pylint. A call to locals() is hard to verify.
The locals() function itself could for instance have been replaced by something else. When using locals(), you won't know until execution time if a local variable, required for the interpolation is missing. Even worse, linter tools (pylint, pyflakes, jedi, ...) are now going to tell you that certain variables are not used, and people are going to remove it without thinking that somewhere a locals() call is going to use it. This is very bad. Actually, the effects of using locals() cannot be verified statically, even more because locals() is also a writable dict.
For f-strings, the name bindings are static, and editors are going to understand it while editing.
There's no need for hyperbole. The fact that `locals()` doesn't work well with linters is a bummer, but compared to a multitude of other code smells it's pretty mild and harmless.
(author). This is the first release of Pymux. It should be stable and usable for daily work. However, don't hesitate to create a GitHub issue in case you feel that it lacks some features/responsitivity or when you'd like to see something different. Expect to see more progress in the coming months. Jonathan
Three things I care about are byobu, mouse support and tabs.
Being able to make byobu use this instead would make adoption really easy. Hopefully just documentation and changing one byobu setting for a different binary name somewhere.
Tmux has mouse support but it seems to require config settings (ie doesn't happen by default). I'd rather mouse stuff just works out of the box with no configuration and does the right thing.
I like tabs in the terminal (eg Gnome-Terminal on Linux). I believe there is a Mac term emulator that can map the different screens to tabs. Byobu does help a lot with this, but it would be nice if the terminal can do so too.
Thanks for allowing different viewers to see different screens at the same time. tmux's behaviour of making every viewer see the same one at the same time is highly annoying. (Yes I know there are ponderous workarounds, but seriously?)
+1 for out-of-box mouse event support. This would be the killer feature for me.
Right now, configuring pass-through mouse events in Tmux on a Mac is a huge production. StackOverflow has conflicting advice for each permutation of OSX version + Tmux version, and a lot of stuff changed in the last couple versions of each, such that old advice is entirely useless.
I'd love to see the ability to attach a GUI terminal with tighter integration. I use GNOME Terminal, for example, and when connecting to a multiplexer I'd like every screen to appear as a tab, with the ability to detach again later. I believe iterm2 does this, but it is OS X only.
This is the only thing I currently miss with screen/tmux/byobu.
This prevents tasks from being garbage collected, but also prevents situations where components can create tasks that outlive their own lifetime. Plus, it's a saner approach when dealing with exception handling and cancellation.