Skip to content

Commit ab61adf

Browse files
authored
Merge branch 'master' into query-logging
2 parents f64a8ea + 9a12d14 commit ab61adf

File tree

11 files changed

+134
-125
lines changed

11 files changed

+134
-125
lines changed

.coveragerc

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
- uses: actions/setup-python@v4
8181
with:
8282
python-version: "3.x"
83-
- run: pip install cibuildwheel==2.10.2
83+
- run: pip install cibuildwheel==2.13.1
8484
- id: set-matrix
8585
run: |
8686
MATRIX_INCLUDE=$(
@@ -118,13 +118,11 @@ jobs:
118118
if: runner.os == 'Linux'
119119
uses: docker/setup-qemu-action@v2
120120

121-
- uses: pypa/cibuildwheel@v2.10.2
121+
- uses: pypa/cibuildwheel@v2.13.1
122122
with:
123123
only: ${{ matrix.only }}
124124
env:
125125
CIBW_BUILD_VERBOSITY: 1
126-
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
127-
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
128126

129127
- uses: actions/upload-artifact@v3
130128
with:
@@ -152,7 +150,7 @@ jobs:
152150

153151
- name: Build docs
154152
run: |
155-
pip install -e .[dev]
153+
pip install -e .[docs]
156154
make htmldocs
157155
158156
- name: Checkout gh-pages

Makefile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,26 @@ clean:
2020

2121

2222
compile:
23-
$(PYTHON) setup.py build_ext --inplace --cython-always
23+
env ASYNCPG_BUILD_CYTHON_ALWAYS=1 $(PYTHON) -m pip install -e .
2424

2525

2626
debug:
27-
ASYNCPG_DEBUG=1 $(PYTHON) setup.py build_ext --inplace
28-
27+
env ASYNCPG_DEBUG=1 $(PYTHON) -m pip install -e .
2928

3029
test:
31-
PYTHONASYNCIODEBUG=1 $(PYTHON) setup.py test
32-
$(PYTHON) setup.py test
33-
USE_UVLOOP=1 $(PYTHON) setup.py test
30+
PYTHONASYNCIODEBUG=1 $(PYTHON) -m unittest -v tests.suite
31+
$(PYTHON) -m unittest -v tests.suite
32+
USE_UVLOOP=1 $(PYTHON) -m unittest -v tests.suite
3433

3534

3635
testinstalled:
3736
cd "$${HOME}" && $(PYTHON) $(ROOT)/tests/__init__.py
3837

3938

4039
quicktest:
41-
$(PYTHON) setup.py test
40+
$(PYTHON) -m unittest -v tests.suite
4241

4342

4443
htmldocs:
45-
$(PYTHON) setup.py build_ext --inplace
44+
$(PYTHON) -m pip install -e .[docs]
4645
$(MAKE) -C docs html

asyncpg/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
# supported platforms, publish the packages on PyPI, merge the PR
1111
# to the target branch, create a Git tag pointing to the commit.
1212

13-
__version__ = '0.28.0.dev0'
13+
__version__ = '0.28.0'

asyncpg/connect_utils.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -611,21 +611,19 @@ def _parse_connect_dsn_and_args(*, dsn, host, port, user,
611611
'a Dict[str, str]')
612612

613613
if target_session_attrs is None:
614-
615614
target_session_attrs = os.getenv(
616615
"PGTARGETSESSIONATTRS", SessionAttribute.any
617616
)
618617
try:
619-
620618
target_session_attrs = SessionAttribute(target_session_attrs)
621-
except ValueError as exc:
619+
except ValueError:
622620
raise exceptions.InterfaceError(
623621
"target_session_attrs is expected to be one of "
624622
"{!r}"
625623
", got {!r}".format(
626624
SessionAttribute.__members__.values, target_session_attrs
627625
)
628-
) from exc
626+
) from None
629627

