Skip to main content

Pinnacle Python Client

This is the official Python client for the Pinnacle Serverless Backend API.

Pre-requisites

  • Python 3.12 or higher

Usage

  1. Install the package using pip:
pip install pinnacle-python
  1. Create a directory called pinnacle and create a file called main.py in the directory. This directory will contain all your endpoint definitions.
  2. To define an endpoint, use the @endpoint decorator:
from pinnacle_python import endpoint

@endpoint()
def hello_world():
    return "Hello, World!"

This will create a POST endpoint at /hello_world with no parameters.

  1. To define a scheduled script, use the @scheduled decorator:
from pinnacle_python import schedule, Period
@schedule(
    for_time=datetime.datetime.today() + timedelta(minutes=1), 
    repeats=Period(seconds=2)
)
def test_job():
    print("Hello, world!")

This will run the test_job function every 2 seconds starting 1 minute from the time the script is deployed. See the schedule documentation for more information on how to configure the schedule.

  1. Install the Pinnacle CLI:
pip install pinnacle-cli
  1. Deploy the endpoint using the CLI:
pinnacle dev
  1. You can now access the endpoint at http://localhost:8000/hello_world. Calling the endpoint
curl -X POST http://localhost:8000/hello_world \
     -H "Content-Type: application/json" \
     -d '{}'

will return a JSON in the following format:

{
    "data": "Hello, World!"
}

Defining response models

If you want to define a response model for your endpoint, provide the return type for the endpoint function:

from pinnacle_python import endpoint
@endpoint()
def hello_world() -> int:
    return 1

Or, if you want to return a more complex object use Pydantic's BaseModel class:

from pydantic import BaseModel
from pinnacle_python import endpoint

class Person(BaseModel):
    name: str
    message: str


@endpoint()
def hello_world() -> Person:
    return Person(name="John", message="Hello, World!")

Environment Variables

See the Pinnacle CLI README for a list of environment variables that can be used to configure the Pinnacle CLI.

Metadata

Release files for pinnacle-python 0.0.3

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

Source distribution (sdist)

Source distribution for pinnacle-python 0.0.3
File Size Uploaded Provenance Actions
pinnacle_python-0.0.3.tar.gz 3.1 kB Without provenance Details for pinnacle_python-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pinnacle-python 0.0.3
File Interpreter ABI Platform Actions
pinnacle_python-0.0.3-py3-none-any.whl Python 3 none any Details for pinnacle_python-0.0.3-py3-none-any.whl

Total release size: 7.0 kB

Release files / pinnacle_python-0.0.3.tar.gz

Download URL pinnacle_python-0.0.3.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4c76f6c0aa70249591ccbfc7a638e46518caa58e5561efcecc58c6b34b4a58ce
BLAKE2b-256 checksum
How to use checksums
ab55184b32bf6b3793e7cd91f7254fd18edf056b822c8f94378e232b5883ced9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.3 Darwin/23.5.0

Release files / pinnacle_python-0.0.3-py3-none-any.whl

Download URL pinnacle_python-0.0.3-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7871249aac0e9dedb89853aae5cc3354798c0e68ff5a4532920ef2f2854100cf
BLAKE2b-256 checksum
How to use checksums
9404b64d8619203b8fdfc020080a8506341f219ddbaf3ac9c10e1ac6b854c008
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.3 Darwin/23.5.0

Security for pinnacle-python 0.0.3

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