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 databases #26

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

Suggest to loosen the dependency on databases #26

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

Comments

@Agnes-U
Copy link

Agnes-U commented Jul 28, 2022

Hi, your project pdb-profiling requires "databases==0.4.3" in its dependency. After analyzing the source code, we found that the following versions of databases can also be suitable without affecting your project, i.e., databases 0.4.0, 0.4.1, 0.4.2. Therefore, we suggest to loosen the dependency on databases from "databases==0.4.3" to "databases>=0.4.0,<=0.4.3" to avoid any possible conflict for importing more packages or for downstream projects that may use pdb-profiling.

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

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 pdb-profiling directly uses 1 APIs from package databases.

databases.core.Database.__init__

Beginning from the 1 APIs above, 6 functions are then indirectly called, including 3 databases's internal APIs and 3 outsider APIs. The specific call graph is listed as follows (neglecting some repeated function occurrences).

[/NatureGeorge/pdb-profiling]
+--databases.core.Database.__init__
|      +--databases.core.DatabaseURL.__init__
|      +--databases.importer.import_from_string
|      |      +--databases.importer.ImportFromStringError.__init__
|      |      +--importlib.import_module
|      +--aiocontextvars.ContextVar
|      +--contextvars.ContextVar

We scan databases's versions and observe that during its evolution between any version from [0.4.0, 0.4.1, 0.4.2] and 0.4.3, 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.4.3(original) 0.4.0
['databases.backends.postgres.Record', 'databases.backends.postgres.PostgresBackend._get_connection_kwargs', 'databases.backends.postgres.Record.__getitem__', 'databases.backends.postgres.PostgresBackend']

diff: 0.4.3(original) 0.4.1
['databases.backends.postgres.Record', 'databases.backends.postgres.PostgresBackend._get_connection_kwargs', 'databases.backends.postgres.Record.__getitem__', 'databases.backends.postgres.PostgresBackend']

diff: 0.4.3(original) 0.4.2
[](no clear difference between the source codes of two versions)

diff: 0.4.3(original) 0.5.0
['databases.backends.postgres.Record.values', 'databases.backends.postgres.Record._mapping', 'databases.core.Database._new_connection', 'databases.core.Database.connection', 'databases.backends.postgres.Record', 'databases.core.Database.connect', 'databases.backends.aiopg.AiopgConnection', 'databases.backends.sqlite.SQLiteConnection', 'databases.backends.mysql.MySQLConnection', 'databases.core.Database', 'databases.backends.postgres.Record.keys']

diff: 0.4.3(original) 0.5.1
['databases.backends.postgres.PostgresConnection', 'databases.core.Database', 'databases.backends.postgres.Record.values', 'databases.backends.postgres.Record._mapping', 'databases.core.Database._new_connection', 'databases.core.Database.connection', 'databases.backends.postgres.Record', 'databases.core.Database.connect', 'databases.backends.aiopg.AiopgConnection', 'databases.backends.sqlite.SQLiteConnection', 'databases.backends.mysql.MySQLConnection', 'databases.backends.postgres.PostgresConnection._compile', 'databases.backends.postgres.Record.keys']

diff: 0.4.3(original) 0.5.2
['databases.backends.postgres.PostgresConnection', 'databases.core.Database', 'databases.backends.postgres.Record.values', 'databases.backends.postgres.Record._mapping', 'databases.core.Database._new_connection', 'databases.core.Database.connection', 'databases.backends.postgres.Record', 'databases.core.Database.connect', 'databases.backends.aiopg.AiopgConnection', 'databases.backends.sqlite.SQLiteConnection', 'databases.backends.postgres.Record.keys', 'databases.backends.mysql.MySQLConnection', 'databases.backends.postgres.PostgresConnection._compile', 'databases.core.Connection']

diff: 0.4.3(original) 0.5.3
['databases.backends.postgres.PostgresConnection', 'databases.core.Database', 'databases.backends.postgres.Record.values', 'databases.backends.postgres.Record._mapping', 'databases.core.Database._new_connection', 'databases.core.Database.connection', 'databases.core.Database._get_backend', 'databases.backends.postgres.Record', 'databases.core.Database.connect', 'databases.backends.aiopg.AiopgConnection', 'databases.backends.sqlite.SQLiteConnection', 'databases.backends.postgres.Record.keys', 'databases.backends.mysql.MySQLConnection', 'databases.backends.postgres.PostgresConnection._compile', 'databases.core.Connection']

