Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest to loosen the dependency on mongoengine #5

Open
Agnes-U opened this issue Nov 28, 2022 · 0 comments
Open

Suggest to loosen the dependency on mongoengine #5

Agnes-U opened this issue Nov 28, 2022 · 0 comments

Comments

@Agnes-U
Copy link

Agnes-U commented Nov 28, 2022

Hi, your project bachelor-api requires "mongoengine==0.22.1" in its dependency. After analyzing the source code, we found that some other versions of mongoengine can also be suitable without affecting your project, i.e., mongoengine 0.22.0, 0.23.0, 0.23.1, 0.24.0, 0.24.1. Therefore, we suggest to loosen the dependency on mongoengine from "mongoengine==0.22.1" to "mongoengine>=0.22.0,<=0.24.1" to avoid any possible conflict for importing more packages or for downstream projects that may use bachelor-api.

May I pull a request to loosen the dependency on mongoengine?

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



For your reference, here are details in our analysis.

Your project bachelor-api(commit id: a51391b) directly uses 5 APIs from package mongoengine.

mongoengine.fields.StringField.__init__, mongoengine.fields.IntField.__init__, mongoengine.fields.BooleanField.__init__, mongoengine.document.Document.__init__, mongoengine.fields.ListField.__init__

From which, 11 functions are then indirectly called, including 8 mongoengine's internal APIs and 3 outsider APIs, as follows (neglecting some repeated function occurrences).

[/njbrunner/bachelor-api]
+--mongoengine.fields.StringField.__init__
|      +--re.compile
|      +--mongoengine.base.fields.BaseField.__init__
+--mongoengine.fields.IntField.__init__
|      +--mongoengine.base.fields.BaseField.__init__
+--mongoengine.fields.BooleanField.__init__
|      +--mongoengine.base.fields.BaseField.__init__
+--mongoengine.document.Document.__init__
|      +--mongoengine.base.document.BaseDocument.__init__
|      |      +--mongoengine.errors.FieldDoesNotExist.__init__
|      |      +--mongoengine.base.datastructures.StrictDict.create
|      |      |      +--mongoengine.base.datastructures.StrictDict.items
|      |      +--bson.SON
|      |      +--mongoengine.common._import_class
|      |      +--mongoengine.base.document.BaseDocument.__set_field_display
|      |      |      +--functools.partial
+--mongoengine.fields.ListField.__init__
|      +--mongoengine.base.fields.ComplexBaseField.__init__
|      |      +--mongoengine.base.fields.BaseField.__init__

We scan mongoengine's versions among [0.22.0, 0.23.0, 0.23.1, 0.24.0, 0.24.1] and 0.22.1, 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: 0.22.1(original) 0.22.0
[](no clear difference between the source codes of two versions)

diff: 0.22.1(original) 0.23.0
['mongoengine.base.document.BaseDocument.__setattr__', 'mongoengine.fields.CachedReferenceField', 'mongoengine.base.document.BaseDocument', 'mongoengine.fields.ReferenceField', 'mongoengine.fields.EnumField', 'mongoengine.fields.key_has_dot_or_dollar', 'mongoengine.queryset.base.BaseQuerySet.allow_disk_use', 'mongoengine.fields.CachedReferenceField.__init__', 'mongoengine.fields.BooleanField.to_python', 'mongoengine.queryset.base.BaseQuerySet.__init__', 'mongoengine.document.Document', 'mongoengine.fields.EnumField.validate', 'mongoengine.queryset.base.BaseQuerySet._clone_into', 'mongoengine.fields.EnumField.__init__', 'mongoengine.queryset.base.BaseQuerySet._cursor_args', 'mongoengine.fields.BooleanField', 'mongoengine.queryset.base.BaseQuerySet', 'mongoengine.fields.LazyReferenceField']

