Saravanan666/pypi-org huggingface dataset:
Package: graph-embeddings
Graph-EmbeddingsGraph embeddings for downstream tasksInstallation:It’s advised to install graph-embeddings using a virtual env, inside the env use:pip install graph-embeddingsAlgorithms:StackedNode2VecComputes the Node2Vec representation of each node in a set of graphs.Example:importnetworkxasnxfromgraph_embeddings.algorithmsimportStackedNode2Vecg1=nx.DiGraph()g2=nx.DiGraph()g1.add_edges_from([("A","B"),("B","C"),("C","B"),("B","E")])g2.add_edges_from([("A","B"),("B","D"),("D","C"),("C","D")])graphs=[g1,g2]embedding_model=StackedNode2Vec()embedding_model.fit(graphs)embedding_model.get_embeddings()# ndarray with shape (2, 5, 128) - graphs, nodes, embedding_sizeembedding_model.get_dense_embeddings()# ndarray with shape (2, 640) - graphs, nodes*embedding_sizeChangelogSee thechangelogfor notes on the changes of graph-embeddingsImportant linksOfficial source code repo:https://github.com/rodrigo-arenas/graph-embeddings/Download releases:https://pypi.org/project/graph-embeddings/Issue tracker:https://github.com/rodrigo-arenas/graph-embeddings/issuesStable documentation:https://graph-embeddings.readthedocs.io/Source codeYou can check the latest development version with the command:git clone https://github.com/rodrigo-arenas/graph-embeddings.gitInstall the development dependencies:pip install -r dev-requirements.txtCheck the latest in-development documentation:https://graph-embeddings.readthedocs.io/en/latest/ContributingContributions are more than welcome!
There are several opportunities on the ongoing project, so please get in touch if you would like to help out.
Make sure to check the current issues and also
theContribution guide.
Package: graphemy
GRAPHEMYA Python library for integrating SQLModel and Strawberry, providing a seamless GraphQL integration with FastAPI and advanced features for database interactions.OverviewThe Graphemy is designed to simplify and streamline the integration of SQLModel and Strawberry in Python projects. This library allows you to create a single class model, which, once declared, automatically provides GraphQL queries via Strawberry. These queries can be easily integrated into a FastAPI backend. All generated routes include filters on all fields, including a custom date filter. Additionally, it facilitates the creation of mutations for data modification and deletion by simply setting a variable in the model. The library also handles table relationships efficiently using Strawberry's dataloaders, providing a significant performance boost. Moreover, it offers a pre-configured authentication setup, which can be configured with just two functions.FeaturesIntegration of SQLModel and Strawberry for GraphQL support.Automatic generation of GraphQL queries for FastAPI.Powerful filtering capabilities, including custom date filters.Effortless creation of mutations for data manipulation.Efficient handling of table relationships using Strawberry's dataloaders.Pre-configured authentication setup for easy configuration.PrerequisitesBefore you begin using Graphemy, it is highly recommended that you have some prior knowledge of the essential libraries upon which this project is built. This will help you make the most of the features and carry out integrations more effectively. Please make sure you are familiar with the following libraries:FastAPI: A modern framework for building fast web APIs with Python. If you are not already familiar with FastAPI, you can refer to theFastAPI documentation.SQLModel: An object-relational mapping (ORM) library for Python that simplifies and streamlines database interactions. To learn more about SQLModel, visit theSQLModel documentation.Strawberry: A Python library for declaratively creating GraphQL schemas. For in-depth information on using Strawberry, access theStrawberry documentation.Having a solid understanding of these libraries is crucial to making the most of Project Name and effortlessly creating GraphQL APIs.Create a ProjectI recomend you use Poetry, but you can use the enviroment manager that you want. So if you are using poetry, start the project:# Create poetry projectpoetrynewgraphemytutorial# Start EnvironmentpoetryshellYou can also use the environment manager wanted, such as virtualenv# Create a directory for tutorialmkdirgraphemy-tutorial# Enter into that directorycdgraphemy# Create virtual environmentpython-mvenvvenv#Start Environmentvenv/Scripts/ActivateRequirementsNow install Graphemy :)poetryaddgraphemyOr using default python env with pip:pipinstallgraphemy
Package: graphene-crud-maker
Graphene CRUD MakerThis is a project to auto generate a graphql crud using graphene djangoRequirementsPython >= 3.6Django >= 2.2Graphene Django >= 2.0Quick startInstallationpipinstallgraphene-crud-makerCreate a Django projectdjango-adminstartprojectcore.Add "graphene_crud_maker" to your INSTALLED_APPS setting like this:INSTALLED_APPS=[...'myapp','graphene_crud_maker','graphene_django',]Note: "myapp" is the name of the appAdd GRAPHENE to your settings.pydefine the schema location for Graphene in the settings.py file of your Django project:link:https://docs.graphene-python.org/projects/django/en/latest/GRAPHENE={"ATOMIC_MUTATIONS":True,'SCHEMA':'core.schema.schema.schema',"SCHEMA_INDENT":4,"MIDDLEWARE":["graphene_django.debug.DjangoDebugMiddleware",'graphql_jwt.middleware.JSONWebTokenMiddleware',]}Note name "core" is the name of the projectAdd URLS to your urls.pyfromdjango.conf.urlsimporturlfromdjango.views.decorators.csrfimportcsrf_exemptfromgraphql_jwt.decoratorsimportjwt_cookiefromgraphene_django.viewsimportGraphQLViewurlpatterns=[# ...url(r"graphql",csrf_exempt(jwt_cookie(GraphQLView.as_view(graphiql=True)))),]Create the apppython3manage.pystartappmyappNote: create modelsUsagePythonpython3manage.pymaker--helpOutputCreateGrapheneCRUD

