Pinnacle Python Client
This is the official Python client for the Pinnacle Serverless Backend API.
Pre-requisites
- Python 3.12 or higher
Usage
- Install the package using pip:
pip install pinnacle-python
- Create a directory called
pinnacleand create a file calledmain.pyin the directory. This directory will contain all your endpoint definitions. - To define an endpoint, use the
@endpointdecorator:
from pinnacle_python import endpoint
@endpoint()
def hello_world():
return "Hello, World!"
This will create a POST endpoint at /hello_world with no parameters.
- To define a scheduled script, use the
@scheduleddecorator:
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.
- Install the Pinnacle CLI:
pip install pinnacle-cli
- Deploy the endpoint using the CLI:
pinnacle dev
- 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)
| 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)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| 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.