630628
params = _ConnectionParameters(
631629
user=user, password=password, database=database, ssl=ssl,
@@ -1003,7 +1001,7 @@ async def _connect(*, loop, timeout, connection_class, record_class, **kwargs):
10031001
chosen_connection = random.choice(candidates)
10041002

10051003
await asyncio.gather(
1006-
(c.close() for c in candidates if c is not chosen_connection),
1004+
*(c.close() for c in candidates if c is not chosen_connection),
10071005
return_exceptions=True
10081006
)
10091007

asyncpg/connection.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,18 +2054,19 @@ async def connect(dsn=None, *,
20542054
:param SessionAttribute target_session_attrs:
20552055
If specified, check that the host has the correct attribute.
20562056
Can be one of:
2057-
"any": the first successfully connected host
2058-
"primary": the host must NOT be in hot standby mode
2059-
"standby": the host must be in hot standby mode
2060-
"read-write": the host must allow writes
2061-
"read-only": the host most NOT allow writes
2062-
"prefer-standby": first try to find a standby host, but if
2063-
none of the listed hosts is a standby server,
2064-
return any of them.
2065-
2066-
If not specified will try to use PGTARGETSESSIONATTRS
2067-
from the environment.
2068-
Defaults to "any" if no value is set.
2057+
2058+
- ``"any"`` - the first successfully connected host
2059+
- ``"primary"`` - the host must NOT be in hot standby mode
2060+
- ``"standby"`` - the host must be in hot standby mode
2061+
- ``"read-write"`` - the host must allow writes
2062+
- ``"read-only"`` - the host most NOT allow writes
2063+
- ``"prefer-standby"`` - first try to find a standby host, but if
2064+
none of the listed hosts is a standby server,
2065+
return any of them.
2066+
2067+
If not specified, the value parsed from the *dsn* argument is used,
2068+
or the value of the ``PGTARGETSESSIONATTRS`` environment variable,
2069+
or ``"any"`` if neither is specified.
20692070
20702071
:return: A :class:`~asyncpg.connection.Connection` instance.
20712072
@@ -2132,6 +2133,9 @@ async def connect(dsn=None, *,
21322133
.. versionchanged:: 0.26.0
21332134
Added the *direct_tls* parameter.
21342135
2136+
.. versionchanged:: 0.28.0
2137+
Added the *target_session_attrs* parameter.
2138+
21352139
.. _SSLContext: https://docs.python.org/3/library/ssl.html#ssl.SSLContext
21362140
.. _create_default_context:
21372141
https://docs.python.org/3/library/ssl.html#ssl.create_default_context

docs/conf.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python3
22

3-
import alabaster
43
import os
54
import sys
65

@@ -39,7 +38,7 @@
3938
copyright = '2016-present, the asyncpg authors and contributors'
4039
author = '<See AUTHORS file>'
4140
release = version
42-
language = None
41+
language = "en"
4342
exclude_patterns = ['_build']
4443
pygments_style = 'sphinx'
4544
todo_include_todos = False
@@ -48,12 +47,6 @@
4847
# -- Options for HTML output ----------------------------------------------
4948

5049
html_theme = 'sphinx_rtd_theme'
51-
# html_theme_options = {
52-
# 'description': 'asyncpg is a fast PostgreSQL client library for the '
53-
# 'Python asyncio framework',
54-
# 'show_powered_by': False,
55-
# }
56-
html_theme_path = [alabaster.get_path()]
5750
html_title = 'asyncpg Documentation'
5851
html_short_title = 'asyncpg'
5952
html_static_path = ['_static']
@@ -66,11 +59,6 @@
6659
html_show_sourcelink = False
6760
html_show_sphinx = False
6861
html_show_copyright = True
69-
html_context = {
70-
'css_files': [
71-
'_static/theme_overrides.css',
72-
],
73-
}
7462
htmlhelp_basename = 'asyncpgdoc'
7563

7664

docs/index.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
.. image:: https://travis-ci.org/MagicStack/asyncpg.svg?branch=master
2-
:target: https://travis-ci.org/MagicStack/asyncpg
1+
.. image:: https://github.com/MagicStack/asyncpg/workflows/Tests/badge.svg
2+
:target: https://github.com/MagicStack/asyncpg/actions?query=workflow%3ATests+branch%3Amaster
3+
:alt: GitHub Actions status
34

45
.. image:: https://img.shields.io/pypi/status/asyncpg.svg?maxAge=2592000?style=plastic
56
:target: https://pypi.python.org/pypi/asyncpg

pyproject.toml

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,68 @@
1+
[project]
2+
name = "asyncpg"
3+
description = "An asyncio PostgreSQL driver"
4+
authors = [{name = "MagicStack Inc", email = "hello@magic.io"}]
5+
requires-python = '>=3.7.0'
6+
readme = "README.rst"
7+
license = {text = "Apache License, Version 2.0"}
8+
dynamic = ["version"]
9+
keywords = [
10+
"database",
11+
"postgres",
12+
]
13+
classifiers = [
14+
"Development Status :: 5 - Production/Stable",
15+
"Framework :: AsyncIO",
16+
"Intended Audience :: Developers",
17+
"License :: OSI Approved :: Apache Software License",
18+
"Operating System :: POSIX",
19+
"Operating System :: MacOS :: MacOS X",
20+
"Operating System :: Microsoft :: Windows",
21+
"Programming Language :: Python :: 3 :: Only",
22+
"Programming Language :: Python :: 3.7",
23+
"Programming Language :: Python :: 3.8",
24+
"Programming Language :: Python :: 3.9",
25+
"Programming Language :: Python :: 3.10",
26+
"Programming Language :: Python :: 3.11",
27+
"Programming Language :: Python :: Implementation :: CPython",
28+
"Topic :: Database :: Front-Ends",
29+
]
30+
dependencies = [
31+
'typing-extensions>=3.7.4.3;python_version<"3.8"',
32+
]
33+
34+
[project.urls]
35+
github = "https://github.com/MagicStack/asyncpg"
36+
37+
[project.optional-dependencies]
38+
test = [
39+
'flake8~=5.0',
40+
'uvloop>=0.15.3; platform_system != "Windows"',
41+
]
42+
docs = [
43+
'Sphinx~=5.3.0',
44+
'sphinxcontrib-asyncio~=0.3.0',
45+
'sphinx_rtd_theme>=1.2.2',
46+
]
47+
148
[build-system]
2-
requires = ["setuptools>=42", "wheel"]
49+
requires = [
50+
"setuptools>=60",
51+
"wheel",
52+
53+
"Cython(>=0.29.24,<0.30.0)"
54+
]
355
build-backend = "setuptools.build_meta"
456

57+
[tool.setuptools]
58+
zip-safe = false
59+
60+
[tool.setuptools.packages.find]
61+
include = ["asyncpg", "asyncpg.*"]
62+
63+
[tool.setuptools.exclude-package-data]
64+
"*" = ["*.c", "*.h"]
65+
566
[tool.cibuildwheel]
667
build-frontend = "build"
768
test-extras = "test"
@@ -19,3 +80,25 @@ test-command = """\
1980
&& chmod -R go+rX "$(dirname $(dirname $(dirname $PY)))" \
2081
&& su -l apgtest -c "$PY {project}/tests/__init__.py" \
2182
"""
83+
84+
[tool.pytest.ini_options]
85+
addopts = "--capture=no --assert=plain --strict-markers --tb=native --import-mode=importlib"
86+
testpaths = "tests"
87+
filterwarnings = "default"
88+
89+
[tool.coverage.run]
90+
branch = true
91+
plugins = ["Cython.Coverage"]
92+
parallel = true
93+
source = ["asyncpg/", "tests/"]
94+
omit = ["*.pxd"]
95+
96+
[tool.coverage.report]
97+
exclude_lines = [
98+
"pragma: no cover",
99+
"def __repr__",
100+
"if debug",
101+
"raise NotImplementedError",
102+
"if __name__ == .__main__.",
103+
]
104+
show_missing = true

pytest.ini

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)