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.4.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.4-py3-none-any.whl (91.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fast_mu_builder-0.1.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 8566fc725836ec4301266a436d6ef22f14f5c35b4c3fc268e494445a50c35ab0
MD5 afd25e2d170df6ad2add9a09ea8148cb
BLAKE2b-256 aba1fb00f4d9489d4de6bee5392a780dd7f19c4ffa56772d35e1c033aaeed600

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fast_mu_builder-0.1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a0bb06f27a986a0ad0b02c84feee5f334487cd5a9edf554147ae9f7b632f271b
MD5 41c5b4d8c9ae72f9ca7802b24c414042
BLAKE2b-256 c4a3c221cc314892687862d987ea462bebcf2ebf3e5046f76eb0b5e6ea8a7c16

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