optionalarguments:-h,--helpshowthishelpmessageandexit-nNAME,--nameNAMEAppnametocreatetheCRUDgraphQL-e[EXCLUDE...],--exclude[EXCLUDE...]FieldstoexcludeintheCRUD(id,createdAt,updatedAt)...Command to create GraphQLpython3manage.pymaker-nmyappRun the serverpython3manage.pyrunserverGraphiQLhttp://localhost:8000/graphql
Package: graphene_django_auth
Graphene Django AuthAn implementation of a graphql schema for jwt authentication.Free software: MIT licenseDocumentation:https://graphene-django-auth.readthedocs.io.FeaturesTODOCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.1.0 (2018-01-08)First release on PyPI.
Package: graphene-django-cud
Graphene Django CUDThis package contains a number of helper mutations making it easy to construct create, update and delete mutations for django models.The helper mutations are:DjangoCreateMutationDjangoPatchMutationDjangoUpdateMutationDjangoDeleteMutationDjangoBatchCreateMutationDjangoBatchPatchMutationDjangoBatchUpdateMutationDjangoBatchDeleteMutationDjangoFilterUpdateMutationDjangoFilterDeleteMutationThe package handles both regular ids and relay ids automatically.Installationpip install graphene_django_cudBasic usageTo use, here illustrated byDjangoCreateMutation, simply create a new inherting class.
Suppose we have the following model and Node.classUser(models.Model):name=models.CharField(max_length=255)address=models.TextField()classUserNode(DjangoObjectType):classMeta:model=Userinterfaces=(Node,)Then we can create a create mutation with the following schemaclassCreateUserMutation(DjangoCreateMutation):classMeta:model=UserclassMutation(graphene.ObjectType):create_user=CreateUserMutation.Field()classQuery(graphene.ObjectType):user=graphene.Field(UserNode,id=graphene.String())defresolve_user(self,info,id):returnUser.objects.get(pk=id)schema=Schema(query=Query,mutation=Mutation)Note that theUserNodehas to be registered as a field before the mutation is instantiated. This will be configurable in the future.The input to the mutation is a single variableinputwhich is automatically created with the models fields.
An example mutation would then bemutation{createUser(input:{name:"John Doe",address:"Downing Street 10"}){user{idnameaddress}}}DocumentationThe full documentation can be found athttps://graphene-django-cud.readthedocs.io/en/latest/.
Package: graphene-django-extensions
Graphene Django Extensionspipinstallgraphene-django-extensionsDocumentation:https://mrthearman.github.io/graphene-django-extensions/Source Code:https://github.com/MrThearMan/graphene-django-extensions/Contributing:https://github.com/MrThearMan/graphene-django-extensions/blob/main/CONTRIBUTING.mdExtensions for writing GraphQL schemas with thegraphene-djangolibrary with less boilerplate.The main features are:A new ObjectTypeDjangoNode, which:adds convenience methods for managing permissions for both the ObjectType and individual fields.adds a hook for adding filtering to both single items and lists returned by the ObjectType.adds convenience methods for creating Fields, ListFields, Nodes, and Connections for the ObjectType.adds filterset filters automatically to ListFields created for the ObjectType.automatically optimizes queries usinggraphene-django-query-optimizer.A new MutationTypeDjangoMutation, which:adds convenience methods for managing permissions.addscreate,updateoperation with serializers anddeleteoperations with optional validation hook.adds an option for custom model operations.makes updates fully partial by default.adds better error handling.A new ModelSerializerNestingModelSerializer, which:adds pre and post save handlers for creating or updating related entities from nested serializer fields,
all within a single transaction to ensure atomicity.adds better handling of constraint integrity errors by findingviolation_error_messagefrom the constraint.addsget_or_defaultmethod for finding default values for field validation.A new FilterSetModelFilterSet, which:changes the default filters for related fields to the customIntChoiceFilterandIntMultipleChoiceFilterfilters, which don't make database queries to check if the given primary keys for the filters actually
correspond to existing rows for the database model.adds a custom ordering filter automatically to all subclasses, with the defaultpkfilter.allows adding new ordering filters with theMeta.order_byattribute.order_byfields are converted to enums for better autocompletion in GraphiQL.allows combining multiple method filters with theMeta.combination_methodsattribute.
Package: graphene-django-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: graphene-django-framework
Don’t want to use Relay with Graphene? You are not alone. All other
packages for django implement the Relay interface. 😞Graphene-Djangoadds the ability to filter and paginate but you must follow the Relay
specification which requires the use of Nodes, Edges, Connections, and
Global IDs.Apollo is a great GraphQL client and can still be used with Relay but
has its downsides.Installpip install graphene-django-frameworkHackingYou must have docker and docker-compose# setup the docker env with your uid and gid
echo -e "UID=$(id -u)\nGID=$(id -g)" > .env

# first migrate the database
docker-compose run web python manage.py migrate

# create a superuser to login with
docker-compose run web python manage.py createsuperuser

# run the server
docker-compose run web python manage.py runserver
# or tests
docker-compose run web python manage.py test
Package: graphene-django-hook
graphene-django-precommit-hookpre-commit hook to generate.graphql|.jsongraphql schema forgraphene-django.As a pre-commit hookSeepre-commitfor instructionsSample basic.pre-commit-config.yaml-repo:https://github.com/jackton1/graphene-django-precommit-hookrev:v0.1.0hooks:-id:graphene-django-hookstages:[commit]Sample complex.pre-commit-config.yaml-repo:https://github.com/jackton1/graphene-django-precommit-hookrev:v0.1.0hooks:-id:graphene-django-hookstages:[commit]args:['--settings','project.settings'.# Defaults to: DJANGO_SETTINGS_MODULE'--indent','4'# See https://docs.graphene-python.org/projects/django/en/latest/introspection/'--out','path/to/schema.graphql','--schema','module.path.to.schema','--verbosity',# OR '-v''2',# Set the verbosity level {0,1,2,3}]
Package: graphene-django-jwt-middleware
Graphene Django JWT MiddlewareThis is aGraphene Djangomiddleware to check JWT in GraphQL schemas.Installingwith pipenv:pipenvinstallgraphene-django-jwt-middlewareor poetry:poetryaddgraphene-django-jwt-middlewareUsageIn your djangosettings.pyfile, findGRAPHENEconfiguration and insert at theMIDDLEWAREsection:...GRAPHENE={"SCHEMA":"...",'MIDDLEWARE':['graphene_django_jwt_middleware.middleware.JWTAuthorizationMiddleware']}...
Package: graphene-django-opencrud
# OpenCrud Graphene Django implementation## Usage```pythonimport graphenefrom graphene_django.types import DjangoObjectTypefrom django.contrib.auth import models as auth_modelsfrom graphene import Nodefrom opencrud.connection import WithOpenCrudConnectionfrom opencrud.list import OpenCrudDjangoFilterListFieldfrom opencrud.filter import OpenCrudDjangoFilterConnectionFieldfrom opencrud.field import OpenCrudDjangoFieldclass User(DjangoObjectType):@WithOpenCrudConnection(auth_models.User)class Meta:filter_fields = ('id', 'email', )interfaces = (Node, )class Query(graphene.ObjectType):user = OpenCrudDjangoField(User)users = OpenCrudDjangoFilterListField(User)users_connection = OpenCrudDjangoFilterConnectionField(User)```## ContributingAfter cloning this repo, ensure dependencies are installed by running:```shpip install -e ".[test]"```After developing, the full test suite can be evaluated by running:```shpy.test opencrud --cov=opencrud # Use -v -s for verbose mode```
Package: graphene-django-query-optimizer
Graphene Django Query Optimizerpipinstallgraphene-django-query-optimizerDocumentation:https://mrthearman.github.io/graphene-django-query-optimizer/Source Code:https://github.com/MrThearMan/graphene-django-query-optimizer/Contributing:https://github.com/MrThearMan/graphene-django-query-optimizer/blob/main/CONTRIBUTING.mdSolve the GraphQLN+1 problemingraphene-djangoapplications
just by changing a few imports, automatically adding the appropriateonly,select_related,
andprefetch_relatedmethod calls to your QuerySets to fetchonlywhat you need.importgraphenefromtests.example.modelsimportExamplefromquery_optimizerimportDjangoObjectType,DjangoListFieldclassExampleType(DjangoObjectType):classMeta:model=ExampleclassQuery(graphene.ObjectType):all_examples=DjangoListField(ExampleType)schema=graphene.Schema(query=Query)
Package: graphene-django-sentry
🌐⚠️ graphene-django-sentry-------*Capture Sentry exceptions in Graphene views*When using `Graphene Django`_, you sometimes want to raise exceptions and capture them in the API.However, Graphene Django eats the raised exceptions and you won't see it in Sentry! 😭This package thinly wraps the normal GraphQLView with a handler that deals with Sentry errors properly.So the results:1. Sentry will show the true exceptions.2. Graphene will continue to work like normal.Works with:* Python 3.6+* Django 2.1+* graphene-django 2.2+.. image:: https://img.shields.io/pypi/v/graphene_django_sentry.svg:target: https://pypi.org/project/graphene_django_sentry/.. image:: https://img.shields.io/pypi/pyversions/graphene_django_sentry.svg:target: https://pypi.org/project/graphene_django_sentry/.. image:: https://img.shields.io/pypi/l/graphene_django_sentry.svg:target: https://pypi.org/project/graphene_django_sentry/.. image:: https://img.shields.io/pypi/status/graphene_django_sentry.svg:target: https://pypi.org/project/graphene_django_sentry/.. image:: https://circleci.com/gh/phalt/graphene_django_sentry/tree/master.svg?style=svg:target: https://circleci.com/gh/phalt/graphene_django_sentry/tree/masterInstalling the project is easy:.. code-block:: bashpip install graphene-django-sentryFull blown example:.. code-block:: python# urls.pyfrom .schema import schemafrom graphene_django_sentry.views import SentryGraphQLViewurlpatterns = [url(r'^graphql',csrf_exempt(SentryGraphQLView.as_view(schema=schema)),name='graphql',),]📖 What can I do?--------- Capture Sentry exceptions properly when they are `raise`-d in Graphene views.🏗 Status----------graphene-django-sentry is currently stable and suitable for use.🎥 Credits-----------This package was created with Cookiecutter_... _Cookiecutter: https://github.com/audreyr/cookiecutter.. _Graphene Django: https://github.com/graphql-python/graphene-django
Package: graphene-django-tools
Graphene django toolsTools for usegraphenewith django.
Use a explicit schema definition approach that different fromgraphene-django.Documentation is placed indocs folder.Installpip install graphene-django-toolsFeaturesdjango integration forgraphene-resolver.optimize queryset with djangoonly,selected_related,prefetch_relatedto only select fields that used in query.data loader integration for django model.Developmenttest:make test
Package: graphene-djmoney
graphene-djmoneyIntroductionGraphQL Money types for Django using graphene and django-money (djmoney). If you usedjango,graphene_django, anddjango-money, this library is for you.Supported on:Python 3.7+ (likely earlier versions too, needs tested)Django 2+graphene-django 2+django-money 1+Here's how it works. Automagically get this query:queryProducts{products{idcost{...moneyFragment}}}fragmentmoneyFragmentonMoney{asString# "123.45 USD"amount# 123.45amountStr# "123.45"currency{code# "USD"name# "US Dollar"# These are not as commonly used, see tests:numericsymbolprefix}}With this code:# yourapp/models.pyfromdjango.confimportsettingsfromdjango.contrib.auth.modelsimportAbstractUserfromdjango.dbimportmodelsfromdjmoney.models.fieldsimportMoneyFieldclassUser(AbstractUser):passclassProduct(models.Model):creator=models.ForeignKey(User,related_name="products",on_delete=models.CASCADE)title=models.CharField(max_length=2000)cost=MoneyField(max_digits=settings.CURRENCY_MAX_DIGITS,decimal_places=settings.CURRENCY_DECIMAL_PLACES,default_currency=settings.BASE_CURRENCY,null=True,blank=True,)# yourapp/schema/types.pyimportgraphenefromgraphene_djangoimportDjangoObjectTypefromyourappimportmodelsclassProduct(DjangoObjectType):classMeta:model=models.Productinterfaces=(graphene.relay.Node,)fields=("id","cost")# yourapp/schema/__init__.pyimportgraphenefrom..importmodelsfrom.typesimportProductclassQueries(graphene.ObjectType):products=graphene.List(graphene.NonNull(types.Product),required=True)defresolve_products(self,info,**kwargs):returnmodels.Product.objects.all()schema=graphene.Schema(query=Queries,types=[Product])# yourapp/settings.pyINSTALLED_APPS+=["graphene_djmoney",]GRAPHENE={"SCHEMA":"yourapp.schema.schema",}Installationpipinstallgraphene-djmoneyChangelog0.2.0- #5, #6, #7 Upgrade to py-moneyed 2.0, add babel format support (new field, `formatted`)
- **Breaking change**: removes `suffix` from schema, since babel doesn't support out of the box.0.1.3Initial release, sort of.ContributingRunning tests:poetryrunpytestStill TODO. For now, please open a pull request or issue.
Package: graphene-generator
Graphene-GeneratorAGraphene-Django(GraphQL) queries and mutations generatorYou can:Generate queries and mutations based on the specified model(s)Require authentication for some and/or all generated
queries/mutationsTechGraphene-Generator uses a number of open source projects to work
properly:Django- a Python-based web
framework,Graphene-Django- A Django integration for Graphene.If you are not familiar with the above technologies, please refer to
their respective documentation.And of course Graphene-generator itself is open source with apublic
repositoryon
GitHub.QuickstartFor installing graphene, just run this command in your shell:pipinstall"graphene-generator"SettingsWe need to specify the model(s) name to be used and their respective
path(s)GRAPHENE_GENERATOR_MODELS=[{'name':'ingredient','path':'path.to.the.model',}]Note thatGRAPHENE_GENERATOR_MODELSis an array to support many
models at once.AuthenticationIf we want to require the authentication, we need to specify that in our
settings under therequire_authdictionary for each modelGRAPHENE_GENERATOR_MODELS=[{# ...'require_auth':{'queries':["all","single"],'mutations':["create",'update','delete']}}]To make the difference between Mutations and Queries therequire_authcontainsqueriesandmutationsas different
keys.Below are the different values and their meaning:QueriesKey wordMeaningallThe get all query (usually themodel['name']+ s)singleThe get one query (usually themodel['name'])MutationsKey wordMeaningcreateThe create mutationupdateThe update mutationdeleteThe delete mutationSchemaWe need to import theQueriesHolderand/orMutationsHolderclasses into our schema used by graphene and you should be able to see
the generated CRUD operations into you schema.ExamplesHere is a simple Django model:fromdjango.dbimportmodelsclassIngredient(models.Model):name=models.CharField(max_length=100)notes=models.TextField()Based on the above model ou settings would look like:GRAPHENE_GENERATOR_MODELS=[{'name':'ingredient','path':'ingredients.models.Ingredient','require_auth':{'queries':["all","single"],'mutations':["create",'update','delete']}}]Here is a graphene schema sample which use the generated requests:importgraphenefromgraphene_generator.holderimportQueriesHolder,MutationsHolderclassQuery(QueriesHolder,graphene.ObjectType):passclassMutation(MutationsHolder,graphene.ObjectType):passschema=graphene.Schema(query=Query,mutation=MutationsHolder)Then you can query the schema:query='''
    query {
      ingredients {
        name,
        notes
      }
    }
'''result=schema.execute(query)TodosWrite TestsHandle model’s relations properlyUse corresponding graphene scalar type for each field(currently using
string for all fields)Handle paginationLicenseMIT
Package: graphene-graphiql-explorer
graphene graphiql explorer😎 This django app adds thegraphiql explorerto graphene's graphiql view.The graphiql version used is 1.9.10.Installationpip install graphene_graphiql_explorerSetupAddgraphene_graphiql_explorerto yourINSTALLED_APPS.Override the default graphene graphiql template in yoururls.py:fromgraphene_django.viewsimportGraphQLViewGraphQLView.graphiql_template="graphene_graphiql_explorer/graphiql.html"urlpatterns=[# ...url(r"^graphql/$",GraphQLView.as_view(graphiql=True),name="graphql",),# ...]Don't forget to collect those static files.Brought to you bysuperservice international.DevelopmentReleasepython -m buildpython -m twine upload -r testpypi dist/*python -m twine check dist/*