Skip to main content

A FastAPI helper/builder package

Project description

Building The package:

python setup.py sdist bdist_wheel

install the package to your app:

pip install path/to/wheel file

generating Graphql schemas

graphql gen:crud-api --model Model1,Model2,Model3

generating graphql schemas with attachments

graphql gen:crud-api --model ModelName --with-attachment

for attachments you must have minio server and these .env configs:

MINIO_SERVER=ip_address:api_port MINIO_BUCKET=backet-name MINIO_ACCESS_KEY=minio-username MINIO_SECRETE_KEY=minio-password MINIO_SECURE=False

You must initialize the MinioService before using it by:

@app.on_event("startup") async def startup_event(): # Run the init_minio_service in the background without blocking the app startup asyncio.create_task(init_minio_service())

async def init_minio_service(): minio_service = MinioService() try: await minio_service.init( server=config('MINIO_SERVER'), access_key=config('MINIO_ACCESS_KEY'), secret_key=config('MINIO_SECRETE_KEY'), bucket_name=config('MINIO_BUCKET'), secure=config('MINIO_SECURE', cast=bool) ) except Exception as e: print(f"Error initializing MinIO service: {e}")

Making it async will easy your app booting process.

If you need to use the service out of generated crud apis yo do:

For uploading:

file_location, upload_error = await MinioService.get_instance().upload_file( file_name=f"path/to/file.extension", file_data=base64_decoded_file, content_type=attachment.file.content_type )

For downloading:

base64_content = await MinioService.get_instance().download_file("path/to/file.extension")

For deleting:

result = MinioService.get_instance().delete_file("path/to/file.extension")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fast_backend_builder-0.1.0.tar.gz (66.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fast_backend_builder-0.1.0-py3-none-any.whl (87.7 kB view details)

Uploaded Python 3

File details

Details for the file fast_backend_builder-0.1.0.tar.gz.

File metadata

  • Download URL: fast_backend_builder-0.1.0.tar.gz
  • Upload date:
  • Size: 66.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for fast_backend_builder-0.1.0.tar.gz
Algorithm Hash digest
SHA256 849ac48677300bf2a0df905be05fbf0fb68876e06451a2ee385e8d705dee03aa
MD5 2c39eb8cfefba0d338395d939b0dd79b
BLAKE2b-256 7a2ec153b77f3c2d7ea09b6d55fd81ae08cd2b7c09a1374264690222dc49b3fe

See more details on using hashes here.

File details

Details for the file fast_backend_builder-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fast_backend_builder-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 91edb67b8c79ae6ad519c2f0a6f8f3051f135fe73cc9ff60755bc7056892b161
MD5 08014535672287c70fbf50e92cd1d878
BLAKE2b-256 8104efedc3ab2c61d351dee3f1cd649f7062ff787c117791d03dceb6fdca4d08

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page