{"id":6926,"library":"tuspyserver","title":"TuspyServer","description":"TuspyServer is a Python library implementing the tus.io resumable upload protocol as a FastAPI router. It provides flexible backend storage options, including local disk (DiskStorage) and AWS S3 (S3Storage). The current version is 4.2.3, and it's actively maintained with regular updates and feature enhancements.","status":"active","version":"4.2.3","language":"en","source_language":"en","source_url":"https://github.com/tushar552/tuspyserver","tags":["tus","file-upload","fastapi","resumable-upload","s3","disk-storage","async"],"install":[{"cmd":"pip install tuspyserver","lang":"bash","label":"Base installation"},{"cmd":"pip install tuspyserver[s3]","lang":"bash","label":"With S3 storage support"}],"dependencies":[{"reason":"Core framework for the tus server router.","package":"fastapi","optional":false},{"reason":"ASGI server for running the FastAPI application.","package":"uvicorn","optional":false},{"reason":"Required by FastAPI for parsing form data, especially for file uploads.","package":"python-multipart","optional":false},{"reason":"Required for S3Storage backend to interact with AWS S3.","package":"boto3","optional":true}],"imports":[{"symbol":"TuspyServer","correct":"from tuspyserver import TuspyServer"},{"note":"Old storage classes like `FileStorage` were removed in v4.x. Use `DiskStorage` or `S3Storage` instead.","wrong":"from tuspyserver.storage import FileStorage","symbol":"DiskStorage","correct":"from tuspyserver import DiskStorage"},{"symbol":"S3Storage","correct":"from tuspyserver import S3Storage"}],"quickstart":{"code":"import os\nfrom fastapi import FastAPI\nfrom tuspyserver import TuspyServer, DiskStorage\n\napp = FastAPI()\n\n# Ensure the upload directory exists for DiskStorage\nupload_dir = os.path.join(os.getcwd(), \"upload_data\")\nos.makedirs(upload_dir, exist_ok=True)\n\n# Initialize DiskStorage. For S3Storage, use: \n# S3Storage(\n#     bucket_name=os.environ.get('S3_BUCKET_NAME', 'your-s3-bucket'),\n#     aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', ''),\n#     aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', ''),\n#     # region_name=os.environ.get('AWS_REGION', 'us-east-1')\n# )\nstorage = DiskStorage(upload_dir)\n\n# Initialize TuspyServer with the chosen storage backend\ntus_server = TuspyServer(storage)\n\n# Add the TuspyServer router to your FastAPI app\napp.include_router(tus_server.router, prefix=\"/files\")\n\n# Optional: Add an endpoint to list uploaded files (for demonstration)\n@app.get(\"/uploaded-files\")\nasync def list_files():\n    return storage.list_files()\n\n# To run this app, save it as main.py and execute:\n# uvicorn main:app --reload --port 8000\n","lang":"python","description":"This quickstart sets up a basic `tuspyserver` instance with `DiskStorage` using FastAPI. It initializes the storage, ensures the upload directory exists, integrates the `TuspyServer` router into the FastAPI application under the `/files` prefix, and includes an example endpoint to list uploaded files. Remember to install `uvicorn` and run the app with `uvicorn main:app`."},"warnings":[{"fix":"Replace imports like `from tuspyserver.storage import FileStorage` with `from tuspyserver import DiskStorage` and instantiate `DiskStorage` or `S3Storage` instead.","message":"Major refactor in v4.0.0 removed old storage implementations (e.g., `FileStorage`, `MemoryStorage`). Users must migrate to the new `DiskStorage` or `S3Storage` classes.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Upgrade your Python environment to 3.8 or a later version to use `tuspyserver` v3.0.0 or higher.","message":"Python 3.7 support was dropped in v3.0.0. The library now requires Python 3.8 or newer for compatibility.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Ensure `pip install tuspyserver[s3]` is executed if planning to utilize AWS S3 for file storage, as `boto3` is not included in the base installation.","message":"When using `S3Storage`, the `boto3` library is a conditional dependency and must be installed explicitly using `pip install tuspyserver[s3]`.","severity":"gotcha","affected_versions":"All"},{"fix":"After creating your FastAPI application (e.g., in `main.py`), run it using `uvicorn main:app --reload` in your terminal for development.","message":"The `tuspyserver` integrates as a FastAPI router, meaning your application needs to be run using an ASGI server like Uvicorn. While `uvicorn` is a dependency, you still need to know how to execute it.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}