Picoapi
A wrapper around FastAPI to simplify microservice creation. Very opinionated but also simple to fork if you would like to add your own version of service registration and configuration to FastAPI.
Usage
create a .env file or export the following variables:
| ENV variable | Required (default) | Default | Description | Examples | Implemented |
|---|---|---|---|---|---|
| API_HOST | Yes | The host of the API | myhost|123.123.123.123|localhost|127.0.0.1 | ||
| API_PORT | No | 8888 | The port of the API | 8080 | |
| API_BIND | Yes | The interface descriptor to bind to | 127.0.0.1|0.0.0.0 | ||
| API_TITLE | Yes | The FastAPI title | Example API Name | ||
| API_DESCRIPTION | No | A brief Description | The FastAPI description | An Example of a short description about an API | |
| API_REGISTER_PATH | Yes | The url of the Keeper registration endpoint (similar to consul) | http://keeper:8100/register | ||
| API_HEALTH_PATH | No | The path relative to this FastAPI to call for health checks | /health | ||
| API_HEALTH_INTERVAL | No | 300 | The frequency to perform health checks (in seconds) | 300 | |
| API_VERSION | No | 0.0.1 | The version of this FastAPI | 0.0.1-alpha | |
| API_TAGS | No | The tags for this microservice, used as part of discovery, delimited with ":" (like $PATH) | servicetag1:servicetag2:servicetag3 | ||
| API_CORS_ALLOW_ORIGINS | No | * | The CORS allowed origins, delimited with "!" | No | |
| API_CORS_ALLOW_METHODS | No | * | The CORS allowed methods, delimited with "!" | No | |
| API_CORS_ALLOW_HEADERS | No | * | The CORS allowed headers, delimited with "!" | No |
Example .env file:
# API config
# ==========
API_BIND="0.0.0.0"
API_HOST="localhost"
API_PORT="8888"
API_TITLE="test"
API_DESCRIPTION="test description"
API_VERSION="0.0.1-alpha"
# microservice registration
# =========================
API_KEEPER_URL="http://localhost:8100/register"
API_HEALTH_PATH="/health"
API_HEALTH_INTERVAL="300"
Authors & Contributors
- Patrick Coffey - Author
- Asanga Abeyaratne - Contributor
Metadata
Release files for picoapi 1.0.4
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 |
|---|---|---|---|---|
| picoapi-1.0.4.tar.gz | 4.1 kB | Without provenance | Details for picoapi-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| picoapi-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for picoapi-1.0.4-py3-none-any.whl |
Total release size: 9.6 kB
Release files / picoapi-1.0.4.tar.gz
| Download URL | picoapi-1.0.4.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d75fb5ca872f28c6643c7ef514f2e6b5d8e4b39f28225082e39ae4730d871fb
|
|
BLAKE2b-256 checksum How to use checksums |
1b4f9b188cb8c86576492d10fcebb9fb9fc495d4eaddba609549efd17dd33a15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
|
Release files / picoapi-1.0.4-py3-none-any.whl
| Download URL | picoapi-1.0.4-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a5f2f18e57b6523283fddae1cf600cea6348b93fa63dd7a74734ba8ec16a049
|
|
BLAKE2b-256 checksum How to use checksums |
e3bb0457525bea8f5bba9b299de310121a805e6f3e4ab7c7b7fca26db0d00525
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
|
Security for picoapi 1.0.4
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.