toasty
toasty
MModular
Created by Jack Clayton on 5/11/2024 in #community-showcase
Lightbug HTTP: Mojo web framework
Alternatively, Headers is also writable, so you can print req.headers as well
118 replies
MModular
Created by Jack Clayton on 5/11/2024 in #community-showcase
Lightbug HTTP: Mojo web framework
Can you try printing the request object? HTTPRequest implements Writable so you should be able to print it and see what headers you received
118 replies
MModular
Created by Jack Clayton on 5/11/2024 in #community-showcase
Lightbug HTTP: Mojo web framework
I don’t think it’s in the modular-community channel yet. But it is in the mojo-community one
118 replies
MModular
Created by eggsquad on 10/16/2024 in #community-showcase
EmberJson: High level JSON library
No rush! Just curious. Was thinking about handling json payloads for the client in lightbug_http 🙂
49 replies
MModular
Created by eggsquad on 10/16/2024 in #community-showcase
EmberJson: High level JSON library
Any thoughts on when it’ll make it to a version that works with stable max? 😄
49 replies
MModular
Created by Ivo Balbaert on 1/7/2025 in #questions
Try finally when opening a file
You could fail to open the file within the try block, so you reach finally with an uninitialized ‘file’ variable
13 replies
MModular
Created by toasty on 5/12/2024 in #community-showcase
Prism: CLI Library (inspired by Golang's Cobra)
Hello everyone! Prism has been updated to 0.3.0 and now supports Mojo 24.6. The command api has been changed fairly substantially and now looks a bit more like urfave/cli. Rather than adding flags and subcommands functionally after creating the command, it's all set up during the command creation. Unfortunately, I had to remove the ability to include persistent flags in flag groups of children commands. That is because the children commands are now being created before the root command, and the persistent ancestor flags are not inherited by the children until the command is executed. I will work on a way to readd this feature in the near future. If you would like to contribute, please let me know! there are plenty of smaller features that need to be worked on. 🙂
from memory import ArcPointer
from prism import Context, Command

fn test(ctx: Context) -> None:
print("Pass tool, object, or thing as a subcommand!")

fn tool_func(ctx: Context) -> None:
print("My tool!")

fn main() -> None:
var root = Command(
name="my",
usage="This is a dummy command!",
run=test,
children=List[ArcPointer[Command]](
Command(
name="tool",
usage="This is a dummy command!",
run=tool_func,
aliases=List[String]("object", "thing")
)
),
)

root.execute()
from memory import ArcPointer
from prism import Context, Command

fn test(ctx: Context) -> None:
print("Pass tool, object, or thing as a subcommand!")

fn tool_func(ctx: Context) -> None:
print("My tool!")

fn main() -> None:
var root = Command(
name="my",
usage="This is a dummy command!",
run=test,
children=List[ArcPointer[Command]](
Command(
name="tool",
usage="This is a dummy command!",
run=tool_func,
aliases=List[String]("object", "thing")
)
),
)

root.execute()
7 replies
MModular
Created by toasty on 5/12/2024 in #community-showcase
Mog: Style definitions for nice terminal layouts (inspired by charmbracelet/lipgloss)
mog has been updated for Mojo 24.6! Lots of bug fixes and the readme has been cleaned up to correct any incorrect examples. The rendering speed has improved by 50-60% with all the changes to String in 24.6, along with the removal of as many additional allocations as I could. Happy to see the drastic performance improvement from 140-150ms to render the example layout image in 24.4, to 5-6ms in 24.6.
5 replies
MModular
Created by toasty on 12/19/2024 in #questions
Compile time float pow is crashing, is there a proper way to do this?
Yep, on it
4 replies
MModular
Created by toasty on 12/18/2024 in #questions
Is it possible to get the origin of `strs` in `fn name(*strs: String)`?
I’ll take a look, thanks!
19 replies
MModular
Created by toasty on 12/18/2024 in #questions
Is it possible to get the origin of `strs` in `fn name(*strs: String)`?
All of your recent changes have brought it very far 🙏🏾 working with strings has felt much better
19 replies
MModular
Created by toasty on 12/18/2024 in #questions
Is it possible to get the origin of `strs` in `fn name(*strs: String)`?
Doing a lot of split lines -> iterate over code points -> apply ansi sequences and padding -> rejoin
19 replies
MModular
Created by toasty on 12/18/2024 in #questions
Is it possible to get the origin of `strs` in `fn name(*strs: String)`?
I wanted to see how far I could go without allocating new strings, but avoiding the deep arcane stuff. I probably won’t implement the origin casting, but good to know nonetheless!
19 replies
MModular
Created by toasty on 12/18/2024 in #questions
Is it possible to get the origin of `strs` in `fn name(*strs: String)`?
I appreciate the examples in coercing Mojo to do what I want haha
19 replies
MModular
Created by toasty on 12/18/2024 in #questions
Is it possible to get the origin of `strs` in `fn name(*strs: String)`?
Ahhh okay, now it makes sense with that explanation! I thought it would take a union of all the origins through some magic 😂
19 replies
MModular
Created by staycia930 on 11/26/2024 in #questions
Using the input function will cause Mojo to crash.
Does it also crash if you try it in nightly? I know they pushed some changes to the input function shortly after 24.5 was released.
5 replies
MModular
Created by Hammad Ali on 11/10/2024 in #questions
Struct containing a list of itself?
Try list[arc[self]] instead, that’s what I use for a CLI library!
5 replies
MModular
Created by Jack Clayton on 5/11/2024 in #community-showcase
Lightbug HTTP: Mojo web framework
Great job with the speed improvements! @a2svior @bgreni
118 replies
MModular
Created by aurelian on 10/19/2024 in #questions
Not sure why these strings are missing the last char
Yeah! I try to use string slice where I can too
24 replies
MModular
Created by aurelian on 10/19/2024 in #questions
Not sure why these strings are missing the last char
Yeah, automating it would be nice. I’ve shot myself in the foot plenty of times while missing the null terminator
24 replies