Skip to content

Releases: HapticX/happyx

v2.9.7

08 Sep 03:16
Compare
Choose a tag to compare

Changelog

  • Allow complex types in request models (#133)
  • Solve #134

Full Changelog: v2.9.2...v2.9.7

v2.9.2

03 Sep 02:38
Compare
Choose a tag to compare

Changelog

  • Change register_route_param_type for python binds (#127)

Full Changelog: v2.9.1...v2.9.2

v2.9.1

02 Sep 15:46
Compare
Choose a tag to compare

Changelog

Full Changelog: v2.6.1...v2.9.1

v2.6.1

23 Aug 08:55
Compare
Choose a tag to compare

Changelog

  • Support multimethods for SSR/SSG (#117)
    serve ....:
      [get, post] "/":
        ...
    It available for Python also:
    @app.route('/', ["get", "post"])
    def handle():
        pass
  • Improved .hpx files (#118) - new statemenets:
    • if-elif-else
    • while
    • for

Full Changelog: v2.5.1...v2.6.1

v2.5.1

22 Aug 06:37
Compare
Choose a tag to compare
upd

v2.5.0

22 Aug 06:08
Compare
Choose a tag to compare

Changelog

  • Support websockets in Python bins (#115)
    @app.websocket('/ws')
    def handle_websocket_connection(ws: WebSocket):
        if ws.id() == 2:
            ws.send_text("failure")
            ws.close()
        print(ws.state())
        print(ws.id())
        if ws.state() == 'open':  # connect/open/close/mismatch_protocol/handshake_error/error
            print(ws.receive_text())
            ws.send_json({"hello": "world"})

What's Changed

New Contributors

Full Changelog: v2.3.0...v2.5.0

v2.3.0

19 Aug 15:31
Compare
Choose a tag to compare

Changelog

  • [Python binds] Compatibility with Jinja2 (#112)
    from happyx import new_server, setup_jinja2, TemplateResponse
    
    setup_jinja2('./my/dir/with/jinja2/templates')
    app = new_server()
    
    @app.get('/')
    def home():
        return TemplateResponse('index.html')
  • [Python binds] static files (#111)
    from happyx import new_server, static
    
    app = new_server()
    app.static('/static', directory='dir')

Python Bindings

16 Aug 08:52
89cb8d9
Compare
Choose a tag to compare

Meet - Python Bindings! 👋

Since v2.2.4 you can use HappyX with Python 🐍

Install

pip install happyx

Usage

from happyx import new_server, HttpRequest, RequestModelBase, JsonResponse


class User(RequestModelBase):
    name: str
    age: int


app = new_server("127.0.0.1", 5000)
user = new_server()

app.mount("/user", user)

@app.get('/')
def home(request: HttpRequest):
    print(request)
    return "Hello, world!"

@user.get('/')
def user_home(a: int, b: float, c: bool = true):
    """
    Try to send GET request to localhost:5000/user/
    And try to send queries:
    ?a=5&b=10.4&c=off
    """
    return f"Hello, world! a={a}, b={b}, c={c}"

@user.post('/[u]')
def create_user(u: User):
    print(u)
    print(u.name)
    print(u.age)
    return u.to_dict()

app.start()

Changelog

  • Python Bindings 🐍 (#91)
  • Python in HappyX CLI (#105)

Full Changelog: v2.1.0...v2.2.4

v2.1.0

11 Aug 11:30
Compare
Choose a tag to compare

Changelog

  • .hpx files support (#76)

Full Changelog: v2.0.0...v2.1.0

v2.0.0

09 Aug 15:47
Compare
Choose a tag to compare

Changelog

  • Nim v2.0.0 was released, so HappyX supports it 🎉(#98)
  • Automatically generated documentation (#80)
  • New CLI command - serve (#66)

Full Changelog: v1.12.0...v2.0.0