{"id":15572894,"url":"https://github.com/pylons/deform","last_synced_at":"2025-05-15T04:04:08.148Z","repository":{"id":947858,"uuid":"1372780","full_name":"Pylons/deform","owner":"Pylons","description":"A Python HTML form library.","archived":false,"fork":false,"pushed_at":"2024-06-08T22:42:48.000Z","size":5848,"stargazers_count":420,"open_issues_count":59,"forks_count":163,"subscribers_count":31,"default_branch":"main","last_synced_at":"2025-05-15T04:02:13.184Z","etag":null,"topics":["bootstrap","chameleon","colander","deform","forms","peppercorn","pyramid","python"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Pylons.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.txt","contributing":"contributing.md","funding":null,"license":"LICENSE.txt","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":"2011-02-16T06:29:46.000Z","updated_at":"2025-04-22T15:20:03.000Z","dependencies_parsed_at":"2022-07-15T20:30:35.970Z","dependency_job_id":"369919c8-e8c0-447d-b9cd-d9494b960d86","html_url":"https://github.com/Pylons/deform","commit_stats":{"total_commits":1390,"total_committers":103,"mean_commits":"13.495145631067961","dds":0.6035971223021583,"last_synced_commit":"fdc43d59de7d11b0e3ba1b92835b780cfe181719"},"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pylons%2Fdeform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pylons%2Fdeform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pylons%2Fdeform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pylons%2Fdeform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pylons","download_url":"https://codeload.github.com/Pylons/deform/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254270641,"owners_count":22042858,"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":["bootstrap","chameleon","colander","deform","forms","peppercorn","pyramid","python"],"created_at":"2024-10-02T18:07:45.268Z","updated_at":"2025-05-15T04:04:08.067Z","avatar_url":"https://github.com/Pylons.png","language":"JavaScript","readme":"Deform\n======\n\n.. image:: https://github.com/Pylons/deform/workflows/Build%20and%20test/badge.svg?branch=main\n    :target: https://github.com/Pylons/deform/actions?query=workflow%3A%22Build+and+test%22+branch%3Amain\n    :alt: Build Status\n\n.. image:: https://img.shields.io/pypi/v/deform\n    :target: https://pypi.org/project/deform/\n    :alt: Current Release\n\n.. image:: https://readthedocs.org/projects/deform/badge/?version=main\n    :target: https://docs.pylonsproject.org/projects/deform/en/main/\n    :alt: Main Documentation Status\n\n.. image:: https://readthedocs.org/projects/deform/badge/?version=latest\n    :target: https://docs.pylonsproject.org/projects/deform/en/latest/\n    :alt: Latest Documentation Status\n\n.. image:: https://img.shields.io/pypi/pyversions/deform\n    :alt: Python Support\n\n.. contents:: :local:\n\n\nIntroduction\n------------\n\nDeform is a Python form library for generating HTML forms on the server side.\n`Date and time picking widgets \u003chttps://deformdemo.pylonsproject.org/datetimeinput/\u003e`_,\n`rich text editors \u003chttps://deformdemo.pylonsproject.org/richtext/\u003e`_, `forms with\ndynamically added and removed items\n\u003chttps://deformdemo.pylonsproject.org/sequence_of_mappings/\u003e`_ and a few other `complex\nuse cases \u003chttps://deformdemo.pylonsproject.org/\u003e`_ are supported out of the box.\n\nDeform integrates with the `Pyramid web framework \u003chttps://trypyramid.com/\u003e`_\nand several other web frameworks. Deform comes with `Chameleon templates\n\u003chttps://chameleon.readthedocs.io/en/latest/\u003e`_ and `Bootstrap 5\n\u003chttps://getbootstrap.com/docs/5.3/\u003e`_ styling. Under the hood, `Colander schemas\n\u003chttps://github.com/Pylons/colander\u003e`_ are used for serialization and\nvalidation. The `Peppercorn \u003chttps://github.com/Pylons/peppercorn\u003e`_ library\nmaps HTTP form submissions to nested structure.\n\nAlthough Deform uses Chameleon templates internally, you can embed rendered\nDeform forms into any template language.\n\nUse cases\n---------\n\nDeform is ideal for complex server-side generated forms. Potential use cases\ninclude:\n\n* Complex data entry forms\n\n* Administrative interfaces\n\n* Python based websites with high amount of data manipulation forms\n\n* Websites where additional front end framework is not needed\n\nInstallation\n------------\n\nInstall using `pip and Python package installation best practices \u003chttps://packaging.python.org/tutorials/installing-packages/\u003e`_::\n\n    pip install deform\n\nExample\n-------\n\n`See all widget examples \u003chttps://deformdemo.pylonsproject.org\u003e`_. Below is a sample\nform loop using the `Pyramid \u003chttps://trypyramid.com/\u003e`_ web framework.\n\n.. image:: https://github.com/Pylons/deform/raw/main/docs/example.png\n    :width: 400px\n\nExample code:\n\n.. code-block:: python\n\n    \"\"\"Self-contained Deform demo example.\"\"\"\n    from __future__ import print_function\n\n    from pyramid.config import Configurator\n    from pyramid.session import UnencryptedCookieSessionFactoryConfig\n    from pyramid.httpexceptions import HTTPFound\n\n    import colander\n    import deform\n\n\n    class ExampleSchema(deform.schema.CSRFSchema):\n\n        name = colander.SchemaNode(\n            colander.String(),\n            title=\"Name\")\n\n        age = colander.SchemaNode(\n            colander.Int(),\n            default=18,\n            title=\"Age\",\n            description=\"Your age in years\")\n\n\n    def mini_example(request):\n        \"\"\"Sample Deform form with validation.\"\"\"\n\n        schema = ExampleSchema().bind(request=request)\n\n        # Create a styled button with some extra Bootstrap 3 CSS classes\n        process_btn = deform.form.Button(name='process', title=\"Process\")\n        form = deform.form.Form(schema, buttons=(process_btn,))\n\n        # User submitted this form\n        if request.method == \"POST\":\n            if 'process' in request.POST:\n\n                try:\n                    appstruct = form.validate(request.POST.items())\n\n                    # Save form data from appstruct\n                    print(\"Your name:\", appstruct[\"name\"])\n                    print(\"Your age:\", appstruct[\"age\"])\n\n                    # Thank user and take him/her to the next page\n                    request.session.flash('Thank you for the submission.')\n\n                    # Redirect to the page shows after succesful form submission\n                    return HTTPFound(\"/\")\n\n                except deform.exception.ValidationFailure as e:\n                    # Render a form version where errors are visible next to the fields,\n                    # and the submitted values are posted back\n                    rendered_form = e.render()\n        else:\n            # Render a form with initial default values\n            rendered_form = form.render()\n\n        return {\n            # This is just rendered HTML in a string\n            # and can be embedded in any template language\n            \"rendered_form\": rendered_form,\n        }\n\n\n    def main(global_config, **settings):\n        \"\"\"pserve entry point\"\"\"\n        session_factory = UnencryptedCookieSessionFactoryConfig('seekrit!')\n        config = Configurator(settings=settings, session_factory=session_factory)\n        config.include('pyramid_chameleon')\n        deform.renderer.configure_zpt_renderer()\n        config.add_static_view('static_deform', 'deform:static')\n        config.add_route('mini_example', path='/')\n        config.add_view(mini_example, route_name=\"mini_example\", renderer=\"templates/mini.pt\")\n        return config.make_wsgi_app()\n\nThis example is in `deformdemo repository \u003chttps://github.com/Pylons/deformdemo/\u003e`_. Run the example with pserve::\n\n     pserve mini.ini --reload\n\nStatus\n------\n\nThis library is actively developed and maintained. Deform 2.x branch has been used in production on several sites since 2014. Automatic test suite has 100% Python code coverage and 500+ tests.\n\nProjects using Deform\n---------------------\n\n* `Websauna \u003chttps://websauna.org/\u003e`_\n\n* `Kotti \u003chttp://kotti.pylonsproject.org/\u003e`_\n\n* `Substance D \u003chttp://www.substanced.net/\u003e`_\n\nCommunity and links\n-------------------\n\n* `Widget examples \u003chttps://deformdemo.pylonsproject.org\u003e`_\n\n* `PyPI \u003chttps://pypi.org/project/deform/\u003e`_\n\n* `Issue tracker \u003chttps://github.com/Pylons/deform/issues\u003e`_\n\n* `Widget examples repo \u003chttps://github.com/Pylons/deformdemo/\u003e`_\n\n* `Documentation \u003chttps://docs.pylonsproject.org/projects/deform/en/latest/\u003e`_\n\n* `Support \u003chttps://pylonsproject.org/community-support.html\u003e`_\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpylons%2Fdeform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpylons%2Fdeform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpylons%2Fdeform/lists"}