Skip to main content

FastAPI Builder with Tortoise ORM support for MU

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_mu_builder-0.1.0.3.tar.gz (71.1 kB view details)

Uploaded Source

Built Distribution

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

fast_mu_builder-0.1.0.3-py3-none-any.whl (91.1 kB view details)

Uploaded Python 3

File details

Details for the file fast_mu_builder-0.1.0.3.tar.gz.

File metadata

  • Download URL: fast_mu_builder-0.1.0.3.tar.gz
  • Upload date:
  • Size: 71.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for fast_mu_builder-0.1.0.3.tar.gz
Algorithm Hash digest
SHA256 2e227abbcc65b42f5121a873d6ed239a050cb0350c3f3f0e5741946f743da69e
MD5 d694d017bbb0016daa8c4c478ed29fcc
BLAKE2b-256 17e5aaad834fc0a4cb45de01fed17763c304bf27fb53089ed80e1e8dd382875a

See more details on using hashes here.

File details

Details for the file fast_mu_builder-0.1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for fast_mu_builder-0.1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 da10c9911e7dd13def279283270cf6859a416403f3394a39a1c9ebebd85e78b2
MD5 c59ced55a0f244acae089e1a58830bc5
BLAKE2b-256 b412eaec224c33547b5eb033287ce027026e9e991b974629114d6276bb215889

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