]> git.ipfire.org Git - thirdparty/psycopg.git/log
thirdparty/psycopg.git
3 months agorefactor: use assignment expressions in loops with assignment and break 1035/head
Daniele Varrazzo [Thu, 27 Mar 2025 16:36:29 +0000 (17:36 +0100)] 
refactor: use assignment expressions in loops with assignment and break

3 months agorefactor: use the assignment operator in assignments followed by an if
Daniele Varrazzo [Thu, 27 Mar 2025 00:25:49 +0000 (01:25 +0100)] 
refactor: use the assignment operator in assignments followed by an if

3 months agochore(deps): bump the actions group with 2 updates
dependabot[bot] [Tue, 1 Apr 2025 07:17:44 +0000 (07:17 +0000)] 
chore(deps): bump the actions group with 2 updates

Bumps the actions group with 2 updates: [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) and [prefix-dev/setup-pixi](https://github.com/prefix-dev/setup-pixi).

Updates `pypa/cibuildwheel` from 2.22.0 to 2.23.2
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v2.22.0...v2.23.2)

Updates `prefix-dev/setup-pixi` from 0.8.3 to 0.8.4
- [Release notes](https://github.com/prefix-dev/setup-pixi/releases)
- [Commits](https://github.com/prefix-dev/setup-pixi/compare/v0.8.3...v0.8.4)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-version: 2.23.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: prefix-dev/setup-pixi
  dependency-version: 0.8.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
3 months agodocs: improve basic usage example
Daniele Varrazzo [Thu, 27 Mar 2025 11:05:25 +0000 (12:05 +0100)] 
docs: improve basic usage example

Be consistent with return/print, make the second print actually print
something (taking the chance to showcase `executemany()`).

3 months agodocs: rename some news.rst section headers from python to psycopg 1036/head
LuiMoiPer [Thu, 27 Mar 2025 05:43:02 +0000 (22:43 -0700)] 
docs: rename some news.rst section headers from python to psycopg

3 months agoperf(composite): drop an if and a tuple() call
Daniele Varrazzo [Wed, 26 Mar 2025 18:56:32 +0000 (19:56 +0100)] 
perf(composite): drop an if and a tuple() call

3 months agoMerge pull request #1033 from Zaczero/shapely-srid
Daniele Varrazzo [Wed, 26 Mar 2025 18:23:14 +0000 (18:23 +0000)] 
Merge pull request #1033 from Zaczero/shapely-srid

Add shapely SRID support.

3 months agoci(shapely): test shapely with a more current Python version 1033/head
Daniele Varrazzo [Wed, 26 Mar 2025 14:51:50 +0000 (15:51 +0100)] 
ci(shapely): test shapely with a more current Python version

3 months agotest(shapely): better use of fixtures to drop test duplications
Daniele Varrazzo [Wed, 26 Mar 2025 14:46:00 +0000 (15:46 +0100)] 
test(shapely): better use of fixtures to drop test duplications

3 months agodocs: mention shapely SRID support in news file
Daniele Varrazzo [Tue, 25 Mar 2025 18:44:29 +0000 (19:44 +0100)] 
docs: mention shapely SRID support in news file

3 months agofix: manage shapely conditional imports explicitly
Daniele Varrazzo [Tue, 25 Mar 2025 18:23:41 +0000 (19:23 +0100)] 
fix: manage shapely conditional imports explicitly

3 months agotest(shapely): Handle missing SRID support
Kamil Monicz [Mon, 24 Mar 2025 11:47:23 +0000 (11:47 +0000)] 
test(shapely): Handle missing SRID support

3 months agofix(shapely): maintain Shapely < 2 compatibility
Kamil Monicz [Mon, 24 Mar 2025 11:32:41 +0000 (11:32 +0000)] 
fix(shapely): maintain Shapely < 2 compatibility

3 months agochore: add types-shapely to dev dependencies
Daniele Varrazzo [Sun, 23 Mar 2025 17:14:11 +0000 (18:14 +0100)] 
chore: add types-shapely to dev dependencies

3 months agofix(shapely): add SRID support
Kamil Monicz [Sun, 23 Mar 2025 10:30:11 +0000 (10:30 +0000)] 
fix(shapely): add SRID support

3 months agochore: configure flake8 for imports after pytest's importorskip
Daniele Varrazzo [Sun, 23 Mar 2025 22:10:57 +0000 (23:10 +0100)] 
chore: configure flake8 for imports after pytest's importorskip

3 months agoci: fix running bin package workflow only on workflow file changed 1032/head
Trim21 [Fri, 21 Mar 2025 20:01:24 +0000 (04:01 +0800)] 
ci: fix running bin package workflow only on workflow file changed

3 months agofix: fix `status` annotation in `connection_summary` 1023/head
sobolevn [Thu, 13 Mar 2025 10:40:42 +0000 (13:40 +0300)] 
fix: fix `status` annotation in `connection_summary`

Currently enum names are strings, but this is being changed to become
Literal. When this will happen, the type inferred will not be valid
anymore, as we mutate it and manipulate it as string in the function.

See https://github.com/python/mypy/pull/18797

3 months agochore: bump psycopg package version to 3.2.6
Daniele Varrazzo [Wed, 12 Mar 2025 17:57:00 +0000 (18:57 +0100)] 
chore: bump psycopg package version to 3.2.6

3 months agoMerge pull request #1022 from psycopg/fix-target_session_attrs-prefer-standby
Daniele Varrazzo [Wed, 12 Mar 2025 17:49:22 +0000 (17:49 +0000)] 
Merge pull request #1022 from psycopg/fix-target_session_attrs-prefer-standby

fix: implement libpq semantic for target_session_attrs=prefer-standby

3 months agotest: skip target_session_attrs with libpw < 14 1022/head
Daniele Varrazzo [Mon, 10 Mar 2025 23:26:23 +0000 (00:26 +0100)] 
test: skip target_session_attrs with libpw < 14

Only one test fails with the currently "oldest" libpq, which is 10.2,
however the docs in libpq 13 are not explicit in which modes are
supported and, afaics, 'replica' shouldn't work either.

https://www.postgresql.org/docs/13/libpq-connect.html

3 months agofix: implement libpq semantic for target_session_attrs=prefer-standby
Daniele Varrazzo [Mon, 10 Mar 2025 22:53:31 +0000 (23:53 +0100)] 
fix: implement libpq semantic for target_session_attrs=prefer-standby

First attempt all the servers in standby mode, then fall back to any
mode.

Fix #1021.

4 months agochore: rename tools/build library "ci" 1011/head
Daniele Varrazzo [Sat, 22 Feb 2025 14:00:38 +0000 (15:00 +0100)] 
chore: rename tools/build library "ci"

The name `build` is problematic because we typically want to avoid tools
to go exploring them (mypy, isort, black...) but this leaves this
directory unexplored.

4 months agoci: install win32 libpq from conda force
trim21 [Sun, 23 Feb 2025 09:25:45 +0000 (17:25 +0800)] 
ci: install win32 libpq from conda force

4 months agochore: bump psycopg_pool package version to 3.2.6
Daniele Varrazzo [Tue, 25 Feb 2025 21:08:48 +0000 (22:08 +0100)] 
chore: bump psycopg_pool package version to 3.2.6

4 months agoMerge branch 'fix-transaction-after-check-master'
Daniele Varrazzo [Tue, 25 Feb 2025 20:51:48 +0000 (21:51 +0100)] 
Merge branch 'fix-transaction-after-check-master'

4 months agodocs(pool): add release note about ticket #1014 1015/head
Daniele Varrazzo [Tue, 25 Feb 2025 20:40:52 +0000 (21:40 +0100)] 
docs(pool): add release note about ticket #1014

4 months agofix(pool): reset connection transaction status after failed check
Kanav Kalucha [Tue, 25 Feb 2025 18:28:38 +0000 (10:28 -0800)] 
fix(pool): reset connection transaction status after failed check

Close #1014

4 months agochore: bump build libraries
Daniele Varrazzo [Sat, 22 Feb 2025 13:45:18 +0000 (14:45 +0100)] 
chore: bump build libraries

4 months agofix win32 libpq missing error
Trim21 [Sat, 22 Feb 2025 18:12:26 +0000 (02:12 +0800)] 
fix win32 libpq missing error

4 months agochore: bump psycopg package version to 3.2.5
Daniele Varrazzo [Sat, 22 Feb 2025 13:46:50 +0000 (14:46 +0100)] 
chore: bump psycopg package version to 3.2.5

4 months agochore: bump psycopg_pool package version to 3.2.5
Daniele Varrazzo [Fri, 21 Feb 2025 21:23:30 +0000 (22:23 +0100)] 
chore: bump psycopg_pool package version to 3.2.5

4 months agofix(pool): check that there is some connection in the pool before shrinking
Daniele Varrazzo [Fri, 21 Feb 2025 16:27:29 +0000 (17:27 +0100)] 
fix(pool): check that there is some connection in the pool before shrinking

There is a race condition between shrinking the pool and closing an
expired connection which might result in attempting to pop from the
empty _pool deque. Add a check to prevent that.

The bug is not serious as it doesn't compromise the pool working but it causes
noise in the logging.

Close #1001

4 months agoMerge pull request #998 from henadzit/cython-uuid
Daniele Varrazzo [Thu, 20 Feb 2025 10:10:52 +0000 (11:10 +0100)] 
Merge pull request #998 from henadzit/cython-uuid

Add Cython UUID Loader

4 months agodocs: mention UUID speedup in release news 998/head
Daniele Varrazzo [Thu, 13 Feb 2025 15:58:44 +0000 (16:58 +0100)] 
docs: mention UUID speedup in release news

4 months agochore(c): remove C UUIDDumper and UUIDBinaryDumper
henadzit [Mon, 10 Feb 2025 22:37:50 +0000 (23:37 +0100)] 
chore(c): remove C UUIDDumper and UUIDBinaryDumper

4 months agoperf(uuid): speed up UUID creation using a writable subclass
Daniele Varrazzo [Sat, 8 Feb 2025 15:36:25 +0000 (16:36 +0100)] 
perf(uuid): speed up UUID creation using a writable subclass

Introduce an object memory-compatible with UUID, but writable. Try to
create this object in the fastest possible way: calling __new__ and
setting its attributes. Then replace the class with the standard UUID.

4 months agoperf(c): use PyObject_CallFunctionObjArgs in UUIDBinaryLoader
henadzit [Fri, 7 Feb 2025 18:43:49 +0000 (19:43 +0100)] 
perf(c): use PyObject_CallFunctionObjArgs in UUIDBinaryLoader

4 months agoperf(c): use PyObject_CallFunctionObjArgs in UUIDLoader
henadzit [Fri, 7 Feb 2025 18:11:40 +0000 (19:11 +0100)] 
perf(c): use PyObject_CallFunctionObjArgs in UUIDLoader

4 months agotest(c): test UUID.__slots__
henadzit [Fri, 7 Feb 2025 17:03:43 +0000 (18:03 +0100)] 
test(c): test UUID.__slots__

4 months agoperf(c): Use hex_to_int_map in UUIDLoader
henadzit [Sun, 2 Feb 2025 18:29:01 +0000 (19:29 +0100)] 
perf(c): Use hex_to_int_map in UUIDLoader

4 months agoperf(c): lazy load UUID
henadzit [Thu, 30 Jan 2025 10:02:39 +0000 (11:02 +0100)] 
perf(c): lazy load UUID

4 months agoperf(c): use UUID.__new__
henadzit [Wed, 29 Jan 2025 23:32:17 +0000 (00:32 +0100)] 
perf(c): use UUID.__new__

4 months agoperf(c): add Cython UUID dumper and loader
henadzit [Mon, 27 Jan 2025 18:26:00 +0000 (19:26 +0100)] 
perf(c): add Cython UUID dumper and loader

4 months agochore(ci): drop stale comment
Daniele Varrazzo [Fri, 14 Feb 2025 16:38:22 +0000 (17:38 +0100)] 
chore(ci): drop stale comment

4 months agoci(crdb): enable back crdb 25.1 tests
Daniele Varrazzo [Thu, 13 Feb 2025 17:44:32 +0000 (18:44 +0100)] 
ci(crdb): enable back crdb 25.1 tests

Test were failing because of the setting 'autocommit_before_ddl' now
defaulting to 'on'. After exchanging with CRDB developer, this seems the
correct behaviour for their database moving on.

4 months agoci: add missing dependency to run isort --color
Daniele Varrazzo [Thu, 13 Feb 2025 13:36:33 +0000 (14:36 +0100)] 
ci: add missing dependency to run isort --color

4 months agoci(crdb): suspend testing with 25.1
Daniele Varrazzo [Wed, 12 Feb 2025 11:38:38 +0000 (12:38 +0100)] 
ci(crdb): suspend testing with 25.1

There are some failures with the current image, reported upstream.

4 months agochore: tweak linters output in pre-commit
Daniele Varrazzo [Thu, 13 Feb 2025 12:57:40 +0000 (13:57 +0100)] 
chore: tweak linters output in pre-commit

4 months agoMerge pull request #1006 from psycopg/isort
Daniele Varrazzo [Thu, 13 Feb 2025 12:57:08 +0000 (13:57 +0100)] 
Merge pull request #1006 from psycopg/isort

Use isort to standardise imports

4 months agochore(isort): add source link to project metadata, tweak readme 1006/head
Daniele Varrazzo [Thu, 13 Feb 2025 10:54:46 +0000 (11:54 +0100)] 
chore(isort): add source link to project metadata, tweak readme

4 months agostyle: apply isort on codebase
Daniele Varrazzo [Tue, 11 Feb 2025 21:54:25 +0000 (22:54 +0100)] 
style: apply isort on codebase

4 months agochore: add isort configuration
Daniele Varrazzo [Tue, 11 Feb 2025 21:23:50 +0000 (22:23 +0100)] 
chore: add isort configuration

4 months agostyle: add isort plugin to sort imports with the desired style
Daniele Varrazzo [Wed, 12 Feb 2025 12:26:40 +0000 (13:26 +0100)] 
style: add isort plugin to sort imports with the desired style

Sort imports by length, imported objects naturally.

5 months agoci: bump Python version in Django main test to 3.12
Daniele Varrazzo [Tue, 28 Jan 2025 13:57:18 +0000 (14:57 +0100)] 
ci: bump Python version in Django main test to 3.12

Python 3.11 is no longer supported in Django main version..

install libmemcached-dev to satisfy a Django dev dependency for a
package that doesn't provide a wheel distribution. Close #999.

Tests with both the oldest and the newest versions supported by Django.

5 months agoci: avoid segfault building binary packages caused by qemu bugs
Daniele Varrazzo [Wed, 29 Jan 2025 10:27:04 +0000 (11:27 +0100)] 
ci: avoid segfault building binary packages caused by qemu bugs

Discussion at https://github.com/pypa/cibuildwheel/discussions/2256

5 months agostyle: adjust docstrings after black 25.1.0 upgrade
Daniele Varrazzo [Wed, 29 Jan 2025 12:48:10 +0000 (13:48 +0100)] 
style: adjust docstrings after black 25.1.0 upgrade

5 months agodocs: document why pre-commit language is set to 'local'
Daniele Varrazzo [Tue, 28 Jan 2025 13:54:00 +0000 (14:54 +0100)] 
docs: document why pre-commit language is set to 'local'

5 months agochore: typos fixed
Daniele Varrazzo [Tue, 28 Jan 2025 13:48:16 +0000 (14:48 +0100)] 
chore: typos fixed

5 months agodocs(ci): add notes about libpq caching
Daniele Varrazzo [Tue, 28 Jan 2025 13:39:51 +0000 (14:39 +0100)] 
docs(ci): add notes about libpq caching

5 months agoci(crdb): test with oldest supported Python release
Daniele Varrazzo [Sun, 19 Jan 2025 23:12:17 +0000 (00:12 +0100)] 
ci(crdb): test with oldest supported Python release

5 months agoci(crdb): test with the master release
Daniele Varrazzo [Sun, 19 Jan 2025 21:49:45 +0000 (22:49 +0100)] 
ci(crdb): test with the master release

5 months agoci(crdb): bump CockroachDB versions in tests
Daniele Varrazzo [Sun, 19 Jan 2025 10:44:30 +0000 (11:44 +0100)] 
ci(crdb): bump CockroachDB versions in tests

5 months agochore: bump psycopg package version to 3.2.4
Daniele Varrazzo [Wed, 15 Jan 2025 00:03:55 +0000 (01:03 +0100)] 
chore: bump psycopg package version to 3.2.4

5 months agodocs: mention the binary packages changes in news file
Daniele Varrazzo [Tue, 14 Jan 2025 23:54:40 +0000 (00:54 +0100)] 
docs: mention the binary packages changes in news file

5 months agochore(binary): bump libpq to 17.2
Daniele Varrazzo [Tue, 14 Jan 2025 11:24:47 +0000 (12:24 +0100)] 
chore(binary): bump libpq to 17.2

Note: on vcpkg, v17 is not available yet. Furthermore it's not easy to
pin the version. See https://github.com/microsoft/vcpkg/discussions/25622

5 months agochore(binary): bump OpenSSL to 3.4.0
Daniele Varrazzo [Tue, 14 Jan 2025 11:23:42 +0000 (12:23 +0100)] 
chore(binary): bump OpenSSL to 3.4.0

5 months agoMerge pull request #986 from psycopg/build-libpq-macos
Daniele Varrazzo [Tue, 14 Jan 2025 18:28:24 +0000 (19:28 +0100)] 
Merge pull request #986 from psycopg/build-libpq-macos

Build libpq on macOS

5 months agoci(binary): less verbose libpq build 986/head
Daniele Varrazzo [Fri, 10 Jan 2025 12:07:23 +0000 (13:07 +0100)] 
ci(binary): less verbose libpq build

5 months agoci(macos): build libpq instead of using Homebrew libraries
Daniele Varrazzo [Sun, 5 Jan 2025 23:48:36 +0000 (00:48 +0100)] 
ci(macos): build libpq instead of using Homebrew libraries

This avoids problems with MACOSX_DEPLOYMENT_TARGET drifting in builders
(see #858).

Largely contributed by @bwoodsend in https://github.com/psycopg/psycopg2/pull/1755.

5 months agorefactor: don't keep the notifiers backlog handler in the connection state 992/head
Daniele Varrazzo [Fri, 10 Jan 2025 14:17:01 +0000 (15:17 +0100)] 
refactor: don't keep the notifiers backlog handler in the connection state

Just keep the queue in the state and special-case its handling in the
`_notify_handler` connection method instead of registering a standard handler.
Set the queue to None to signify that we are in the `notifies()` generator.

This way we don't need the awkward weak-self + class method to avoid a
reference loop and to dereference the connection weak reference another
time, as we just did in `_notify_handler()`. Setting the queue to None
also feels cleaner than adding/removing the handler.

Relates to #975.

5 months agoMerge pull request #989 from psycopg/fix-clobbered-error-on-disconnect
Daniele Varrazzo [Fri, 10 Jan 2025 00:38:58 +0000 (01:38 +0100)] 
Merge pull request #989 from psycopg/fix-clobbered-error-on-disconnect

Fix clobbered error on disconnect

5 months agotest: soften disconnection tests on platforms knwon to behave differently 989/head
Daniele Varrazzo [Wed, 8 Jan 2025 13:10:16 +0000 (14:10 +0100)] 
test: soften disconnection tests on platforms knwon to behave differently

5 months agotest: add test to verify that a server disconnection now raises AdminShutdown
Daniele Varrazzo [Wed, 8 Jan 2025 12:36:26 +0000 (13:36 +0100)] 
test: add test to verify that a server disconnection now raises AdminShutdown

Previously it was raising OperationalError, but this was just the result
of the issue reported in #988. Note that AdminShutdown is a subclass of
OperationalError, therefore this change is backward compatible.

5 months agofix(c): don't clobber an error from the server with a server disconnection
Daniele Varrazzo [Wed, 8 Jan 2025 00:33:52 +0000 (01:33 +0100)] 
fix(c): don't clobber an error from the server with a server disconnection

Instead of raising the exception here, return the result and let the
caller handle the exception. This might make code paths more uniform and
helps the C implementation, because we actually never call
`error_from_result()` in the Cython code.

5 months agofix: don't clobber an error from the server with a server disconnection
Daniele Varrazzo [Wed, 8 Jan 2025 00:21:22 +0000 (01:21 +0100)] 
fix: don't clobber an error from the server with a server disconnection

The server error is assumed to contain more information, as it is
returned as a result, whereas a communication error caused by a server
disconnection will only make available the error message.

Close #988 (but we need to fix the Cython side too).

5 months agotest: add test to reproduce the wrong error on disconnect
Daniele Varrazzo [Wed, 8 Jan 2025 00:16:46 +0000 (01:16 +0100)] 
test: add test to reproduce the wrong error on disconnect

We raise `OperationalError` instead of `IdleInTransactionSessionTimeout`.

See #988.

5 months agofix(debug): print exceptions eventually raised by libpq calls
Daniele Varrazzo [Wed, 8 Jan 2025 00:23:41 +0000 (01:23 +0100)] 
fix(debug): print exceptions eventually raised by libpq calls

5 months agodocs: improve organization of adaptation objects docs
Daniele Varrazzo [Wed, 8 Jan 2025 12:08:51 +0000 (13:08 +0100)] 
docs: improve organization of adaptation objects docs

Move the life cycle section above the examples, closer to the
configuration top section; explain better how `format` affects the
loader used, highlight better the connection between the protocols
defined in the `abc` module and the abstract base classes in the `adapt`
module.

The meaning of `Loader.format` wasn't explained anywhere: see #990.

6 months agodocs: fix ']]' return value in Dumper.get_key() docs 979/head
stankudrow [Sat, 4 Jan 2025 06:58:30 +0000 (09:58 +0300)] 
docs: fix ']]' return value in Dumper.get_key() docs

Close #921.

6 months agoMerge pull request #982 from psycopg/cleanup-compat
Daniele Varrazzo [Sat, 4 Jan 2025 02:04:10 +0000 (03:04 +0100)] 
Merge pull request #982 from psycopg/cleanup-compat

Clean up compat modules after dropping Python 3.8

6 months agochore: fix problems reported by mypy 1.14.1 982/head
Daniele Varrazzo [Sat, 4 Jan 2025 01:11:16 +0000 (02:11 +0100)] 
chore: fix problems reported by mypy 1.14.1

6 months agochore(tests): drop Python 2 check
Daniele Varrazzo [Fri, 3 Jan 2025 20:24:35 +0000 (21:24 +0100)] 
chore(tests): drop Python 2 check

6 months agorefactor: remove unneeded objects from _compat modules
Daniele Varrazzo [Sat, 28 Dec 2024 01:47:34 +0000 (02:47 +0100)] 
refactor: remove unneeded objects from _compat modules

6 months agorefactor(tests): remove Counter from utils module
Daniele Varrazzo [Sat, 28 Dec 2024 00:57:02 +0000 (01:57 +0100)] 
refactor(tests): remove Counter from utils module

6 months agochore: drop pre-3.9 if blocks
Daniele Varrazzo [Fri, 27 Dec 2024 23:27:51 +0000 (00:27 +0100)] 
chore: drop pre-3.9 if blocks

6 months agorefactor: replace list comprehension with generators in multiple assignments 981/head
Daniele Varrazzo [Sat, 28 Dec 2024 00:28:30 +0000 (01:28 +0100)] 
refactor: replace list comprehension with generators in multiple assignments

6 months agorefactor: use pytest canonical assert method names
Daniele Varrazzo [Sat, 28 Dec 2024 00:19:16 +0000 (01:19 +0100)] 
refactor: use pytest canonical assert method names

6 months agorefactor: drop deprecated collection.abc aliases
Daniele Varrazzo [Fri, 27 Dec 2024 23:45:13 +0000 (00:45 +0100)] 
refactor: drop deprecated collection.abc aliases

6 months agorefactor: use re objects for typing of Match and Pattern
Daniele Varrazzo [Fri, 27 Dec 2024 23:32:55 +0000 (00:32 +0100)] 
refactor: use re objects for typing of Match and Pattern

6 months agodocs: suggest using pyupgrade when dropping a Python version
Daniele Varrazzo [Fri, 27 Dec 2024 23:20:05 +0000 (00:20 +0100)] 
docs: suggest using pyupgrade when dropping a Python version

6 months agorun through pyupgrade --py38-plus
stankudrow [Fri, 27 Dec 2024 05:23:40 +0000 (08:23 +0300)] 
run through pyupgrade --py38-plus

6 months agoMerge pull request #980 from psycopg/pre-commit
Daniele Varrazzo [Fri, 27 Dec 2024 23:18:15 +0000 (00:18 +0100)] 
Merge pull request #980 from psycopg/pre-commit

Add pre-commit hooks

6 months agodocs: document pre-commit usage 980/head
Daniele Varrazzo [Fri, 27 Dec 2024 02:34:00 +0000 (03:34 +0100)] 
docs: document pre-commit usage

6 months agolint: add typing annotations to pass pre-commit
Daniele Varrazzo [Fri, 27 Dec 2024 02:30:28 +0000 (03:30 +0100)] 
lint: add typing annotations to pass pre-commit

Pre-commit seems to run mypy in parallel batches, each with about 20
files. In this mode, certain tests that pass when running mypy all in
once or file-by-file, fail.

In the current state, both running mypy without arguments or running it
in pre-commit seem to work.

6 months agoci: configure lint step to run pre-commit
Daniele Varrazzo [Fri, 27 Dec 2024 01:55:16 +0000 (02:55 +0100)] 
ci: configure lint step to run pre-commit

6 months agoci: add pre-commit configuration
Daniele Varrazzo [Fri, 27 Dec 2024 01:48:20 +0000 (02:48 +0100)] 
ci: add pre-commit configuration

6 months agochore: ignore certain files from mypy linting
Daniele Varrazzo [Fri, 27 Dec 2024 01:44:43 +0000 (02:44 +0100)] 
chore: ignore certain files from mypy linting

Something weird happens. Certain files pass mypy lint on their own, but
not in combination. This is mostly related to `psycopg/pq/pq_ctypes.py`
and `psycopg/pq/_pq_ctypes.py`. This problem seems largely related to
incomplete ctypes definitions.

6 months agochore: drop annotation on empty lists, now unneeded
Daniele Varrazzo [Thu, 26 Dec 2024 18:46:32 +0000 (19:46 +0100)] 
chore: drop annotation on empty lists, now unneeded

If needed, it is considered wrong anyway, because it should be annotated
as class attribute.

6 months agodocs: restore some lost comments in pyproject.toml files
Daniele Varrazzo [Thu, 26 Dec 2024 16:58:16 +0000 (17:58 +0100)] 
docs: restore some lost comments in pyproject.toml files