diff: 0.22.1(original) 0.23.1
['mongoengine.fields.ReferenceField', 'mongoengine.fields.GenericReferenceField._lazy_load_ref', 'mongoengine.base.fields.ComplexBaseField.__get__', 'mongoengine.fields.BooleanField.to_python', 'mongoengine.queryset.base.BaseQuerySet.__init__', 'mongoengine.fields.ReferenceField.__get__', 'mongoengine.fields.GenericReferenceField.dereference', 'mongoengine.document.Document.cascade_save', 'mongoengine.base.fields.ComplexBaseField', 'mongoengine.connection.disconnect', 'mongoengine.fields.ReferenceField._lazy_load_ref', 'mongoengine.fields.CachedReferenceField._lazy_load_ref', 'mongoengine.fields.key_has_dot_or_dollar', 'mongoengine.fields.EnumField.validate', 'mongoengine.fields.EnumField.__init__', 'mongoengine.fields.BooleanField', 'mongoengine.queryset.base.BaseQuerySet.allow_disk_use', 'mongoengine.queryset.base.BaseQuerySet', 'mongoengine.document.Document.save', 'mongoengine.base.fields.ComplexBaseField._lazy_load_refs', 'mongoengine.fields.EnumField', 'mongoengine.base.document.BaseDocument._get_changed_fields', 'mongoengine.fields.ListField', 'mongoengine.fields.CachedReferenceField.__init__', 'mongoengine.fields.CachedReferenceField.__get__', 'mongoengine.fields.GenericReferenceField.__get__', 'mongoengine.fields.GenericReferenceField', 'mongoengine.queryset.base.BaseQuerySet._cursor_args', 'mongoengine.fields.LazyReferenceField', 'mongoengine.base.document.BaseDocument.__setattr__', 'mongoengine.fields.CachedReferenceField', 'mongoengine.base.document.BaseDocument', 'mongoengine.document.Document', 'mongoengine.queryset.base.BaseQuerySet._clone_into']

diff: 0.22.1(original) 0.24.0
['mongoengine.fields.ReferenceField', 'mongoengine.queryset.base.BaseQuerySet.in_bulk', 'mongoengine.context_managers.query_counter', 'mongoengine.fields.GenericReferenceField._lazy_load_ref', 'mongoengine.base.fields.ComplexBaseField.__get__', 'mongoengine.pymongo_support.list_collection_names', 'mongoengine.fields.BooleanField.to_python', 'mongoengine.context_managers.query_counter._resets_profiling', 'mongoengine.errors.InvalidQueryError', 'mongoengine.fields.DictField.prepare_query_value', 'mongoengine.fields.ReferenceField.__get__', 'mongoengine.queryset.base.BaseQuerySet.__init__', 'mongoengine.fields.DecimalField', 'mongoengine.document.EmbeddedDocument', 'mongoengine.fields.GenericReferenceField.dereference', 'mongoengine.document.Document.cascade_save', 'mongoengine.connection.get_connection', 'mongoengine.base.fields.ComplexBaseField', 'mongoengine.connection.disconnect', 'mongoengine.context_managers.query_counter.__init__', 'mongoengine.fields.ReferenceField._lazy_load_ref', 'mongoengine.fields.CachedReferenceField._lazy_load_ref', 'mongoengine.fields.DictField', 'mongoengine.errors.FieldDoesNotExist', 'mongoengine.base.document.BaseDocument.from_json', 'mongoengine.fields.key_has_dot_or_dollar', 'mongoengine.fields.EnumField.validate', 'mongoengine.document.EmbeddedDocument.__getstate__', 'mongoengine.fields.StringField', 'mongoengine.fields.EnumField.__init__', 'mongoengine.queryset.base.BaseQuerySet.allow_disk_use', 'mongoengine.queryset.base.BaseQuerySet', 'mongoengine.fields.BooleanField', 'mongoengine.errors.InvalidDocumentError', 'mongoengine.document.Document.ensure_indexes', 'mongoengine.document.Document.save', 'mongoengine.base.fields.ComplexBaseField._lazy_load_refs', 'mongoengine.fields.EnumField', 'mongoengine.errors.DeprecatedError', 'mongoengine.document.EmbeddedDocument.__setstate__', 'mongoengine.fields.StringField.prepare_query_value', 'mongoengine.base.document.BaseDocument._get_changed_fields', 'mongoengine.connection.get_db', 'mongoengine.fields.ListField', 'mongoengine.base.document.BaseDocument.to_json', 'mongoengine.fields.CachedReferenceField.__init__', 'mongoengine.document.Document.list_indexes', 'mongoengine.fields.DecimalField.to_python', 'mongoengine.fields.CachedReferenceField.__get__', 'mongoengine.errors.DoesNotExist', 'mongoengine.queryset.base.BaseQuerySet.exec_js', 'mongoengine.errors.MongoEngineException', 'mongoengine.fields.GenericReferenceField.__get__', 'mongoengine.fields.GenericReferenceField', 'mongoengine.queryset.base.BaseQuerySet._cursor_args', 'mongoengine.fields.LazyReferenceField', 'mongoengine.base.document.BaseDocument.__setattr__', 'mongoengine.base.document.BaseDocument._build_index_spec', 'mongoengine.fields.CachedReferenceField', 'mongoengine.errors.OperationError', 'mongoengine.base.document.BaseDocument', 'mongoengine.errors.MultipleObjectsReturned', 'mongoengine.queryset.base.BaseQuerySet.to_json', 'mongoengine.errors.NotRegistered', 'mongoengine.document.Document._qs', 'mongoengine.document.Document', 'mongoengine.context_managers.query_counter._turn_on_profiling', 'mongoengine.queryset.base.BaseQuerySet._clone_into']

