Saravanan666/pypi-org huggingface dataset:
Package: django-graphene-filters
Django Graphene FiltersThis package contains Advanced auto related filters forgraphene-django.Installation# pippipinstalldjango-graphene-filters# poetrypoetryadddjango-graphene-filtersBuildpoetryupdate
poetrybuildPublishpoetrypublish--username__token__--passwordPASSWORDTestingLocal testinggo to the project you want to install the packagerunpipenv shellrunpip install -e .Updating:poetry upgradeable packagespoetryshow-o
poetryadd--dev
poetryshow--outdated
poetrylock
poetryenvremove3.11
poetryrunflake8.
poetryrunblack.Notes:Files to do:filterset.pyAdvancedFilterSetinput_data_factories.py
Package: django-graphene-firebase-auth
# graphene-django-firebase-authAuthentication provider for graphene-django and Firebase’s Authentication service.Note this is a WIP and abandoned project since I never ended up using Firebase. But the code is still a good starting
point as of writing this.Partially inspired by
[django-firebase-auth](https://github.com/fcornelius/django-firebase-auth)
for Django REST framework.This app is used with [Firebase Authentication](https://firebase.google.com/docs/auth/) on a client.## CompatibilityThis code has only been tested with Python3.7.0and Django2.1.2.## InstallingInstall the app:`sh pipenv installgraphene-django-firebase-auth`Download the JSON file from your [Firebase console](https://console.firebase.google.com/) with your account’s
credentials.SetFIREBASE_KEY_FILEin your project’s settings to the path of the credentials file:`python import os FIREBASE_KEY_FILE = os.path.join(BASE_DIR,'path/to/firebase-credentials.json')`Add the authentication backend toAUTHENTICATION_BACKENDS:`python AUTHENTICATION_BACKENDS = ['firebase_auth.authentication.FirebaseAuthentication'] `Addfirebase_authtoINSTALLED_APPS:`python INSTALLED_APPS = [ 'firebase_auth', ] `AddFirebaseAuthMixinto yourAUTH_USER_MODEL:`python class User(PermissionsMixin, FirebaseAuthMixin): `Build and run your DB migrations to add the changes:`sh ./manage.py makemigrations ./manage.py migrate `## Sending tokens on the clientYour client will need to send anAuthorization: Bearertoken on each request. How you do this depends on your client
and is outside the scope
of this documentation.## Developing### Setting up your environmentInstall the dependencies:`sh pipenv install-d`Download the JSON file from your [Firebase console](https://console.firebase.google.com/) with your account’s
credentials.Create an.envfile using.env.exampleas a template. Make sure
to specify the path to the file in the previous step.Enter the virtual environment:`sh ./manage.py shell `### Other commands`sh # Run the tests ./manage.py test ``sh # Lint the code ./lint.sh `
Package: django-graphene-gis-extension
https://github.com/serioeseGmbH/django-graphene-gis-extensiondjango-graphene-gis-extension extendsdjango-graphenewith GIS related type definitions
(i.e. scalars, field conversions, …).Quick startInstall the package with pip:pip install django-graphene-gis-extensionAdd “serious_django_services” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'graphene_gis_extension',
]Use the scalars and input type definitions wherever you need them, for instance in a Query:from graphene_gis_extension.scalars import PointScalar
from graphene_gis_extension.input_types import NearInputType

class Query(graphene.ObjectType):
    thing_with_location = graphene.Field(
        ThingWithLocationType,
        exactly_at=graphene.Argument(PointScalar)
        near=graphene.Argument(NearInputType)
    )
Package: django-graphene-permissions
DGP - Django graphene permissionsPermission system inspired by DRFInstallationInstall the latest release:$pip3installdjango-graphene-permissionsOr using pipenv$pipenvinstalldjango-graphene-permissionsUsagePermission definitionYou can create new permissions by subclassingBasePermissione.g.fromdjango_graphene_permissions.permissionsimportBasePermissionclassMyPermission(BasePermission):@staticmethoddefhas_permission(context):returncontext.userandcontext.user.is_authenticated@staticmethoddefhas_object_permission(context,obj):returnTrueThis package provides predefined permissions :AllowAny: Allow any access.IsAuthenticated: Allow only authenticated users.Node PermissionSubclassPermissionDjangoObjectTypeand define the permissions via the static methodpermission_classesthat should return an iterable of permission classesfromdjango_graphene_permissionsimportPermissionDjangoObjectTypefromdjango_graphene_permissions.permissionsimportIsAuthenticatedclassExampleNode(PermissionDjangoObjectType):classMeta:model=Exampleinterfaces=(relay.Node,)@staticmethoddefpermission_classes():return[IsAuthenticated]Mutation PermissionApply thepermissions_checker([Permission,...])decorator tomutatee.g.fromdjango_graphene_permissionsimportpermissions_checkerfromdjango_graphene_permissions.permissionsimportIsAuthenticatedclassExampleDeleteMutation(graphene.Mutation):ok=graphene.Boolean()classArguments:id=graphene.ID()@permissions_checker([IsAuthenticated])defmutate(self,info,id):instance=get_instance(id)instance.delete()returnExampleDeleteMutation(ok=True)Query PermissionApply thepermissions_checker([Permission,...])decorator to the field resolver e.g.fromdjango_graphene_permissionsimportpermissions_checkerfromdjango_graphene_permissions.permissionsimportIsAuthenticatedclassQuery(graphene.ObjectType):post=relay.Node.Field(PostNode)posts=DjangoFilterConnectionField(PostNode)@permissions_checker([IsAuthenticated])defresolve_posts(self,info,**kwargs):returnPost.objects.all()TODOImprovementsTestsAdd aPermissionDjangoFilterConnectionFieldBetter docs
Package: django-graphene-permissions-redux
DGP - Django graphene permissions REDUX (Updated to support Django 4.x)Permission system inspired by DRFInstallationInstall the latest release:$pip3installdjango-graphene-permissionsOr using pipenv$pipenvinstalldjango-graphene-permissionsUsagePermission definitionYou can create new permissions by subclassingBasePermissione.g.fromdjango_graphene_permissions.permissionsimportBasePermissionclassMyPermission(BasePermission):@staticmethoddefhas_permission(context):returncontext.userandcontext.user.is_authenticated@staticmethoddefhas_object_permission(context,obj):returnTrueThis package provides predefined permissions :AllowAny: Allow any access.IsAuthenticated: Allow only authenticated users.Node PermissionSubclassPermissionDjangoObjectTypeand define the permissions via the static methodpermission_classesthat should return an iterable of permission classesfromdjango_graphene_permissionsimportPermissionDjangoObjectTypefromdjango_graphene_permissions.permissionsimportIsAuthenticatedclassExampleNode(PermissionDjangoObjectType):classMeta:model=Exampleinterfaces=(relay.Node,)@staticmethoddefpermission_classes():return[IsAuthenticated]Mutation PermissionApply thepermissions_checker([Permission,...])decorator tomutatee.g.fromdjango_graphene_permissionsimportpermissions_checkerfromdjango_graphene_permissions.permissionsimportIsAuthenticatedclassExampleDeleteMutation(graphene.Mutation):ok=graphene.Boolean()classArguments:id=graphene.ID()@permissions_checker([IsAuthenticated])defmutate(self,info,id):instance=get_instance(id)instance.delete()returnExampleDeleteMutation(ok=True)Query PermissionApply thepermissions_checker([Permission,...])decorator to the field resolver e.g.fromdjango_graphene_permissionsimportpermissions_checkerfromdjango_graphene_permissions.permissionsimportIsAuthenticatedclassQuery(graphene.ObjectType):post=relay.Node.Field(PostNode)posts=DjangoFilterConnectionField(PostNode)@permissions_checker([IsAuthenticated])defresolve_posts(self,info,**kwargs):returnPost.objects.all()TODOImprovementsTestsAdd aPermissionDjangoFilterConnectionFieldBetter docs
Package: django-graphiql
Django GraphiQL is a library for integratingGraphiQLinside your
Django project, so you can test yourGraphQLschemas easily.This library versioning go in partity with GraphiQL.InstallingFor installing this library just run in your favorite shell:pipinstalldjango-graphiqlConfiguringIn settings.py add'django_graphiql'intoINSTALLED_APPS, so it
will look likeINSTALLED_APPS=[# ...'django_graphiql',# ...]And then, add into your urls.py:urlpatterns=[# Your other urls...url(r'^graphiql',include('django_graphiql.urls')),]
Package: django-graphiql-debug-toolbar
Django GraphiQL Debug ToolbarDjango Debug ToolbarforGraphiQLIDE.DependenciesPython ≥ 3.6Django ≥ 2.2InstallationInstall last stable version from Pypi.pipinstalldjango-graphiql-debug-toolbarSee thedocumentationfor further guidance on settingDjango Debug Toolbar.Addgraphiql_debug_toolbarto yourINSTALLED_APPSsettings:INSTALLED_APPS=['debug_toolbar','graphiql_debug_toolbar',]Replacethe Django Debug Toolbarmiddlewarewith the GraphiQL Debug Toolbar one.MIDDLEWARE=[# 'debug_toolbar.middleware.DebugToolbarMiddleware','graphiql_debug_toolbar.middleware.DebugToolbarMiddleware',]Credits to@jazzband/django-debug-toolbar.
Package: django-graphiql-strawberry-debug-toolbar
Django GraphiQL Strawberry Debug ToolbarDjango Debug ToolbarforGraphiQLIDE andhttps://strawberry.rocks/GraphQL server.DependenciesPython ≥ 3.6Django ≥ 2.2Strawberry ≥ 0.15.1InstallationInstall the last stable version from PyPI.pipinstalldjango-graphiql-strawberry-debug-toolbarSee thedocumentationfor further guidance on settingDjango Debug Toolbar.Addgraphiql_strawberry_debug_toolbarto yourINSTALLED_APPSsettings:INSTALLED_APPS=['debug_toolbar','graphiql_strawberry_debug_toolbar',]Replacethe Django Debug Toolbarmiddlewarewith the GraphiQL Debug Toolbar one.MIDDLEWARE=[# 'debug_toolbar.middleware.DebugToolbarMiddleware','graphiql_strawberry_debug_toolbar.middleware.DebugToolbarMiddleware',]Credits to@jazzband/django-debug-toolbarand@mongkok, the author ofthe orignal toolfor graphene.
Package: django-graphql-auth
GraphQL implementation of theDjangoauthentication system.It abstract all the basic logic of handling user accounts out of your app,
so you don’t need to think about it and canget up and running faster.No lock-in. When you are ready to implement your own code or this package
is not up to your expectations , it’s easy to extend or switch to
your implementation.DocumentationDocumentation is available atread the docs.FeaturesAwesome docsFully compatible withRelayWorks with default/custom user modelJWT authentication (withDjango GraphQL JWT)User query with filters (withDjango FilterandGraphene Django)User registration with email verificationResend activation emailAdd secondary email, with email verification tooRetrieve/Update userArchive userPermanently delete user or make it inactiveTurn archived user active again on loginTrack user status (archived, verified, secondary email)Password changePassword reset through emailRevoke user refresh tokens on account archive/delete/password change/resetAll mutations returnsuccessanderrorsDefault email templates(you will customize though)Customizable, no lock-inPreviewHandling user accounts becomes super easy.mutation{register(email:"new_user@email.com",username:"new_user",password1:"123456super",password2:"123456super",){success,errors,token,refreshToken}}Check the status of the new user:u=UserModel.objects.last()u.status.verified# FalseDuring the registration, an email with a verification link was sent.mutation{verifyAccount(token:"<TOKEN ON EMAIL LINK>",){success,errors}}Now user is verified.u.status.verified# TrueCheck theinstallation guideor jump to thequickstart. Or if you prefer, browse theapi.
Package: django-graphql-auth-django-4
GraphQL implementation of theDjangoauthentication system.It abstract all the basic logic of handling user accounts out of your app,
so you don’t need to think about it and canget up and running faster.No lock-in. When you are ready to implement your own code or this package
is not up to your expectations , it’s easy to extend or switch to
your implementation.DocumentationDocumentation is available atread the docs.FeaturesAwesome docsFully compatible withRelayWorks with default/custom user modelJWT authentication (withDjango GraphQL JWT)User query with filters (withDjango FilterandGraphene Django)User registration with email verificationResend activation emailAdd secondary email, with email verification tooRetrieve/Update userArchive userPermanently delete user or make it inactiveTurn archived user active again on loginTrack user status (archived, verified, secondary email)Password changePassword reset through emailRevoke user refresh tokens on account archive/delete/password change/resetAll mutations returnsuccessanderrorsDefault email templates(you will customize though)Customizable, no lock-inPreviewHandling user accounts becomes super easy.mutation{register(email:"new_user@email.com",username:"new_user",password1:"123456super",password2:"123456super",){success,errors,token,refreshToken}}Check the status of the new user:u=UserModel.objects.last()u.status.verified# FalseDuring the registration, an email with a verification link was sent.mutation{verifyAccount(token:"<TOKEN ON EMAIL LINK>",){success,errors}}Now user is verified.u.status.verified# TrueCheck theinstallation guideor jump to thequickstart. Or if you prefer, browse theapi.
Package: django-graphqldoc
GraphQLdocGraphQLdoc is a simple Django app to document GraphQL schemas.Quick startAddgraphqldocto your INSTALLED_APPS setting like this:INSTALLED_APPS = [
     ...
     'graphqldoc',
 ]Add GRAPHQLDOC config settings in your settings file, and configure according to your needs, like this:GRAPHQLDOC = {
     'LOGO_URL': 'https://graphql.org/img/logo.svg',
     'TITLE': 'My GraphQL documentation',
 }This step is optional, it changes the logo and the default title in the template.Include the graphqldoc URLconf in your projecturls.pylike this:path('docs/', include('graphqldoc.urls')),Start the development server and visithttp://localhost:8000/docs/to view the rendered documentation for your GraphQL server.
Package: django-graphql-extensions
A collection of custom extensions forDjango GraphQLDependenciesPython ≥ 3.6Django ≥ 2.0Graphene-django ≥ 3.0.0b1InstallationInstall last stable version from Pypi.pipinstalldjango-graphql-extensionsAuthentication@login_required@staff_member_required@superuser_required@permission_required@user_passes_testSee thedocumentationto know the full list of decorators.fromdjango.contrib.authimportget_user_modelimportgraphenefromgraphql_extensions.decoratorsimport(login_required,staff_member_required,)classQuery(graphene.ObjectType):viewer=graphene.Field(UserType)users=graphene.List(UserType)@login_requireddefresolve_viewer(self,info,**kwargs):returninfo.context.user@staff_member_requireddefresolve_users(self,info,**kwargs):returnget_user_model().objects.all()ErrorsReturning appropriateerror responsesandmaskingerror messages sent to the client.Configure yourGraphQLView.fromdjango.urlsimportinclude,pathfromgraphql_extensions.viewsimportGraphQLViewurlpatterns=[path('',GraphQLView.as_view(),name='index'),]Exceptionsfromgraphql_extensionsimportexceptionsexceptions.GraphQLErrorexceptions.PermissionDeniedexceptions.ValidationErrorexceptions.NotFoundPayload{"errors":[{"message":"You do not have permission to perform this action","locations":[{"line":3,"column":13}],"path":["viewer"],"extensions":{"type":"PermissionDenied","code":"permissionDenied","timestamp":1622783872,"data":{},"operation":"QUERY","trace":["  File \"site-packages/graphql/execution/execute.py\", line 617, in resolve_field\n    result = resolve_fn(source, info, **args)\n","  File \"graphql_extensions/decorators.py\", line 23, in wrapper\n    return func(info.context, *args, **kwargs)\n","  File \"graphql_extensions/decorators.py\", line 35, in wrapper\n    raise exc\n"]}}],"data":{"viewer":null}}Writing testsThis package includes a subclass ofunittest.TestCaseSchemaTestCaseand improve support for making GraphQL queries.fromdjango.contrib.authimportget_user_modelfromgraphql_extensions.testimportSchemaTestCaseclassUsersTests(SchemaTestCase):deftest_create_user(self):query='''
        mutation CreateUser($username: String!, $password: String!) {
          createUser(username: $username, password: $password) {
            user {
              id
            }
          }
        }'''response=self.client.execute(query,{'username':'test','password':'dolphins',})self.assertFalse(response.errors)self.assertTrue(response.data['user'])deftest_viewer(self):user=get_user_model().objects.create_user(username='test',password='dolphins',)self.client.authenticate(self.user)query='''
        {
          viewer {
            username
          }
        }'''response=self.client.execute(query)data=response.data['viewer']self.assertEqual(data['username'],user.username)TypesCustomGraphenetypes.EmailTimestamp
Package: django-graphql-geojson
GeoJSONsupport forDjango GraphQLDependenciesPython ≥ 3.4Django ≥ 1.11InstallationInstall last stable version from Pypi.pipinstalldjango-graphql-geojsonGeoJSONTypeGeoJSONTypeis a subclass ofDjangoObjectTypewhich provides GraphQL fields inGeoJSONformat.Just define aMeta.geojson_fieldto be represented as aGeometrytype.models.pyfromdjango.contrib.gis.dbimportmodelsclassPlace(models.Model):name=models.CharField(max_length=255)location=models.PointField()schema.pyimportgrapheneimportgraphql_geojsonclassPlaceType(graphql_geojson.GeoJSONType):classMeta:model=models.Placegeojson_field='location'classQuery(graphene.ObjectType):places=graphene.List(PlaceType)schema=graphene.Schema(query=Query)Queryquery {
  places {
    id
    type
    geometry {
      type
      coordinates
    }
    bbox
    properties {
      name
    }
  }
}Geometry TypeGeometryis a special GraphQL type that represents aGEOS geometry object.schema.pyimportgrapheneimportgraphql_geojsonclassCreatePlace(graphene.Mutation):place=graphene.Field(types.PlaceType)classArguments:name=graphene.String(required=True)location=graphql_geojson.Geometry(required=True)@classmethoddefmutate(cls,root,info,**args):place=models.Place.objects.create(**args)returncls(place=place)Mutationmutation CreatePlace($name: String!, $location: Geometry!) {
  createPlace(name: $name, location: $location) {
    place {
      id
    }
  }
}Geometrytype may be initialized in a few ways:Well-known text (WKT):"POINT(5 23)"Hexadecimal (HEX):"010100000000000000000014400000000000003740"GeoJSON:{"type":"Point","coordinates":[5,23]}GeometryFilterSetDjango GraphQL GeoJSON provides a custom FilterSet forspatial lookups.TheMeta.fieldsoption is combined with model to automatically generate filters.filters.pyfromgraphql_geojson.filtersimportGeometryFilterSetclassPlaceFilter(GeometryFilterSet):classMeta:model=models.Placefields={'name':['exact'],'location':['exact','intersects','distance_lte'],}schema.pyimportgrapheneimportgraphql_geojsonfromgrapheneimportrelayfromgraphene_django.filterimportDjangoFilterConnectionFieldclassPlaceNode(graphql_geojson.GeoJSONType):classMeta:model=Placeinterfaces=[relay.Node]geojson_field='location'classQuery(graphene.ObjectType):places=DjangoFilterConnectionField(PlaceNode,filterset_class=PlaceFilter)Queryquery Places($geometry: Geometry!){
  places(location_Intersects: $geometry) {
    edges {
      node {
        id
      }
    }
  }
}Distance lookupstake aDistanceparameter comprising:The desiredunit attributenameDistance valueA geometry to base calculations fromquery Places(
    $unit: DistanceUnitEnum!,
    $value: Float!,
    $geometry: Geometry!)
  {
  places(location_DistanceLte: {
      unit: $unit,
      value: $value,
      geometry: $geometry
    }) {
    edges {
      node {
        id
      }
    }
  }
}
Package: django-graphql-google-accounts
django-graphql-google-accountsfk django allauth creates 7 tables.but we need only google accounts and we will only use graphql token authentication.@@ WARNING @@+ Create a user table that uses only Google accounts.+ Use is not recommended unless it is the initial setting.Table Columnscolumnuidemailnicknamepitcurelocaleis_activeis_adminupdated_atcreated_atInstallationpipinstalldjango-graphql-google-accountsSetupconfigure base settingsadd this app and settings# settings.pyINSTALLED_APPS=[# ...'django.contrib.auth','django.contrib.sites','accounts',]AUTHENTICATION_BACKENDS=['accounts.auth.backend.GoogleAuthBackend','django.contrib.auth.backends.ModelBackend',]# ...ACCOUNTS_SETTINGS={# change secret example: https://djecrety.ir/'token_secret':'^yb9tjg_hif0jym(d42j=vc#kyy=e_t#bjs)xy9y9)=tf&)!-2','claim':{'iss':'',# issuer'sub':'',# subject'aud':'',# audience'exp':1800,# accessToken expire time seconds},'refresh_token_expire':30,# days / only verify check day'google':{'client_id':'<GOOGLE-CLIENT-ID>','secret':'<GOOGLE-SECRET>','redirect_uri':'/auth/google/callback','front_redirect_uri':'http://localhost:8081/auth/google/callback',}}GRAPHENE={"SCHEMA":"core.schema.schema",'MIDDLEWARE':['accounts.middleware.TokenMiddleware']}AUTH_USER_MODEL='accounts.User'configure urls# urls.pyfromdjango.urlsimportpath,includefromaccounts.viewsimportGoogleLoginView,GoogleCallbackViewurlpatterns=[# ...path('login',GoogleLoginView.as_view()),path('auth/google/callback',GoogleCallbackView.as_view()),]Refresh TokenMutateRegister Schema# schema.pyimportgraphenefromaccounts.resolverimportUserQuery,RefreshTokenMutationclassMutation(graphene.ObjectType):refresh_token=RefreshTokenMutation.Field()schema=graphene.Schema(mutation=Mutation)HTTP Headers{"Authorization":"Bearer <accessToken>"}Mutationmutation{refreshToken(token:"=0ujbayhl43l6m=vleqpa#&k(jaqlv0-p&qn7jl1#*nv@%v&=+"){okaccessTokenrefreshToken}}Login Requiredverify accessToken timeout anduidimportgraphene# from example.types import ExampleTypefromaccounts.decorators.defineimportlogin_requiredclassExampleQuery:example=graphene.List(ExampleType)@staticmethod@login_requireddefresolve_example():returnexample.objects.all()Logger (Authenticated Error) print ignoregraphene issue 513importloggingfromgraphqlimportGraphQLErrorclassGraphQLLogFilter(logging.Filter):"""Filter GraphQL errors that are intentional. Seehttps://github.com/graphql-python/graphene/issues/513"""deffilter(self,record):ifrecord.exc_info:exc_type,_,_=record.exc_infoifexc_type==GraphQLError:returnNoneifrecord.stack_infoand'GraphQLError'inrecord.stack_info:returnNoneifrecord.msgand'GraphQLLocatedError'inrecord.msg:returnNonereturnTrueLOGGING={'version':1,'disable_existing_loggers':False,'handlers':{'console':{'level':'DEBUG','class':'logging.StreamHandler',},},# Prevent graphql exception from displaying in console'filters':{'graphql_log_filter':{'()':GraphQLLogFilter,}},'loggers':{'graphql.execution.utils':{'level':'WARNING','handlers':['console'],'filters':['graphql_log_filter'],},},}Admindefault password is emailIf the password is empty, save email automatically by django pbk2 encryption.
Package: django-graphql-jwt
JSON Web Token authentication for Django GraphQL.Fantasticdocumentationis available athttps://django-graphql-jwt.domake.io.InstallationInstall last stable version from Pypi:pipinstalldjango-graphql-jwtAddAuthenticationMiddlewaremiddleware to yourMIDDLEWAREsettings:MIDDLEWARE=[# ..."django.contrib.auth.middleware.AuthenticationMiddleware",# ...]AddJSONWebTokenMiddlewaremiddleware to yourGRAPHENEsettings:GRAPHENE={"SCHEMA":"mysite.myschema.schema","MIDDLEWARE":["graphql_jwt.middleware.JSONWebTokenMiddleware",],}AddJSONWebTokenBackendbackend to yourAUTHENTICATION_BACKENDS:AUTHENTICATION_BACKENDS=["graphql_jwt.backends.JSONWebTokenBackend","django.contrib.auth.backends.ModelBackend",]SchemaAdddjango-graphql-jwtmutations to the root schema:importgrapheneimportgraphql_jwtclassMutation(graphene.ObjectType):token_auth=graphql_jwt.ObtainJSONWebToken.Field()verify_token=graphql_jwt.Verify.Field()refresh_token=graphql_jwt.Refresh.Field()schema=graphene.Schema(mutation=Mutation)