Skip to content

Latest commit

 

History

History
92 lines (72 loc) · 2.93 KB

README.md

File metadata and controls

92 lines (72 loc) · 2.93 KB


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.