From 316423ac8eef682c885f4ea875d6eac7c0782658 Mon Sep 17 00:00:00 2001 From: David Cain Date: Fri, 24 Sep 2021 06:25:32 -0700 Subject: [PATCH] Switch to psycopg2 from wheel-only psycopg2-binary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This closes https://github.com/biocommons/hgvs/issues/623 Per the authors of the `psycopg2` package, `psycopg2-binary` "is meant for beginners to start playing with Python and PostgreSQL without the need to meet the build requirements." However, it's preferable to depend on `psycopg2` for production software. Issues in flight which should make this change irrelevant --------------------------------------------------------- - [make data provider dependencies optional][hgvs-optional-deps] - [replace psycopg2 with asyncpg][hgvs-asyncpg] - [use a REST interface, eliminating libpq dependency][hgvs-rest] ------------------------------------------------------------------------ Why move away from `psycopg2-binary`? ===================================== The psycopg2 project makes two recommendations in the [psycopg2 vs psycopg2-binary][psycopg2-vs-psycopg2-binary] docs: > If you are the maintainer of a published package depending on `psycopg2` you > shouldn’t use `psycopg2-binary` as a module dependency. Secondarily: > **For production use you are advised to use the source distribution.** This means that any production software depending on `hgvs` will have to install `psycopg2-binary`. History of the two packages =========================== Starting with Psycopg2 2.8, there are now two packages (explained in the [2.7.4 release notes][psycopg2-274]): - `psycopg2`: source distribution, advised for production. - `psycopg2-binary`: "quickest way to install" (a "pre-compiled binary version") There is substantial discussion in [an issue on the `psycopg2` project][gh-thread], which I won't re-summarize here, but one takeaway is that many Python packages now depend on `psycopg2-binary`, and others on `psycopg2`. Ideally, all libraries just depend on `psycopg2`. Alternate solutions to the split exist (like [`Provides-Dist` from PEP 345][provides-dist]). However, the [`Provides-Dist` field is "rarely used"][provides-dist-rarely-used] and thus ignored most of the time. [`hgvs` switched to `psycopg2-binary`][hgvs-switch-to-binary] shortly after the 2.7.4 release. [gh-thread]: https://github.com/psycopg/psycopg2/issues/674 [hgvs-asyncpg]: https://github.com/biocommons/hgvs/issues/603 [hgvs-optional-deps]: https://github.com/biocommons/hgvs/issues/199 [hgvs-rest]: https://github.com/biocommons/hgvs/issues/199#issuecomment-285513007 [hgvs-switch-to-binary]: https://github.com/biocommons/hgvs/commit/4c75a4e5 [provides-dist-rarely-used]: https://packaging.python.org/specifications/core-metadata/#provides-dist-multiple-use [provides-dist]: https://www.python.org/dev/peps/pep-0345/#provides-dist-multiple-use [psycopg2-274]: https://www.psycopg.org/articles/2018/02/08/psycopg-274-released/ [psycopg2-vs-psycopg2-binary]: https://www.psycopg.org/docs/install.html#psycopg-vs-psycopg-binary --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ee90a7b0..0662ea13 100644 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ "configparser>=3.3.0", "ipython", "parsley", - "psycopg2-binary", + "psycopg2", "six", ], setup_requires=[