{"id":13480779,"url":"https://github.com/numberly/flask-stupe","last_synced_at":"2025-10-27T21:14:03.612Z","repository":{"id":43288532,"uuid":"126457107","full_name":"numberly/flask-stupe","owner":"numberly","description":":syringe: a.k.a. « Flask on steroids »","archived":false,"fork":false,"pushed_at":"2025-03-06T15:43:43.000Z","size":610,"stargazers_count":27,"open_issues_count":6,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T02:35:36.722Z","etag":null,"topics":["flask","flask-extensions","json","marshmallow","mongodb","pypy3","python","python-library","python3"],"latest_commit_sha":null,"homepage":"https://flask-stupe.readthedocs.io","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/numberly.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}},"created_at":"2018-03-23T08:41:46.000Z","updated_at":"2025-03-06T14:59:30.000Z","dependencies_parsed_at":"2022-09-02T10:02:37.548Z","dependency_job_id":null,"html_url":"https://github.com/numberly/flask-stupe","commit_stats":null,"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numberly%2Fflask-stupe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numberly%2Fflask-stupe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numberly%2Fflask-stupe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numberly%2Fflask-stupe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/numberly","download_url":"https://codeload.github.com/numberly/flask-stupe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248674993,"owners_count":21143761,"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":["flask","flask-extensions","json","marshmallow","mongodb","pypy3","python","python-library","python3"],"created_at":"2024-07-31T17:00:44.907Z","updated_at":"2025-10-27T21:13:58.556Z","avatar_url":"https://github.com/numberly.png","language":"Python","funding_links":[],"categories":["Libraries"],"sub_categories":["Python"],"readme":".. image:: https://raw.githubusercontent.com/numberly/flask-stupe/master/artwork/stupeflask.png\n   :target: https://youtu.be/PdaAHMztNVE\n\n|\n\n.. image:: https://img.shields.io/pypi/v/flask-stupe.svg\n   :target: https://pypi.python.org/pypi/Flask-Stupe\n.. image:: https://img.shields.io/github/license/numberly/flask-stupe.svg\n   :target: https://github.com/numberly/flask-stupe/blob/master/LICENSE\n.. image:: https://github.com/numberly/flask-stupe/actions/workflows/testing.yml/badge.svg\n   :target: https://github.com/numberly/flask-stupe/actions\n.. image:: https://img.shields.io/coveralls/numberly/flask-stupe.svg\n   :target: https://coveralls.io/github/numberly/flask-stupe\n.. image:: https://readthedocs.org/projects/flask-stupe/badge\n   :target: http://flask-stupe.readthedocs.io\n\n|\n\n*a.k.a. « Flask on steroids »*\n\nAn opinionated Flask_ extension designed by and for web developers to reduce\nboilerplate code when working with Marshmallow_, MongoDB_ and/or JSON.\n\nDocumentation: https://flask-stupe.readthedocs.io\n\n\nFeatures\n========\n\n* Return any object type in views, and it will be coerced to a\n  :code:`flask.Response`\n* Validate payloads through Marshmallow_ schemas\n* Easily add JSON converters for any custom type\n* Fetch all the blueprints from a whole module in one line\n* Native ObjectId support for both Flask_ and Marshmallow_\n* Powerful configuration management\n* Decorators to handle authentication, permissions, and pagination\n* 100% coverage and no dependency\n\n\nInstall\n=======\n\n.. code-block:: sh\n\n   $ pip install flask-stupe\n\n\nComparison\n==========\n\nHere is a comparison of a bare Flask_ application and its equivalent Stupeflask\nversion. They both rely on MongoDB_, handle input and output in JSON, and allow\nto create a user and retrieve one or more.\n\n+--------------------------------------------------------+-----------------------------------------------------+\n| **Bare Flask**                                         | **With Stupeflask**                                 |\n+--------------------------------------------------------+-----------------------------------------------------+\n|.. code-block:: python                                  |.. code-block:: python                               |\n|                                                        |                                                     |\n|  from bson import ObjectId                             |  from flask import request                          |\n|  from flask import abort, Flask, jsonify, request      |  from flask_stupe import paginate, schema_required  |\n|  from marshmallow import Schema                        |  from flask_stupe.json import Stupeflask            |\n|  from marshmallow.fields import String                 |  from marshmallow import Schema                     |\n|  from pymongo import MongoClient                       |  from marshmallow.fields import String              |\n|                                                        |  from pymongo import MongoClient                    |\n|  app = Flask(__name__)                                 |                                                     |\n|  users = MongoClient().database.users                  |  app = Stupeflask(__name__)                         |\n|                                                        |  users = MongoClient().database.users               |\n|                                                        |                                                     |\n|  class UserSchema(Schema):                             |                                                     |\n|      username = String(required=True)                  |  class UserSchema(Schema):                          |\n|      password = String()                               |      username = String(required=True)               |\n|                                                        |      password = String()                            |\n|                                                        |                                                     |\n|  @app.route(\"/user\", methods=[\"POST\"])                 |                                                     |\n|  def post_user():                                      |  @app.route(\"/user\", methods=[\"POST\"])              |\n|      json = request.get_json(force=True)               |  @schema_required(UserSchema())                     |\n|      validation_result = UserSchema().load(json)       |  def post_user():                                   |\n|      if validation_result.errors:                      |      result = users.insert_one(request.schema)      |\n|          abort(400, validation_result.errors)          |      request.schema.update(_id=result.inserted_id)  |\n|      result = users.insert_one(validation_result.data) |      return request.schema                          |\n|      inserted_id = str(result.inserted_id)             |                                                     |\n|      validation_result.data.update(_id=inserted_id)    |                                                     |\n|      return jsonify(validation_result.data)            |  @app.route(\"/user/\u003cObjectId:id\u003e\")                  |\n|                                                        |  def get_user(id):                                  |\n|                                                        |      return users.find_one({\"_id\": id})             |\n|  @app.route(\"/user/\u003cid\u003e\")                              |                                                     |\n|  def get_user(id):                                     |                                                     |\n|      try:                                              |  @app.route(\"/users\")                               |\n|          id = ObjectId(id)                             |  @paginate(limit=100)                               |\n|      except ValueError:                                |  def get_users():                                   |\n|          abort(404)                                    |      return users.find()                            |\n|      user = users.find_one({\"_id\": id})                |                                                     |\n|      user[\"_id\"] = str(user[\"_id\"])                    |                                                     |\n|      return jsonify(user)                              |                                                     |\n|                                                        |                                                     |\n|                                                        |                                                     |\n|  @app.route(\"/users\")                                  |                                                     |\n|  def get_users():                                      |                                                     |\n|      limit = request.args.get(\"limit\", 100, type=int)  |                                                     |\n|      skip = request.args.get(\"skip\", 0, type=int)      |                                                     |\n|      cursor = users.find().limit(limit).skip(skip)     |                                                     |\n|      return jsonify(list(cursor))                      |                                                     |\n+--------------------------------------------------------+-----------------------------------------------------+\n\n\nTests\n=====\n\nTo run Flask-Stupe tests:\n\n* install developers requirements with ``pip install -r dev-requirements.txt``;\n* run ``pytest``.\n\n\nLicense\n=======\n\nMIT\n\n\n.. _Flask: http://flask.pocoo.org/\n.. _Marshmallow: https://marshmallow.readthedocs.io/en/latest/\n.. _MongoDB: https://www.mongodb.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumberly%2Fflask-stupe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumberly%2Fflask-stupe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumberly%2Fflask-stupe/lists"}