diff: 0.4.3(original) 0.5.4
['databases.backends.asyncmy.AsyncMyConnection.iterate', 'databases.backends.asyncmy.AsyncMyConnection.raw_connection', 'databases.backends.asyncmy.AsyncMyConnection.release', 'databases.backends.asyncmy.AsyncMyConnection.fetch_all', 'databases.backends.asyncmy.AsyncMyConnection.__init__', 'databases.backends.asyncmy.AsyncMyTransaction.__init__', 'databases.backends.postgres.Record._mapping', 'databases.core.Database._new_connection', 'databases.backends.aiopg.AiopgConnection', 'databases.backends.asyncmy.AsyncMyTransaction', 'databases.core.Connection', 'databases.backends.asyncmy.AsyncMyConnection._compile', 'databases.backends.asyncmy.AsyncMyConnection.fetch_one', 'databases.backends.asyncmy.AsyncMyTransaction.rollback', 'databases.backends.asyncmy.AsyncMyConnection.transaction', 'databases.backends.asyncmy.CompilationContext.__init__', 'databases.backends.asyncmy.AsyncMyConnection.acquire', 'databases.backends.sqlite.SQLiteConnection', 'databases.backends.postgres.PostgresConnection._compile', 'databases.backends.postgres.PostgresConnection', 'databases.backends.asyncmy.CompilationContext', 'databases.interfaces.ConnectionBackend', 'databases.backends.asyncmy.AsyncMyBackend.__init__', 'databases.core.Database.connection', 'databases.backends.asyncmy.AsyncMyBackend.disconnect', 'databases.backends.asyncmy.AsyncMyBackend', 'databases.core.DatabaseURL', 'databases.backends.asyncmy.AsyncMyBackend._get_connection_kwargs', 'databases.core.Database.connect', 'databases.backends.asyncmy.AsyncMyTransaction.commit', 'databases.core.Database', 'databases.backends.asyncmy.AsyncMyBackend.connection', 'databases.backends.asyncmy.AsyncMyConnection', 'databases.backends.asyncmy.AsyncMyTransaction.start', 'databases.backends.postgres.Record.keys', 'databases.backends.asyncmy.AsyncMyConnection.execute', 'databases.backends.postgres.Record.values', 'databases.backends.asyncmy.AsyncMyConnection.execute_many', 'databases.core.Database._get_backend', 'databases.backends.postgres.Record', 'databases.backends.asyncmy.AsyncMyBackend.connect', 'databases.backends.mysql.MySQLConnection', 'databases.core.DatabaseURL.hostname']

diff: 0.4.3(original) 0.5.5
['databases.backends.asyncmy.AsyncMyConnection.iterate', 'databases.backends.asyncmy.AsyncMyConnection.raw_connection', 'databases.backends.asyncmy.AsyncMyConnection.release', 'databases.backends.asyncmy.AsyncMyConnection.fetch_all', 'databases.backends.asyncmy.AsyncMyConnection.__init__', 'databases.backends.asyncmy.AsyncMyTransaction.__init__', 'databases.backends.postgres.Record._mapping', 'databases.core.Database._new_connection', 'databases.backends.aiopg.AiopgConnection', 'databases.backends.asyncmy.AsyncMyTransaction', 'databases.core.Connection', 'databases.backends.asyncmy.AsyncMyConnection._compile', 'databases.backends.asyncmy.AsyncMyConnection.fetch_one', 'databases.backends.asyncmy.AsyncMyTransaction.rollback', 'databases.backends.asyncmy.AsyncMyConnection.transaction', 'databases.backends.asyncmy.CompilationContext.__init__', 'databases.backends.asyncmy.AsyncMyConnection.acquire', 'databases.backends.sqlite.SQLiteConnection', 'databases.backends.postgres.PostgresConnection._compile', 'databases.backends.postgres.PostgresConnection', 'databases.backends.asyncmy.CompilationContext', 'databases.backends.asyncmy.AsyncMyBackend.__init__', 'databases.core.Database.connection', 'databases.backends.asyncmy.AsyncMyBackend.disconnect', 'databases.backends.asyncmy.AsyncMyBackend', 'databases.core.DatabaseURL', 'databases.backends.asyncmy.AsyncMyBackend._get_connection_kwargs', 'databases.backends.postgres.Record.__getattr__', 'databases.core.Database.connect', 'databases.backends.asyncmy.AsyncMyTransaction.commit', 'databases.core.Database', 'databases.backends.asyncmy.AsyncMyBackend.connection', 'databases.backends.asyncmy.AsyncMyConnection', 'databases.backends.asyncmy.AsyncMyTransaction.start', 'databases.backends.postgres.Record.keys', 'databases.backends.asyncmy.AsyncMyConnection.execute', 'databases.backends.postgres.Record.values', 'databases.backends.asyncmy.AsyncMyConnection.execute_many', 'databases.core.Database._get_backend', 'databases.backends.postgres.Record', 'databases.backends.asyncmy.AsyncMyBackend.connect', 'databases.backends.mysql.MySQLConnection', 'databases.core.DatabaseURL.hostname']

As for other packages, the APIs of aiocontextvars, contextvars and importlib are called by databases 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 databases from "databases==0.4.3" to "databases>=0.4.0,<=0.4.3". This will improve the applicability of pdb-profiling and reduce the possibility of any further dependency conflict with other projects.

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