Skip to main content

sherry

Python web framework

pip install sherry

Simple application

from sherry import Sherry, get, Request

hi_str = "hi {}"
app = Sherry()


@get("/", app)
def hello_world(request: Request):
    return hi_str.format(request.query.get("name") or "world")


app.run(9527)

Create application engine

from sherry import Sherry, Engine

app1 = Sherry()
# or
app2 = Engine()
# with regex
app3 = Engine(re=True)

Add handlers

Create handler

If a return value exists for the function, it will be converted to a response (if not)

def my_handler(*args, **kwargs) -> Response | Any:
    pass

If there is no return value, the response will be the response field of the first parameter

The second parameter is the response field of the first parameter

from sherry import Request, Response


def my_handler(ctx: Request) -> None:
    pass


def my_handler(req: Request, res: Response) -> None:
    """
    req.response == res # True
    """
    pass

Add route, method, handlers

app = Engine()
app.add_route("GET" """http method""", "/" """pattern""", handlers)
app.add_route("GET", "/:some" """match one dynamic""", handlers)
app.add_route("GET", "/xx/*any" """match multiple dynamic""", handlers)

with regex

app = Engine(re=True)
app.add_route("GET", "^/\d$" """match one number""", handlers)

Wrapping

app.get("/", handlers)
app.post("/", handlers)
...

Decorators

from sherry.decorators import handler, get  # ...


@handler("/" """pattern""", ["GET" """"http methods"""], app)
def func():
    pass


@get("/"  """pattern""", app)
def func():
    pass

example

from sherry import Engine, handler

app = Engine()


# function decorators
@handler("/", ["GET"], app)
def index_handler():
    pass


# as
app.add_route("GET", "/", index_handler)


# class decorators
@handler("/", ["GET"], app)
class Pages:
    def middle_handler():
        pass

    def index_handler():
        pass


# as
app.add_route("GET", Pages.middle_handler, Pages.index_handler)

Metadata

Release files for sherry 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sherry 0.0.6
File Size Uploaded Provenance Actions
sherry-0.0.6.tar.gz 9.0 kB Without provenance Details for sherry-0.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sherry 0.0.6
File Interpreter ABI Platform Actions
sherry-0.0.6-py3-none-any.whl Python 3 none any Details for sherry-0.0.6-py3-none-any.whl

Total release size: 19.1 kB

Release files / sherry-0.0.6.tar.gz

Download URL sherry-0.0.6.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
62b5a722ecbb544851779388a20b2d0462fb8c2655b154f2987b5dac03749eae
BLAKE2b-256 checksum
How to use checksums
f9af2fdf10774cc3d6e4e97b751c95382629d278cefc77664b839a3ee4f955ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / sherry-0.0.6-py3-none-any.whl

Download URL sherry-0.0.6-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27f4f8a9ad96053cf2422b2eab1ca04e0ed3ebd8c64e517c5db3fc21c890483a
BLAKE2b-256 checksum
How to use checksums
040e034d87d684e81abdc2e1a5b12193a3ee953c3a9a642f1e1d553ec610dff0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Security for sherry 0.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page