Skip to content

Commit 2e6b5ba

Browse files
authored
Use psycopg2-binary + psycopg3 and keep internal connections separate (#40)
I want to use psycopg3 features (the sql module and the copy write_record) but don't want to break backwards compatibility just yet. This introduces psycopg3 while leaving in psycopg2 and switching it for the binary version to make it easier for users to install the library. While messing with the connection methods I've isolated the connection object that is returned from ldlite and the one that ldlite uses internally. This makes sure that the connections aren't broken or closed unexepectedly.
1 parent 98e1668 commit 2e6b5ba

File tree

8 files changed

+248
-64
lines changed

8 files changed

+248
-64
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ Please see [MIGRATING.md](./MIGRATING.md) for information on breaking changes.
1111

1212
### Added
1313

14+
- Connections returned from the LDLite.connect_db* methods are now isolated from the ones used internally.
15+
1416
### Fixed
1517

1618
### Changed
1719

20+
- psycopg3 is now used for internal operations. LDLite.connect_db_postgres will return a psycopg3 connection instead of psycopg2 in the next major release.
21+
- psycopg2 is now installed using the binary version.
22+
1823
### Removed
1924

2025
## [3.1.4] - September 2025

pylock.maximal.toml

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,39 @@ marker = "python_version >= \"3.13\" and \"default\" in dependency_groups"
210210
dependencies = []
211211

212212
[[packages]]
213-
name = "psycopg2"
214-
version = "2.9.10"
213+
name = "psycopg"
214+
version = "3.2.10"
215215
requires-python = ">=3.8"
216-
sdist = {name = "psycopg2-2.9.10.tar.gz", url = "https://files.pythonhosted.org/packages/62/51/2007ea29e605957a17ac6357115d0c1a1b60c8c984951c19419b3474cdfd/psycopg2-2.9.10.tar.gz", hashes = {sha256 = "12ec0b40b0273f95296233e8750441339298e6a572f7039da5b260e3c8b60e11"}}
216+
sdist = {name = "psycopg-3.2.10.tar.gz", url = "https://files.pythonhosted.org/packages/a9/f1/0258a123c045afaf3c3b60c22ccff077bceeb24b8dc2c593270899353bd0/psycopg-3.2.10.tar.gz", hashes = {sha256 = "0bce99269d16ed18401683a8569b2c5abd94f72f8364856d56c0389bcd50972a"}}
217217
wheels = [
218-
{name = "psycopg2-2.9.10-cp313-cp313-win_amd64.whl",url = "https://files.pythonhosted.org/packages/ae/49/a6cfc94a9c483b1fa401fbcb23aca7892f60c7269c5ffa2ac408364f80dc/psycopg2-2.9.10-cp313-cp313-win_amd64.whl",hashes = {sha256 = "91fd603a2155da8d0cfcdbf8ab24a2d54bca72795b90d2a3ed2b6da8d979dee2"}},
218+
{name = "psycopg-3.2.10-py3-none-any.whl",url = "https://files.pythonhosted.org/packages/4a/90/422ffbbeeb9418c795dae2a768db860401446af0c6768bc061ce22325f58/psycopg-3.2.10-py3-none-any.whl",hashes = {sha256 = "ab5caf09a9ec42e314a21f5216dbcceac528e0e05142e42eea83a3b28b320ac3"}},
219+
]
220+
marker = "python_version >= \"3.13\" and \"default\" in dependency_groups"
221+
222+
[packages.tool.pdm]
223+
dependencies = [
224+
"backports-zoneinfo>=0.2.0; python_version < \"3.9\"",
225+
"typing-extensions>=4.6; python_version < \"3.13\"",
226+
"tzdata; sys_platform == \"win32\"",
227+
]
228+
229+
[[packages]]
230+
name = "psycopg2-binary"
231+
version = "2.9.10"
232+
requires-python = ">=3.8"
233+
sdist = {name = "psycopg2-binary-2.9.10.tar.gz", url = "https://files.pythonhosted.org/packages/cb/0e/bdc8274dc0585090b4e3432267d7be4dfbfd8971c0fa59167c711105a6bf/psycopg2-binary-2.9.10.tar.gz", hashes = {sha256 = "4b3df0e6990aa98acda57d983942eff13d824135fe2250e6522edaa782a06de2"}}
234+
wheels = [
235+
{name = "psycopg2_binary-2.9.10-cp313-cp313-macosx_12_0_x86_64.whl",url = "https://files.pythonhosted.org/packages/3e/30/d41d3ba765609c0763505d565c4d12d8f3c79793f0d0f044ff5a28bf395b/psycopg2_binary-2.9.10-cp313-cp313-macosx_12_0_x86_64.whl",hashes = {sha256 = "26540d4a9a4e2b096f1ff9cce51253d0504dca5a85872c7f7be23be5a53eb18d"}},
236+
{name = "psycopg2_binary-2.9.10-cp313-cp313-macosx_14_0_arm64.whl",url = "https://files.pythonhosted.org/packages/35/44/257ddadec7ef04536ba71af6bc6a75ec05c5343004a7ec93006bee66c0bc/psycopg2_binary-2.9.10-cp313-cp313-macosx_14_0_arm64.whl",hashes = {sha256 = "e217ce4d37667df0bc1c397fdcd8de5e81018ef305aed9415c3b093faaeb10fb"}},
237+
{name = "psycopg2_binary-2.9.10-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",url = "https://files.pythonhosted.org/packages/1b/11/48ea1cd11de67f9efd7262085588790a95d9dfcd9b8a687d46caf7305c1a/psycopg2_binary-2.9.10-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",hashes = {sha256 = "245159e7ab20a71d989da00f280ca57da7641fa2cdcf71749c193cea540a74f7"}},
238+
{name = "psycopg2_binary-2.9.10-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl",url = "https://files.pythonhosted.org/packages/62/e0/62ce5ee650e6c86719d621a761fe4bc846ab9eff8c1f12b1ed5741bf1c9b/psycopg2_binary-2.9.10-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl",hashes = {sha256 = "3c4ded1a24b20021ebe677b7b08ad10bf09aac197d6943bfe6fec70ac4e4690d"}},
239+
{name = "psycopg2_binary-2.9.10-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl",url = "https://files.pythonhosted.org/packages/27/ce/63f946c098611f7be234c0dd7cb1ad68b0b5744d34f68062bb3c5aa510c8/psycopg2_binary-2.9.10-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl",hashes = {sha256 = "3abb691ff9e57d4a93355f60d4f4c1dd2d68326c968e7db17ea96df3c023ef73"}},
240+
{name = "psycopg2_binary-2.9.10-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",url = "https://files.pythonhosted.org/packages/43/25/c603cd81402e69edf7daa59b1602bd41eb9859e2824b8c0855d748366ac9/psycopg2_binary-2.9.10-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",hashes = {sha256 = "8608c078134f0b3cbd9f89b34bd60a943b23fd33cc5f065e8d5f840061bd0673"}},
241+
{name = "psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_aarch64.whl",url = "https://files.pythonhosted.org/packages/5f/d6/8708d8c6fca531057fa170cdde8df870e8b6a9b136e82b361c65e42b841e/psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_aarch64.whl",hashes = {sha256 = "230eeae2d71594103cd5b93fd29d1ace6420d0b86f4778739cb1a5a32f607d1f"}},
242+
{name = "psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_i686.whl",url = "https://files.pythonhosted.org/packages/ce/ac/5b1ea50fc08a9df82de7e1771537557f07c2632231bbab652c7e22597908/psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_i686.whl",hashes = {sha256 = "bb89f0a835bcfc1d42ccd5f41f04870c1b936d8507c6df12b7737febc40f0909"}},
243+
{name = "psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_ppc64le.whl",url = "https://files.pythonhosted.org/packages/c4/fc/504d4503b2abc4570fac3ca56eb8fed5e437bf9c9ef13f36b6621db8ef00/psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_ppc64le.whl",hashes = {sha256 = "f0c2d907a1e102526dd2986df638343388b94c33860ff3bbe1384130828714b1"}},
244+
{name = "psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_x86_64.whl",url = "https://files.pythonhosted.org/packages/b2/d1/323581e9273ad2c0dbd1902f3fb50c441da86e894b6e25a73c3fda32c57e/psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_x86_64.whl",hashes = {sha256 = "f8157bed2f51db683f31306aa497311b560f2265998122abe1dce6428bd86567"}},
245+
{name = "psycopg2_binary-2.9.10-cp313-cp313-win_amd64.whl",url = "https://files.pythonhosted.org/packages/08/50/d13ea0a054189ae1bc21af1d85b6f8bb9bbc5572991055d70ad9006fe2d6/psycopg2_binary-2.9.10-cp313-cp313-win_amd64.whl",hashes = {sha256 = "27422aa5f11fbcd9b18da48373eb67081243662f9b46e6fd07c3eb46e4535142"}},
219246
]
220247
marker = "python_version >= \"3.13\" and \"default\" in dependency_groups"
221248

@@ -633,8 +660,21 @@ marker = "python_version >= \"3.13\" and \"types\" in dependency_groups"
633660
[packages.tool.pdm]
634661
dependencies = []
635662

663+
[[packages]]
664+
name = "tzdata"
665+
version = "2025.2"
666+
requires-python = ">=2"
667+
sdist = {name = "tzdata-2025.2.tar.gz", url = "https://files.pythonhosted.org/packages/95/32/1a225d6164441be760d75c2c42e2780dc0873fe382da3e98a2e1e48361e5/tzdata-2025.2.tar.gz", hashes = {sha256 = "b60a638fcc0daffadf82fe0f57e53d06bdec2f36c4df66280ae79bce6bd6f2b9"}}
668+
wheels = [
669+
{name = "tzdata-2025.2-py2.py3-none-any.whl",url = "https://files.pythonhosted.org/packages/5c/23/c7abc0ca0a1526a0774eca151daeb8de62ec457e77262b66b359c3c7679e/tzdata-2025.2-py2.py3-none-any.whl",hashes = {sha256 = "1a403fada01ff9221ca8044d701868fa132215d84beb92242d9acd2147f667a8"}},
670+
]
671+
marker = "sys_platform == \"win32\" and python_version >= \"3.13\" and \"default\" in dependency_groups"
672+
673+
[packages.tool.pdm]
674+
dependencies = []
675+
636676
[tool.pdm]
637-
hashes = {sha256 = "8f79d3a116fb2aeff8263d46e00c1f48dbba637f607c3da738af719783d85afe"}
677+
hashes = {sha256 = "993642e8053f231239acbb7c445ace66bc6705d078056cf64d5ce3729d4d43c3"}
638678
strategy = ["inherit_metadata", "static_urls"]
639679

640680
[[tool.pdm.targets]]

0 commit comments

Comments
 (0)