{"id":34067728,"url":"https://github.com/mng-dev-ai/drf-turbo","last_synced_at":"2025-12-14T07:01:00.505Z","repository":{"id":39640934,"uuid":"426664250","full_name":"Mng-dev-ai/drf-turbo","owner":"Mng-dev-ai","description":"An alternative serializer implementation for REST framework written in cython built for speed.","archived":false,"fork":false,"pushed_at":"2023-10-11T01:44:53.000Z","size":630,"stargazers_count":85,"open_issues_count":1,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-26T20:43:56.013Z","etag":null,"topics":["cython","django","django-rest-framework","performance","python"],"latest_commit_sha":null,"homepage":"","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/Mng-dev-ai.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":"CONTRIBUTING.rst","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":"AUTHORS.rst","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-10T14:59:45.000Z","updated_at":"2025-08-19T11:49:17.000Z","dependencies_parsed_at":"2024-10-11T07:12:07.810Z","dependency_job_id":"117e6470-826a-43c9-bb51-ac2a3b0686e4","html_url":"https://github.com/Mng-dev-ai/drf-turbo","commit_stats":{"total_commits":26,"total_committers":2,"mean_commits":13.0,"dds":0.3076923076923077,"last_synced_commit":"ea9a4a4dc324c0b22d33962b79121e13197274c2"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/Mng-dev-ai/drf-turbo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mng-dev-ai%2Fdrf-turbo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mng-dev-ai%2Fdrf-turbo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mng-dev-ai%2Fdrf-turbo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mng-dev-ai%2Fdrf-turbo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mng-dev-ai","download_url":"https://codeload.github.com/Mng-dev-ai/drf-turbo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mng-dev-ai%2Fdrf-turbo/sbom","scorecard":{"id":95207,"data":{"date":"2025-08-11","repo":{"name":"github.com/Mng-dev-ai/drf-turbo","commit":"1ec70d39c10cd81fa421107e4ac2a96da79dccd3"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/11 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/Mng-dev-ai/drf-turbo/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/Mng-dev-ai/drf-turbo/test.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/test.yml:22","Warn: pipCommand not pinned by hash: .github/workflows/test.yml:23","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":4,"reason":"6 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2020-263 / GHSA-fx83-3ph3-9j2q","Warn: Project is vulnerable to: GHSA-gw84-84pc-xp82","Warn: Project is vulnerable to: PYSEC-2021-142 / GHSA-8q59-q68h-6hv4","Warn: Project is vulnerable to: PYSEC-2018-49 / GHSA-rprw-h62v-c2w7","Warn: Project is vulnerable to: GHSA-5vcc-86wm-547q","Warn: Project is vulnerable to: PYSEC-2024-48 / GHSA-fj7x-q9j7-g6q6"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-15T08:50:37.747Z","repository_id":39640934,"created_at":"2025-08-15T08:50:37.748Z","updated_at":"2025-08-15T08:50:37.748Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27720801,"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","status":"online","status_checked_at":"2025-12-14T02:00:11.348Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cython","django","django-rest-framework","performance","python"],"created_at":"2025-12-14T07:00:21.914Z","updated_at":"2025-12-14T07:01:00.492Z","avatar_url":"https://github.com/Mng-dev-ai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"=========\ndrf-turbo\n=========\n\n\n.. image:: https://img.shields.io/pypi/v/drf-turbo.svg\n        :target: https://pypi.python.org/pypi/drf-turbo\n        :alt: Version\n\n.. image:: https://readthedocs.org/projects/drf-turbo/badge/?version=latest\n        :target: https://drf-turbo.readthedocs.io/en/latest/?version=latest\n        :alt: Documentation Status\n\n.. image:: https://static.pepy.tech/personalized-badge/drf-turbo?period=total\u0026units=international_system\u0026left_color=black\u0026right_color=green\u0026left_text=Downloads\n        :target: https://pepy.tech/project/drf-turbo/\n        :alt: Downloads\n\n\nOverview\n------------\ndrf-turbo is a drop-in serializer for Django REST Framework (DRF). drf-turbo serializers run around 7.75 times faster\nthan what what you get from DRF's packaged serializer.\n\n\nRequirements\n------------\n\n* Django\n\n* Django REST Framework\n\n* pytz\n\n* forbiddenfruit\n\n* pyyaml(OpenAPI)\n\n* uritemplate(OpenAPI)\n\n* djangorestframework-simplejwt(OpenAPI)\n\n\nInstallation\n------------\n\n.. code-block:: console\n\n    $ pip install drf-turbo\n\nTo install Cython on MacOS `via Brew \u003chttps://formulae.brew.sh/formula/cython\u003e`_:\n\n.. code-block:: console\n\n    $ brew install cython\n\nPerformance\n-----------\n`drf-turbo` serialization, deserialization and validation performance averages 86% faster than DRF's standard serializer.\n\nFor more details, visit the `benchmarks section \u003chttps://drf-turbo.readthedocs.io/en/latest/performance.html\u003e`_ of the docs.\n\nDocumentation \u0026 Support\n-----------------------\nDocumentation for the project is available at https://drf-turbo.readthedocs.io.\n\nFor questions and support, use github issues\n\nExamples\n========\n\nDeclaring Serializers\n---------------------\n.. code-block:: python\n\n   from datetime import datetime\n   from django.utils.timezone import now\n   import drf_turbo as dt\n\n    class User:\n        def __init__(self, username, email,created=None):\n            self.username = username\n            self.email = email\n            self.created = created or datetime.now()\n\n    user = User(username='test' , email='test@example.com')\n\n\n\n    class UserSerializer(dt.Serializer):\n        username = dt.StrField(max_length=50)\n        email = dt.EmailField()\n        created = dt.DateTimeField()\n\n\nSerializing objects\n-------------------\n\n.. code-block:: python\n\n\n   serializer = UserSerializer(user)\n   serializer.data\n\n    # {'username': 'test', 'email': 'test@example.com', 'created': '2021-11-04T22:49:01.981127Z'}\n\n\nDeserializing objects\n---------------------\n\n.. code-block:: python\n\n    data = {'username':'new_test','email':'test2@example.com','created':now()}\n    serializer = UserSerializer(data=data)\n    serializer.is_valid()\n    # True\n    serializer.validated_data\n    # {'username': 'new_test', 'email': 'test2@example.com', 'created': datetime.datetime(2021, 11, 12, 6, 10, 44, 85118)}}\n\nValidation\n----------\n\n.. code-block:: python\n\n    serializer = UserSerializer(data={'email': 'test'})\n    serializer.is_valid()\n    # False\n    serializer.errors\n    # {'username': ['This field is required.'], 'email': ['Enter a valid email address.'],'created': ['This field is required.']}\n\n\nField-level validation\n----------------------\n\n.. code-block:: python\n\n    import drf_turbo as dt\n\n    class UserSerializer(dt.Serializer):\n        username = dt.StrField(max_length=50)\n\n        def validate_username(self, value):\n            if 'test' not in value.lower():\n                raise dt.ValidationError(\"test must be in username\")\n            return value\n\nObject-level validation\n-----------------------\n\n.. code-block:: python\n\n    import drf_turbo as dt\n\n    class CampaignSerializer(dt.Serializer):\n        start_date = dt.DateTimeField()\n        end_date = dt.DateTimeField()\n\n        def validate(self, data):\n            if data['start_date'] \u003e data['end_date']:\n                raise dt.ValidationError(\"start_date must occur before end_date\")\n            return data\n\nNested Serializers\n------------------\n.. code-block:: python\n\n   from datetime import datetime\n   from django.utils.timezone import now\n   import drf_turbo as dt\n\n    class User:\n        def __init__(self, username, email,created=None):\n            self.username = username\n            self.email = email\n            self.created = created or datetime.now()\n\n    user = User(username='test' , email='test@example.com')\n\n    class UserSerializer(dt.Serializer):\n        username = dt.StrField(max_length=50)\n        email = dt.EmailField()\n        created = dt.DateTimeField()\n\n    class Profile :\n        def __init__(self, age=25):\n            self.age = age\n            self.user = user\n\n    profile = Profile()\n\n\n    class ProfileSerializer(dt.Serializer):\n        age = dt.IntField()\n        user = UserSerializer()\n\n\n    serializer = ProfileSerializer(profile)\n    serializer.data\n\n    # {'age' : 25 , 'user' : {'username': 'test', 'email': 'test@example.com', 'created': '2021-11-04T22:49:01.981127Z'}}\n\n\nFiltering Output\n----------------\n\ndrf-turbo provides option to enclude or exclude fields from serializer using ``only`` or ``exclude`` keywords.\n\n.. code-block:: python\n\n    serializer = UserSerializer(user,only=('id','username'))\n\n    or\n\n    serializer = ProfileSerializer(profile,exclude=('id','user__email'))\n\n    or\n\n    http://127.0.0.1:8000/user/?only=id,username\n\n\nRequired Fields\n---------------\n\nMake a field required by passing required=True. An error will be raised if the the value is missing from data during Deserializing.\n\nFor example:\n\n.. code-block:: python\n\n    class UserSerializer(dt.Serializer):\n\n        username = dt.StrField(required=True,error_messages={\"required\":\"no username\"})\n\n\n\nSpecifying Defaults\n-------------------\n\nIt will be used for the field if no input value is supplied.\n\n\nFor example:\n\n.. code-block:: python\n\n    from datetime import datetime\n\n    class UserSerializer(dt.Serializer):\n\n        birthdate = dt.DateTimeField(default=datetime(2021, 11, 05))\n\n\n\n\nModelSerializer\n---------------\n\nMapping serializer to Django model definitions.\n\nFeatures :\n\n    * It will automatically generate a set of fields for you, based on the model.\n    * It will automatically generate validators for the serializer.\n    * It includes simple default implementations of .create() and .update().\n\n.. code-block:: python\n\n    class UserSerializer(dt.ModelSerializer):\n\n        class Meta :\n            model = User\n            fields = ('id','username','email')\n\nYou can also set the fields attribute to the special value ``__all__``  to indicate that all fields in the model should be used.\n\nFor example:\n\n.. code-block:: python\n\n    class UserSerializer(dt.ModelSerializer):\n\n        class Meta :\n            model = User\n            fields = '__all__'\n\nYou can set the exclude attribute to a list of fields to be excluded from the serializer.\n\nFor example:\n\n.. code-block:: python\n\n    class UserSerializer(dt.ModelSerializer):\n\n        class Meta :\n            model = User\n            exclude = ('email',)\n\n\nRead\u0026Write only fields\n----------------------\n\n.. code-block:: python\n\n    class UserSerializer(dt.ModelSerializer):\n        class Meta:\n            model = User\n            fields = ('id', 'username', 'password','password_confirmation')\n            read_only_fields = ('username')\n            write_only_fields = ('password','password_confirmation')\n\n\nOpenApi(Swagger)\n----------------\n\nAdd drf-turbo to installed apps in ``settings.py``\n\n.. code:: python\n\n    INSTALLED_APPS = [\n        # ALL YOUR APPS\n        'drf_turbo',\n    ]\n\n\nand then register our openapi AutoSchema with DRF.\n\n.. code:: python\n\n    REST_FRAMEWORK = {\n        # YOUR SETTINGS\n        'DEFAULT_SCHEMA_CLASS': 'drf_turbo.openapi.AutoSchema',\n    }\n\n\nand finally add these lines in ``urls.py``\n\n.. code:: python\n\n    from django.views.generic import TemplateView\n    from rest_framework.schemas import get_schema_view as schema_view\n    from drf_turbo.openapi import SchemaGenerator\n\n    urlpatterns = [\n        # YOUR PATTERNS\n \tpath('openapi', schema_view(\n            title=\"Your Project\",\n            description=\"API for all things …\",\n            version=\"1.0.0\",\n            generator_class=SchemaGenerator,\n            public=True,\n        ), name='openapi-schema'),\n        path('docs/', TemplateView.as_view(\n            template_name='docs.html',\n            extra_context={'schema_url':'openapi-schema'}\n        ), name='swagger-ui'),\n    ]\n\nNow go to http://127.0.0.1:8000/docs\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n\nLicense\n------------\n* Free software: MIT license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmng-dev-ai%2Fdrf-turbo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmng-dev-ai%2Fdrf-turbo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmng-dev-ai%2Fdrf-turbo/lists"}