{"id":13534391,"url":"https://github.com/amol-/depot","last_synced_at":"2025-05-16T14:09:00.411Z","repository":{"id":17674364,"uuid":"20479128","full_name":"amol-/depot","owner":"amol-","description":"Toolkit for storing files and attachments in web applications","archived":false,"fork":false,"pushed_at":"2024-02-22T21:33:54.000Z","size":553,"stargazers_count":163,"open_issues_count":8,"forks_count":40,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-12T12:51:29.192Z","etag":null,"topics":["file-upload","gridfs","inmemory","mongodb","python","s3","s3-storage","sqlachemy","testing","webdevelopment"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amol-.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-06-04T10:27:12.000Z","updated_at":"2025-02-13T12:30:43.000Z","dependencies_parsed_at":"2024-06-18T15:33:17.437Z","dependency_job_id":"e229088a-377a-4db8-81d7-108774d66aa2","html_url":"https://github.com/amol-/depot","commit_stats":{"total_commits":274,"total_committers":21,"mean_commits":"13.047619047619047","dds":0.3832116788321168,"last_synced_commit":"3d3948f589ca09a0feb30a15f5b06d95b6ceceac"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amol-%2Fdepot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amol-%2Fdepot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amol-%2Fdepot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amol-%2Fdepot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amol-","download_url":"https://codeload.github.com/amol-/depot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254368443,"owners_count":22059680,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file-upload","gridfs","inmemory","mongodb","python","s3","s3-storage","sqlachemy","testing","webdevelopment"],"created_at":"2024-08-01T07:01:32.045Z","updated_at":"2025-05-16T14:08:55.403Z","avatar_url":"https://github.com/amol-.png","language":"Python","funding_links":[],"categories":["Python","webdevelopment","Database Clients"],"sub_categories":[],"readme":"\n.. image:: https://raw.github.com/amol-/depot/master/docs/_static/logo.png\n\nDEPOT - File Storage Made Easy\n==============================\n\n.. image:: https://github.com/amol-/depot/actions/workflows/run-tests.yml/badge.svg\n    :target: https://github.com/amol-/depot/actions/workflows/run-tests.yml\n\n.. image:: https://coveralls.io/repos/amol-/depot/badge.png?branch=master\n    :target: https://coveralls.io/r/amol-/depot?branch=master \n\n.. image:: https://img.shields.io/pypi/v/filedepot.svg\n   :target: https://pypi.python.org/pypi/filedepot\n\nDEPOT is a framework for easily storing and serving files in\nweb applications on Python2.6+ and Python3.2+.\n\nDEPOT supports storing files in multiple backends, like:\n\n* Local Disk\n* In Memory (for tests)\n* On GridFS\n* On Amazon S3 (or compatible services)\n* On Google Cloud Storage\n\nand integrates with database by providing files\nattached to your **SQLAlchemy** or **Ming/MongoDB** models\nwith respect to transactions behaviours (files are rolled back too).\n\nInstalling\n----------\n\nInstalling DEPOT can be done from PyPi itself by installing the ``filedepot`` distribution::\n\n    $ pip install filedepot\n\nGetting Started\n---------------\n\nTo start using Depot refer to `Documentation \u003chttps://depot.readthedocs.io/en/latest/\u003e`_\n\nDEPOT was `presented at PyConUK and PyConFR \u003chttp://www.slideshare.net/__amol__/pyconfr-2014-depot-story-of-a-filewrite-gone-wrong\u003e`_ in 2014\n\nstandalone\n~~~~~~~~~~\n\nHere is a simple example of using depot standalone to store files on MongoDB::\n\n    from depot.manager import DepotManager\n\n    # Configure a *default* depot to store files on MongoDB GridFS\n    DepotManager.configure('default', {\n        'depot.backend': 'depot.io.gridfs.GridFSStorage',\n        'depot.mongouri': 'mongodb://localhost/db'\n    })\n\n    depot = DepotManager.get()\n\n    # Save the file and get the fileid\n    fileid = depot.create(open('/tmp/file.png'))\n\n    # Get the file back\n    stored_file = depot.get(fileid)\n    print stored_file.filename\n    print stored_file.content_type\n\nmodels\n~~~~~~\n\nOr you can use depot with SQLAlchemy to store attachments::\n\n    from depot.fields.sqlalchemy import UploadedFileField\n    from depot.fields.specialized.image import UploadedImageWithThumb\n\n\n    class Document(Base):\n        __tablename__ = 'document'\n\n        uid = Column(Integer, autoincrement=True, primary_key=True)\n        name = Column(Unicode(16), unique=True)\n        content = Column('content_col', UploadedFileField)  # plain attached file\n\n        # photo field will automatically generate thumbnail\n        photo = Column(UploadedFileField(upload_type=UploadedImageWithThumb))\n\n\n    # Store documents with attached files, the source can be a file or bytes\n    doc = Document(name=u'Foo',\n                content=b'TEXT CONTENT STORED AS FILE',\n                photo=open('/tmp/file.png'))\n    DBSession.add(doc)\n    DBSession.flush()\n\n    # DEPOT is session aware, commit/rollback to keep or delete the stored files.\n    DBSession.commit()\n\nChangeLog\n---------\n\n0.11.0\n~~~~~~\n\n- Officially support Python 3.12\n- Addressed deprecation of ``Image.ANTIALIAS`` in Pillow, ``Image.LANCZOS`` is used instead\n- TurboGears2 is no longer needed to run tests\n- Depot is now compatible with ``multipart`` module or other replacements of ``cgi.FieldStorage``\n- Fixed an open file leak in ``UploadedImageWithThumb``\n- Fixed an open file leak in ``WithThumbnailFilter``\n\n0.10.0\n~~~~~~\n\n- Added support for Google Cloud Storage\n- Fixed ACL issues with S3\n- Deprecated boto2 backend, use boto3\n- Added support for performing backups by copying to another storage\n\n0.9.0\n~~~~~\n\n- Support for SQLAlchemy 1.4 and 2.0\n- Support for SQLAlchemy objects deleted with ``.delete(synchronize_session=\"fetch\")``\n- Tests migrated to ``unittest``\n\n0.8.0\n~~~~~\n\n- Replaced ``unidecode`` dependency with ``anyascii`` to better cope with MIT License.\n\n0.7.1\n~~~~~\n\n- Fix a bug in AWS-S3 support for unicode filenames.\n\n0.7.0\n~~~~~\n\n- Support for ``storage_class`` option in ``depot.io.boto3.S3Storage`` backend. Detaults to ``STANDARD``\n\n0.6.0\n~~~~~\n\n- Officially support Python 3.7\n- Fix DEPOT wrongly serving requests for any url that starts with the mountpoint. (IE: ``/depotsomething`` was wrongly served for ``/depot`` mountpoint)\n- In SQLAlchemy properly handle deletion of objects deleted through ``Relationship.remove`` (IE: ``parent.children.remove(X)``)\n- In SQLAlchemy properly handle entities deleted through ``cascade='delete-orphan'``\n\n0.5.2\n~~~~~\n\n- Fixed an *start_response called a second time without providing exc_info* error with storages supporting plublic urls\n\n\n0.5.1\n~~~~~\n\n- URLs generated by ``DepotMiddleware`` are now guaranteed to be plain ascii\n- [Breaking change]: Bucket existance with S3 storages should now be more reliable when the\n  bucket didn't already exist, but it requires an additional AWS policy: `s3:ListAllMyBuckets` that wasn't required on 0.5.0\n\n0.5.0\n~~~~~\n\n- ``depot.io.boto3.S3Storage`` now provides support for accessing S3 with ``boto3``.\n  The previously existing ``depot.io.awss3.S3Storage`` can still be used to store\n  files on S3 using ``boto``.\n- SQLAlchemy integration now handles deletion of files on rollback when session\n  is not flushed. Previously flushing the session was required before a rollback too.\n- It is now possible to run tests through ``tox`` and build docs through ``tox -e docs``\n- DEPOT is now tested against Python 3.6\n\n0.4.1\n~~~~~\n\n- Fixed installation error on non-UTF8 systems\n- Improved support for polymorphic subtypes in SQLAlchemy\n\n0.4.0\n~~~~~\n\n- Support for Python 3.5\n- Fixed ``Content-Disposition`` header for filenames including a comma\n\n0.3.2\n~~~~~\n\n- ``MemoryFileStorage`` now accepts any option, for easier testing configuration\n\n0.3.1\n~~~~~\n\n* Fixed ``Content-Disposition`` header when serving from S3 directly\n* Fixed size of SQLAlchemy field on Oracle (was bigger than the allowed maximum)\n\n0.3.0\n~~~~~\n\n- ``MemoryFileStorage`` provides in memory storage for files. This is meant to provide a\n  convenient way to speed up test suites and avoid fixture clean up issues.\n- S3Storage can now generate public urls for private files (expire in 1 year)\n- Files created from plain bytes are now named \"unnamed\" instead of missing a filename.\n\n0.2.1\n~~~~~\n\n- ``S3Storage`` now supports the ``prefix`` option to store files in a subpath\n\n0.2.0\n~~~~~\n\n- Storages now provide a ``list`` method to list files available on the store (This is not meant to be used to retrieve files uploaded by depot as it lists all the files).\n- ``DepotExtension`` for Ming is now properly documented\n\n0.1.2\n~~~~~\n\n- It is now possible to use multiple ``WithThumbnailFilter`` to generate multiple thumbnails\n  with different resolutions.\n- Better documentation for MongoDB ``UploadedFileProperty``\n\n0.1.1\n~~~~~\n\n- Fixed a bug with Ming support when acessing ``UploadedFileProperty`` as a class property\n- Improved support for DEPOT inside TurboGears admin when using MongoDB\n\n0.1.0\n~~~~~\n\n- Added ``DepotManager.alias`` to configure aliases to storage.\n  This allows easy migration from one storage to another by switching where the alias points.\n- Now ``UploadedFileField`` permits to specify ``upload_storage`` to link a Model Column to a specific storage.\n- Added ``policy`` and ``encrypt_key`` options to `S3Storage` to upload private and encrypted files.\n\n0.0.6\n~~~~~\n\n- Added `host` option to `S3Storage` to allow using providers different from *AWS*.\n\n0.0.5\n~~~~~\n\n- Added `FileIntent` to explicitly provide `content_type` and `filename` to uploaded content.\n\n0.0.4\n~~~~~\n\n- Added Content-Disposition header with original filename in WSGI middleware\n\n0.0.3\n~~~~~\n\n- Work-Around for issue with `wsgi.file_wrapper` provided by Waitress WSGI Server\n\n0.0.2\n~~~~~\n\n- Official Support for AWS S3 on Python3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famol-%2Fdepot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famol-%2Fdepot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famol-%2Fdepot/lists"}