Skip to content

Lightbug-HQ/pyre

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

Pyre

🗼 A Tower on fire! 🔥

Written in Mojo MIT License Contributors Welcome Join our Discord

Overview

Pyre is a set of components for building networking systems in Mojo.

Pyre currently has the following components:

  • Service trait that takes in a Request and returns a Response

(back to top)

Getting Started

Learn how to get up and running with Mojo on the Modular website. Once you have a Mojo project set up locally,

  1. Add the mojo-community channel to your mojoproject.toml, e.g:
    [project]
    channels = ["conda-forge", "https://conda.modular.com/max", "https://repo.prefix.dev/mojo-community"]
  2. Add pyre in dependencies:
    [dependencies]
    pyre = ">=0.1.0"
  3. Run magic install at the root of your project, where mojoproject.toml is located
  4. Pyre should now be installed. You can import all the default imports at once, e.g:
    from pyre import *
    or import individual structs and functions, e.g.
    from pyre.service import Service
  5. To use the Service trait:
    trait Service:
     fn func(self, req: Request) raises -> Response:
         ...
    E.g implement a Printer service that prints some details about the request to console:
     from pyre import Request, Response, OK
    
     @always_inline
     fn printer(req: Request) -> Response:
             print("Got a request on ", req.uri.path, " with method ", req.method)
             return OK(req.body_raw)

Contributors

Want your name to show up here? See CONTRIBUTING.md!

Made with contrib.rocks.

About

Networking abstractions for Mojo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published