{"id":13806492,"url":"https://github.com/colinhiggs/pyramid-jsonapi","last_synced_at":"2025-07-19T06:03:41.705Z","repository":{"id":35187489,"uuid":"39445389","full_name":"colinhiggs/pyramid-jsonapi","owner":"colinhiggs","description":"Auto-build JSON API from sqlalchemy models using the pyramid framework","archived":false,"fork":false,"pushed_at":"2023-10-05T14:45:17.000Z","size":9751,"stargazers_count":27,"open_issues_count":13,"forks_count":15,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-11T23:43:48.290Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/colinhiggs.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}},"created_at":"2015-07-21T12:58:20.000Z","updated_at":"2024-12-30T22:22:14.000Z","dependencies_parsed_at":"2024-01-03T01:30:49.503Z","dependency_job_id":null,"html_url":"https://github.com/colinhiggs/pyramid-jsonapi","commit_stats":{"total_commits":1021,"total_committers":5,"mean_commits":204.2,"dds":"0.26346718903036237","last_synced_commit":"762eb0d6245a6dd2fefcabadc7d61a5e5fcaf4a8"},"previous_names":[],"tags_count":60,"template":false,"template_full_name":null,"purl":"pkg:github/colinhiggs/pyramid-jsonapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinhiggs%2Fpyramid-jsonapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinhiggs%2Fpyramid-jsonapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinhiggs%2Fpyramid-jsonapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinhiggs%2Fpyramid-jsonapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/colinhiggs","download_url":"https://codeload.github.com/colinhiggs/pyramid-jsonapi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinhiggs%2Fpyramid-jsonapi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265895902,"owners_count":23845403,"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":[],"created_at":"2024-08-04T01:01:12.447Z","updated_at":"2025-07-19T06:03:41.677Z","avatar_url":"https://github.com/colinhiggs.png","language":"Python","funding_links":[],"categories":["RESTful API"],"sub_categories":[],"readme":"The pyramid-jsonapi project\n===========================\n\n.. image:: https://img.shields.io/pypi/v/pyramid_jsonapi.svg\n  :target: https://pypi.python.org/pypi/pyramid_jsonapi\n\n.. image:: https://img.shields.io/pypi/pyversions/pyramid_jsonapi.svg\n\n.. image:: https://travis-ci.org/colinhiggs/pyramid-jsonapi.svg?branch=master\n  :target: https://travis-ci.org/colinhiggs/pyramid-jsonapi\n\n.. image:: https://coveralls.io/repos/github/colinhiggs/pyramid-jsonapi/badge.svg?branch=master\n  :target: https://coveralls.io/github/colinhiggs/pyramid-jsonapi?branch=master\n\n.. image:: https://colinhiggs.github.io/pyramid-jsonapi/pylint-badge.svg\n\nCreate a JSON-API (`\u003chttp://jsonapi.org/\u003e`_) standard API from a database using\nthe sqlAlchemy ORM and pyramid framework.\n\nThe core idea behind pyramid-jsonapi is to create a working JSON-API\nautomatically, starting from the sort of ``models.py`` file shipped with a\ntypical pyramid + sqlalchemy application.\n\n.. note::\n\n  The default branch of pyramid_jsonapi is now the 2.2 branch.\n\nDocumentation\n-------------\n\nDocumentation is available at: `\u003chttps://colinhiggs.github.io/pyramid-jsonapi/\u003e`_\n\nQuick start\n===========\n\nInstalling `pyramid_jsonapi`\n----------------------------\n\n.. code-block:: bash\n\n  pip install -i pyramid_jsonapi\n\nSee :ref:`getting-started` for other installation options, including installing\ndevelopment versions.\n\nAuto-Creating an API\n--------------------\n\nDeclare your models somewhere using sqlalchemy's\n:func:`sqlalchemy.ext.declarative.declarative_base`. In this documentation we\nassume that you have done so in a file called ``models.py``:\n\n.. code-block:: python\n\n  class Person(Base):\n      __tablename__ = 'people'\n      id = Column(BigInteger, primary_key=True, autoincrement=True)\n      name = Column(Text)\n      blogs = relationship('Blog', backref='owner')\n      posts = relationship('Post', backref='author')\n\n  # and the rest...\n\nIf you are happy with the defaults, you can get away with the following\nadditions to the standard pyramid alchemy scaffold's top level ``__init__.py``:\n\n.. code-block:: python\n\n  import pyramid_jsonapi\n\n  from . import models # Your models module.\n\n\n  def main(global_config, **settings):\n\n    # The usual stuff from the pyramid alchemy setup.\n    config = Configurator(settings=settings)\n\n    # pyramid_jsonapi uses the renderer labelled 'json'. As usual, if you have\n    # any types to serialise that the default JSON renderer can't handle, you\n    # must alter it. For example:\n    #\n    #renderer = JSON(sort_keys=True)\n    #renderer.add_adapter(datetime.date, datetime_adapter)\n    #config.add_renderer('json', renderer)\n\n    # Instantiate a PyramidJSONAPI class instance.\n    pj = pyramid_jsonapi.PyramidJSONAPI(config, models)\n\n    # If you are using pyramid 1.7 or older, you will need to pass a third\n    # argument to the constructor: a callable which accepts a CollectionView\n    # instance as an argument and returns a sqlalchemy database session.\n    #\n    # For example:\n    # pj = pyramid_jsonapi.PyramidJSONAPI(\n    #   config, models, lambda view: models.DBSession\n    # )\n\n    # Create the routes and views automagically:\n    pj.create_jsonapi_using_magic_and_pixie_dust()\n\n    # Routes and views are added imperatively, so no need for a scan - unless\n    # you have defined other routes and views declaratively.\n\n    return config.make_wsgi_app()\n\nOr, without all the comments:\n\n.. code-block:: python\n\n  import pyramid_jsonapi\n\n  from . import models\n\n\n  def main(global_config, **settings):\n    config = Configurator(settings=settings)\n    pj = pyramid_jsonapi.PyramidJSONAPI(config, models)\n    pj.create_jsonapi_using_magic_and_pixie_dust()\n    return config.make_wsgi_app()\n\nYes, there really is a method called\n:func:`pyramid_jsonapi.PyramidJSONAPI.create_jsonapi_using_magic_and_pixie_dust`. No, you\ndon't *have* to call it that. If you are feeling more sensible you can use the\nsynonym :func:`pyramid_jsonapi.PyramidJSONAPI.create_jsonapi`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolinhiggs%2Fpyramid-jsonapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcolinhiggs%2Fpyramid-jsonapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolinhiggs%2Fpyramid-jsonapi/lists"}