Skip to main content

Neopoint

Warning - project is unstable.

Neopoint is a simple backend framework, which support routing, parsing query and path parametrs etc.

Examples

Create base app

from neopoint import App
from neopoint.routing import Router


router = Router(prefix="/api")

app = App(debug=True)
app.include_router(router)

Let's add some endpoints

from neopoint.http import JsonResponse

@router.get("/users/{user_id}")
def get_user_by_id(user_id: int) -> JsonResponse:
    return JsonResponse(
        {
            "id": user_id,
            "first_name": "John",
            "last_name": "Doe",
        }
    )

You can add pattern at endpoint path like {NAME_OF_PARAMETR} and it will be passed to your controller function.

Let's parse also query parametrs.

from neopoint.http import JsonResponse

@router.get("/users")
def get_users(limit: int = 15, sort: str = "ASC") -> JsonResponse:
    return JsonResponse(
        {
            "id": user_id,
            "limit": limit,
            "sort": sort,
        }
    )

How to handle post and other requests with payload?

@router.post("/theme")
def create_theme(req: Request) -> JsonResponse:
    return JsonResponse(req.json)

For handling requests you can pass request parametr to your controller.

Request attributes:

  • headers -> MappingProxyType[str, str]
  • query_params -> QueryParams
  • path_params -> PathParams
  • method -> RequestMethod
  • path -> str
  • json -> Any
  • content -> bytes

Release files for neopoint 0.0.1

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

Source distribution (sdist)

Source distribution for neopoint 0.0.1
File Size Uploaded
neopoint-0.0.1.tar.gz 13.6 kB Details

Built distribution (wheel)

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

Total release size: 33.5 kB

Release files / neopoint-0.0.1.tar.gz

Download URL neopoint-0.0.1.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
935305fb0106b5fa243d7a1bbc398f20166668f662d48d4a312dfc632f945279
BLAKE2b-256 checksum
How to use checksums
cd5f8d91ac125f85d83cf1aef17065e13563ebb479a236faf38dee37a4907243
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.8 Linux/6.8.1-arch1-1

Release files / neopoint-0.0.1-py3-none-any.whl

Download URL neopoint-0.0.1-py3-none-any.whl
Size 19.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7304f6a1f013a6b8a4cff32771179f4e588aaf5774f9d5b49f0d6e1a0d358bfe
BLAKE2b-256 checksum
How to use checksums
975e12190b3de068de4b09d4459f22ab84ee5c018b60ecb2d2bb2a3259ea8166
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.8 Linux/6.8.1-arch1-1

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

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