SprintAPI Framework
A lightweight FastAPI-based framework that can be used like Spring Boot, with built-in dependency injection and lifecycle management.
Core features
- Configuration via environment variables over config file, which is friendly to containerized deployments and 12-factor apps;
- Built-in dependency injection, which enables IoC and better handles dependency management for larger apps;
- Controller-based API design, which is more intuitive for developers coming from other languages;
- Lifecycle hooks called on same event loop as the server, and are called in dependency order;
Requirements
- Python 3.12+
Install
pip install sprintapi
Quick start
Below is a minimal example of a controller exposing a single GET endpoint.
# main.py
from sprintapi import SprintApiServer, api_route, get_mapping, Controller
@api_route('/simple')
class SimpleController(Controller):
"""A minimal controller exposing a single GET endpoint."""
@get_mapping('hello')
async def hello(self):
"""Return a simple greeting."""
return 'Hello, World!'
def main():
# Create and run the server; pass `port=8000` to change the default.
server = SprintApiServer()
server.run()
if __name__ == '__main__':
main()
Run it:
python main.py
This runs a web server listening on http://localhost:80.
Then open http://localhost/simple/hello in your browser, you will see:
Hello, World!
With Dependency Injection
> cd examples/with-di
> export APP_NAME="My Demo"
> python main.py
Then open http://localhost/app/name in your browser and you will see:
This app is My Demo
License
MIT. See LICENSE.
Metadata
Release files for sprintapi 0.1.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 |
|---|---|---|---|---|
| sprintapi-0.1.3.tar.gz | 724.1 kB | Without provenance | Details for sprintapi-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sprintapi-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for sprintapi-0.1.3-py3-none-any.whl |
Total release size: 1.5 MB
Release files / sprintapi-0.1.3.tar.gz
| Download URL | sprintapi-0.1.3.tar.gz |
|---|---|
| Size | 724.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef5d66e24f1916e329a2f8fca4fcf3d3f8034983c81148a770050990780b861c
|
|
BLAKE2b-256 checksum How to use checksums |
ab724264e0adc61602fa95568c7f368863e0f6d113a1fd7f40035e738a3401f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / sprintapi-0.1.3-py3-none-any.whl
| Download URL | sprintapi-0.1.3-py3-none-any.whl |
|---|---|
| Size | 728.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3c2332cdef66e0447bf4b279cb92c8780f98ed70d32ea9cbd687faacc8fda7c3
|
|
BLAKE2b-256 checksum How to use checksums |
36a33760e322b7af30d24c6c7eb9182408175246555a5f2eb72f6c0555cfdfcd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for sprintapi 0.1.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.