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
setup.py: use wheel by default, latest psycopg2 #1059
Conversation
Motivation: * use the The psycopg2 wheel (pre-compiled binary) for convenience where possible. * allow use of psycopg2.8 (and greater!) now that it is available. The change effectively reverts the setup.py changes in dd579cd and b95ac55, although that the 'detailed instructions' section introduced in dd579cd becomes relevant. In fact the option to install with `--no-binary` is only meaningful when the default requirement is the psycopg2-binary. I think that this is a reasonable proposal, but would like to know if there were any other reasons behind b95ac55 that would prevent using psycopg2 2.8 being usable.
Codecov Report
@@ Coverage Diff @@
## master #1059 +/- ##
==========================================
- Coverage 84.84% 84.72% -0.13%
==========================================
Files 21 21
Lines 2494 2494
==========================================
- Hits 2116 2113 -3
- Misses 378 381 +3
Continue to review full report at Codecov.
|
Having looked a bit further around the conversation surrounding this: ... this PR still seems like a reasonable change (and it would close #1036). The (recent) release of psycopg2 2.8 should get rid of the warning users have previously objected to. Depending on the wheel should be best for most users. Those who specifically need to build from source can still do so using the instructions specified in the 'detailed instructions'. 'course I may still be missing something - please let me know :) |
From the psycopg docs [1]: The psycopg2-binary package is meant for beginners to start playing with Python and PostgreSQL without the need to meet the build requirements. If you are the maintainer of a publish package depending on psycopg2 you shouldn’t use ‘psycopg2-binary’ as a module dependency. For production use you are advised to use the source distribution. The [1] http://initd.org/psycopg/docs/install.html#binary-install-from-pypi |
pgcli depends on sqlparse<0.3.0,>=0.2.2, and sqlparse was updated to 0.3.0 in ports r495481. pgcli depends on psycopg2>=2.7.4,<2.8, and psycopg2 was updated to 2.8.2 in ports r502646. These broke run time, with the following error(s) raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'sqlparse<0.3.0,>=0.2.2' distribution was not found and is required by pgcli raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'psycopg2>=2.7.4,<2.8' distribution was not found and is required by pgcli Upstream upgraded sqlparse support to include 0.3.0 in PR #1052 [1], this change backports that PR accordingly. Upstream has an open PR to unpin psycopg2 [2][3] but it needs to be updated to use psycopg2 (not psycopg2-binary) in install_requires. This change patches out the psycopg2 max version. The test results shows no test failure delta with 2.8.2 over 2.7.7 (the version before ports r502646). While I'm here: - Declare pinned (maximum) RUN_DEPENDS versions according to setup.py to pick these issues up earlier during QA (max versions not being satisfied will error out during dependency builds/verification pre-commit [1] dbcli/pgcli#1052 [2] dbcli/pgcli#1059 [3] dbcli/pgcli#1036 PR: 238182 Reported by: Marcin Cieślak <saper saper info> Approved by: portmgr (blanket: run time fix, just fix it) git-svn-id: svn+ssh://svn.freebsd.org/ports/head@502867 35697150-7ecd-e111-bb59-0022644237b5
pgcli depends on sqlparse<0.3.0,>=0.2.2, and sqlparse was updated to 0.3.0 in ports r495481. pgcli depends on psycopg2>=2.7.4,<2.8, and psycopg2 was updated to 2.8.2 in ports r502646. These broke run time, with the following error(s) raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'sqlparse<0.3.0,>=0.2.2' distribution was not found and is required by pgcli raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'psycopg2>=2.7.4,<2.8' distribution was not found and is required by pgcli Upstream upgraded sqlparse support to include 0.3.0 in PR #1052 [1], this change backports that PR accordingly. Upstream has an open PR to unpin psycopg2 [2][3] but it needs to be updated to use psycopg2 (not psycopg2-binary) in install_requires. This change patches out the psycopg2 max version. The test results shows no test failure delta with 2.8.2 over 2.7.7 (the version before ports r502646). While I'm here: - Declare pinned (maximum) RUN_DEPENDS versions according to setup.py to pick these issues up earlier during QA (max versions not being satisfied will error out during dependency builds/verification pre-commit [1] dbcli/pgcli#1052 [2] dbcli/pgcli#1059 [3] dbcli/pgcli#1036 PR: 238182 Reported by: Marcin Cieślak <saper saper info> Approved by: portmgr (blanket: run time fix, just fix it)
pgcli depends on sqlparse<0.3.0,>=0.2.2, and sqlparse was updated to 0.3.0 in ports r495481. pgcli depends on psycopg2>=2.7.4,<2.8, and psycopg2 was updated to 2.8.2 in ports r502646. These broke run time, with the following error(s) raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'sqlparse<0.3.0,>=0.2.2' distribution was not found and is required by pgcli raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'psycopg2>=2.7.4,<2.8' distribution was not found and is required by pgcli Upstream upgraded sqlparse support to include 0.3.0 in PR #1052 [1], this change backports that PR accordingly. Upstream has an open PR to unpin psycopg2 [2][3] but it needs to be updated to use psycopg2 (not psycopg2-binary) in install_requires. This change patches out the psycopg2 max version. The test results shows no test failure delta with 2.8.2 over 2.7.7 (the version before ports r502646). While I'm here: - Declare pinned (maximum) RUN_DEPENDS versions according to setup.py to pick these issues up earlier during QA (max versions not being satisfied will error out during dependency builds/verification pre-commit [1] dbcli/pgcli#1052 [2] dbcli/pgcli#1059 [3] dbcli/pgcli#1036 PR: 238182 Reported by: Marcin Cieślak <saper saper info> Approved by: portmgr (blanket: run time fix, just fix it) git-svn-id: svn+ssh://svn.freebsd.org/ports/head@502867 35697150-7ecd-e111-bb59-0022644237b5
pgcli depends on sqlparse<0.3.0,>=0.2.2, and sqlparse was updated to 0.3.0 in ports r495481. pgcli depends on psycopg2>=2.7.4,<2.8, and psycopg2 was updated to 2.8.2 in ports r502646. These broke run time, with the following error(s) raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'sqlparse<0.3.0,>=0.2.2' distribution was not found and is required by pgcli raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'psycopg2>=2.7.4,<2.8' distribution was not found and is required by pgcli Upstream upgraded sqlparse support to include 0.3.0 in PR #1052 [1], this change backports that PR accordingly. Upstream has an open PR to unpin psycopg2 [2][3] but it needs to be updated to use psycopg2 (not psycopg2-binary) in install_requires. This change patches out the psycopg2 max version. The test results shows no test failure delta with 2.8.2 over 2.7.7 (the version before ports r502646). While I'm here: - Declare pinned (maximum) RUN_DEPENDS versions according to setup.py to pick these issues up earlier during QA (max versions not being satisfied will error out during dependency builds/verification pre-commit [1] dbcli/pgcli#1052 [2] dbcli/pgcli#1059 [3] dbcli/pgcli#1036 PR: 238182 Reported by: Marcin Cieślak <saper saper info> Approved by: portmgr (blanket: run time fix, just fix it) git-svn-id: svn+ssh://svn.freebsd.org/ports/head@502867 35697150-7ecd-e111-bb59-0022644237b5
As @koobs pointed out, the psycopg docs state that projects should depend on the source rather than the binary.
The decision to depend upon psycopg2 rather than the psycopg2-binary makes the (deleted) instructions unnecessary.
@koobs - good point The project seemed split on which to use, with the README making it seem like the binary was the dependency, but then the actual dependency list using the source. And historically it looks like both had been used... I'm definitely happy to abide by the official docs and change the dependency to use the source. Given the change to depend on source, and with the README cleanup, does this now look better to you? |
@zadacka Thanks for the quick turnaround! The real distinction is between 'user/application deployments' and 'packaging' (the same distinction as *_requires vs requirements files). [1][2] Unfortunately the distinction has been lost among the noise of cries of "terrible packaging ecosystem" over the years, made worse by everyone doing everything their own unique new way :) But yes, I saw no test failure delta just unpinning psycopg2 in install_requires, so it should be good to go From my FreeBSD port commit log message:
[1] https://packaging.python.org/discussions/install-requires-vs-requirements/ |
@koobs Thanks! And thanks also for the links to reading notes. Some context: I previously had some problems (now solved) when trying to install psycopg2 from source; the pip error message contained the lines:
I initially read this as 'either option is fine' which seemed to contradict the psycopg docs, but it all makes more sense to me now in the context of (Side note: my problem above was |
@zadacka You're welcome, and yeh, many C/extension based packages have the same issue as they overlap into system/thirdparty library land, and all the lovely challenges that come along with it like a multitude of include/library paths and supporting different compilers/toolchains. But, this is also the beauty of upstreams and downstreams working together, everyone gets to learn about the grass on the other side. We're all consumers (downstreams) after all, as your experience too shows :) |
I was gonna add a merge request changing If anyone is reading this while the issue hasn't been fixed, just edit that one line in |
Actually reading through all your conversation it seems you haven't decided on merging this. Guess I'll make the merge request with my workaround then. Edit: here it is (#1060). |
After digging through psycopg2 issues, it looks to me like the original segfault problem that caused the split of However, psycopg/psycopg2#921 (comment) The following PR bumps psycopg2 to 2.8.2: I think we can merge that PR first, since jury is still out on "can wheels be default again" question. The README update is good. The http://initd.org/psycopg/docs/install.html#change-in-binary-packages-between-psycopg-2-7-and-2-8 |
For clarity, I've submitted the README changes as a separate PR: #1061 This should make it clear that this pull request (with 'use wheel by default' in the title) is NOT getting merged. It'll also keep the git history a little cleaner. |
Yikes! Sorry, I got tricked by the PR's title, and missed the fact that you don't actually switch to I'm going to review #1061. |
pgcli depends on sqlparse<0.3.0,>=0.2.2, and sqlparse was updated to 0.3.0 in ports r495481. pgcli depends on psycopg2>=2.7.4,<2.8, and psycopg2 was updated to 2.8.2 in ports r502646. These broke run time, with the following error(s) raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'sqlparse<0.3.0,>=0.2.2' distribution was not found and is required by pgcli raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'psycopg2>=2.7.4,<2.8' distribution was not found and is required by pgcli Upstream upgraded sqlparse support to include 0.3.0 in PR #1052 [1], this change backports that PR accordingly. Upstream has an open PR to unpin psycopg2 [2][3] but it needs to be updated to use psycopg2 (not psycopg2-binary) in install_requires. This change patches out the psycopg2 max version. The test results shows no test failure delta with 2.8.2 over 2.7.7 (the version before ports r502646). While I'm here: - Declare pinned (maximum) RUN_DEPENDS versions according to setup.py to pick these issues up earlier during QA (max versions not being satisfied will error out during dependency builds/verification pre-commit [1] dbcli/pgcli#1052 [2] dbcli/pgcli#1059 [3] dbcli/pgcli#1036 PR: 238182 Reported by: Marcin Cieślak <saper saper info> Approved by: portmgr (blanket: run time fix, just fix it)
Motivation:
The change effectively reverts the setup.py changes in dd579cd and b95ac55, although that the 'detailed instructions' section introduced in dd579cd becomes relevant. In fact the option to install with
--no-binary
is only meaningful when the default requirement is the psycopg2-binary.I think that this is a reasonable proposal, but would like to know if there were any other reasons behind b95ac55 that would prevent using psycopg2 2.8 being usable.
Description
Checklist
changelog.rst
.AUTHORS
file (or it's already there).pip install pre-commit && pre-commit install
), and ranblack
on my code.