diff: 0.22.1(original) 0.24.1
['mongoengine.fields.ReferenceField', 'mongoengine.queryset.base.BaseQuerySet.in_bulk', 'mongoengine.context_managers.query_counter', 'mongoengine.fields.GenericReferenceField._lazy_load_ref', 'mongoengine.base.fields.ComplexBaseField.__get__', 'mongoengine.pymongo_support.list_collection_names', 'mongoengine.fields.BooleanField.to_python', 'mongoengine.context_managers.query_counter._resets_profiling', 'mongoengine.errors.InvalidQueryError', 'mongoengine.fields.DictField.prepare_query_value', 'mongoengine.fields.ReferenceField.__get__', 'mongoengine.queryset.base.BaseQuerySet.__init__', 'mongoengine.fields.DecimalField', 'mongoengine.document.EmbeddedDocument', 'mongoengine.fields.GenericReferenceField.dereference', 'mongoengine.document.Document.cascade_save', 'mongoengine.connection.get_connection', 'mongoengine.base.fields.ComplexBaseField', 'mongoengine.connection.disconnect', 'mongoengine.context_managers.query_counter.__init__', 'mongoengine.fields.ReferenceField._lazy_load_ref', 'mongoengine.fields.CachedReferenceField._lazy_load_ref', 'mongoengine.fields.DictField', 'mongoengine.errors.FieldDoesNotExist', 'mongoengine.base.document.BaseDocument.from_json', 'mongoengine.fields.key_has_dot_or_dollar', 'mongoengine.fields.EnumField.validate', 'mongoengine.document.EmbeddedDocument.__getstate__', 'mongoengine.fields.StringField', 'mongoengine.fields.EnumField.__init__', 'mongoengine.queryset.base.BaseQuerySet.allow_disk_use', 'mongoengine.queryset.base.BaseQuerySet', 'mongoengine.fields.BooleanField', 'mongoengine.errors.InvalidDocumentError', 'mongoengine.document.Document.ensure_indexes', 'mongoengine.document.Document.save', 'mongoengine.base.fields.ComplexBaseField._lazy_load_refs', 'mongoengine.fields.EnumField', 'mongoengine.errors.DeprecatedError', 'mongoengine.document.EmbeddedDocument.__setstate__', 'mongoengine.fields.StringField.prepare_query_value', 'mongoengine.base.document.BaseDocument._get_changed_fields', 'mongoengine.connection.get_db', 'mongoengine.fields.ListField', 'mongoengine.base.document.BaseDocument.to_json', 'mongoengine.fields.CachedReferenceField.__init__', 'mongoengine.document.Document.list_indexes', 'mongoengine.fields.DecimalField.to_python', 'mongoengine.fields.CachedReferenceField.__get__', 'mongoengine.errors.DoesNotExist', 'mongoengine.queryset.base.BaseQuerySet.exec_js', 'mongoengine.errors.MongoEngineException', 'mongoengine.fields.GenericReferenceField.__get__', 'mongoengine.document.Document._get_capped_collection', 'mongoengine.fields.GenericReferenceField', 'mongoengine.fields.LazyReferenceField', 'mongoengine.queryset.base.BaseQuerySet._cursor_args', 'mongoengine.base.document.BaseDocument.__setattr__', 'mongoengine.base.document.BaseDocument._build_index_spec', 'mongoengine.fields.CachedReferenceField', 'mongoengine.queryset.base.BaseQuerySet.with_id', 'mongoengine.errors.OperationError', 'mongoengine.base.document.BaseDocument', 'mongoengine.errors.MultipleObjectsReturned', 'mongoengine.queryset.base.BaseQuerySet.to_json', 'mongoengine.errors.NotRegistered', 'mongoengine.document.Document._qs', 'mongoengine.document.Document', 'mongoengine.context_managers.query_counter._turn_on_profiling', 'mongoengine.queryset.base.BaseQuerySet._clone_into']

As for other packages, the APIs of @outside_package_name are called by mongoengine 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 mongoengine from "mongoengine==0.22.1" to "mongoengine>=0.22.0,<=0.24.1". This will improve the applicability of bachelor-api and reduce the possibility of any further dependency conflict with other projects/packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant