zahirekrem09 / drf_ecommerce_api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggest to loosen the dependency on graphene

Agnes-U opened this issue · comments

Hi, your project drf_ecommerce_api requires "graphene==2.1.8" in its dependency. After analyzing the source code, we found that the following versions of graphene can also be suitable without affecting your project, i.e., graphene 2.1.6, 2.1.7, 2.1.9. Therefore, we suggest to loosen the dependency on graphene from "graphene==2.1.8" to "graphene>=2.1.6,<=2.1.9" to avoid any possible conflict for importing more packages or for downstream projects that may use drf_ecommerce_api.

May I pull a request to further loosen the dependency on graphene?

By the way, could you please tell us whether such dependency analysis may be potentially helpful for maintaining dependencies easier during your development?



We also give our detailed analysis as follows for your reference:

Your project drf_ecommerce_api directly uses 12 APIs from package graphene.

graphene.types.structures.List.__init__, graphene.types.mutation.Mutation.__init__, graphene.types.scalars.Int.__init__, graphene.types.inputobjecttype.InputObjectType.__init__, graphene.types.scalars.Float.__init__, graphene.types.scalars.String.__init__, graphene.types.field.Field.__init__, graphene.types.scalars.ID.__init__, graphene.types.scalars.Boolean.__init__, graphene.types.schema.Schema.__init__, graphene.types.objecttype.ObjectType.__init__, graphene.types.datetime.Date.__init__

Beginning from the 12 APIs above, 15 functions are then indirectly called, including 10 graphene's internal APIs and 5 outsider APIs. The specific call graph is listed as follows (neglecting some repeated function occurrences).

[/zahirekrem09/drf_ecommerce_api]
+--graphene.types.structures.List.__init__
|      +--graphene.types.structures.Structure.__init__
|      |      +--graphene.types.unmountedtype.UnmountedType.__init__
|      |      |      +--graphene.utils.orderedtype.OrderedType.__init__
|      |      |      |      +--graphene.utils.orderedtype.OrderedType.gen_counter
|      +--graphene.types.unmountedtype.UnmountedType.__init__
+--graphene.types.mutation.Mutation.__init__
|      +--graphene.types.objecttype.ObjectType.__init__
+--graphene.types.scalars.Int.__init__
|      +--graphene.types.unmountedtype.UnmountedType.__init__
+--graphene.types.inputobjecttype.InputObjectType.__init__
|      +--graphene.types.unmountedtype.UnmountedType.__init__
|      +--graphene.utils.orderedtype.OrderedType.__init__
+--graphene.types.scalars.Float.__init__
|      +--graphene.types.unmountedtype.UnmountedType.__init__
+--graphene.types.scalars.String.__init__
|      +--graphene.types.unmountedtype.UnmountedType.__init__
+--graphene.types.field.Field.__init__
|      +--graphene.utils.orderedtype.OrderedType.__init__
|      +--graphene.types.structures.NonNull.__init__
|      |      +--graphene.types.structures.Structure.__init__
|      +--graphene.types.argument.to_arguments
|      |      +--itertools.chain
|      |      +--collections.OrderedDict
|      |      +--graphene.types.mountedtype.MountedType.mounted
|      +--collections.OrderedDict
|      +--functools.partial
+--graphene.types.scalars.ID.__init__
|      +--graphene.types.unmountedtype.UnmountedType.__init__
+--graphene.types.scalars.Boolean.__init__
|      +--graphene.types.unmountedtype.UnmountedType.__init__
+--graphene.types.schema.Schema.__init__
|      +--graphene.types.schema.assert_valid_root_type
|      |      +--inspect.isclass
|      +--graphene.types.schema.Schema.build_typemap
|      |      +--graphene.types.typemap.TypeMap.__init__
|      |      |      +--graphql.type.typemap.GraphQLTypeMap.__init__
+--graphene.types.objecttype.ObjectType.__init__
+--graphene.types.datetime.Date.__init__
|      +--graphene.types.unmountedtype.UnmountedType.__init__

We scan graphene's versions and observe that during its evolution between any version from [2.1.6, 2.1.7, 2.1.9] and 2.1.8, the changing functions (diffs being listed below) have none intersection with any function or API we mentioned above (either directly or indirectly called by this project).

diff: 2.1.8(original) 2.1.6
['graphene.types.mutation.Mutation.__init_subclass_with_meta__', 'graphene.types.objecttype.ObjectType', 'graphene.types.mutation.Mutation', 'graphene.types.mutation.MutationOptions']

diff: 2.1.8(original) 2.1.7
['graphene.types.mutation.Mutation.__init_subclass_with_meta__', 'graphene.types.objecttype.ObjectType', 'graphene.types.mutation.Mutation', 'graphene.types.mutation.MutationOptions']

diff: 2.1.8(original) 2.1.9
['graphene.relay.node.NodeField.__init__', 'graphene.types.mutation.Mutation', 'graphene.relay.node.NodeField']

As for other packages, the APIs of collections, functools, itertools, inspect and graphql are called by graphene in the call graph and the dependencies on these packages also stay the same in our suggested versions, thus avoiding any outside conflict.

Therefore, we believe that it is quite safe to loose your dependency on graphene from "graphene==2.1.8" to "graphene>=2.1.6,<=2.1.9". This will improve the applicability of drf_ecommerce_api and reduce the possibility of any further dependency conflict with other projects.