Skip to content

Commit ec84aa2

Browse files
author
andrei.khalyaukin
committed
Merge branch 'refs/heads/master' into non-blocking-conns-v3
2 parents 76f76af + 137359a commit ec84aa2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1032
-411
lines changed

.github/workflows/install-krb5.sh

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,42 @@
11
#!/bin/bash
22

33
set -Eexuo pipefail
4+
shopt -s nullglob
45

5-
if [ "$RUNNER_OS" == "Linux" ]; then
6-
# Assume Ubuntu since this is the only Linux used in CI.
7-
sudo apt-get update
8-
sudo apt-get install -y --no-install-recommends \
9-
libkrb5-dev krb5-user krb5-kdc krb5-admin-server
6+
if [[ $OSTYPE == linux* ]]; then
7+
if [ "$(id -u)" = "0" ]; then
8+
SUDO=
9+
else
10+
SUDO=sudo
11+
fi
12+
13+
if [ -e /etc/os-release ]; then
14+
source /etc/os-release
15+
elif [ -e /etc/centos-release ]; then
16+
ID="centos"
17+
VERSION_ID=$(cat /etc/centos-release | cut -f3 -d' ' | cut -f1 -d.)
18+
else
19+
echo "install-krb5.sh: cannot determine which Linux distro this is" >&2
20+
exit 1
21+
fi
22+
23+
if [ "${ID}" = "debian" -o "${ID}" = "ubuntu" ]; then
24+
export DEBIAN_FRONTEND=noninteractive
25+
26+
$SUDO apt-get update
27+
$SUDO apt-get install -y --no-install-recommends \
28+
libkrb5-dev krb5-user krb5-kdc krb5-admin-server
29+
elif [ "${ID}" = "almalinux" ]; then
30+
$SUDO dnf install -y krb5-server krb5-workstation krb5-libs krb5-devel
31+
elif [ "${ID}" = "centos" ]; then
32+
$SUDO yum install -y krb5-server krb5-workstation krb5-libs krb5-devel
33+
elif [ "${ID}" = "alpine" ]; then
34+
$SUDO apk add krb5 krb5-server krb5-dev
35+
else
36+
echo "install-krb5.sh: Unsupported linux distro: ${distro}" >&2
37+
exit 1
38+
fi
39+
else
40+
echo "install-krb5.sh: unsupported OS: ${OSTYPE}" >&2
41+
exit 1
1042
fi

.github/workflows/install-postgres.sh

Lines changed: 51 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,60 @@
33
set -Eexuo pipefail
44
shopt -s nullglob
55

6-
PGVERSION=${PGVERSION:-12}
6+
if [[ $OSTYPE == linux* ]]; then
7+
PGVERSION=${PGVERSION:-12}
78

8-
if [ -e /etc/os-release ]; then
9-
source /etc/os-release
10-
elif [ -e /etc/centos-release ]; then
11-
ID="centos"
12-
VERSION_ID=$(cat /etc/centos-release | cut -f3 -d' ' | cut -f1 -d.)
13-
else
14-
echo "install-postgres.sh: cannot determine which Linux distro this is" >&2
15-
exit 1
16-
fi
9+
if [ -e /etc/os-release ]; then
10+
source /etc/os-release
11+
elif [ -e /etc/centos-release ]; then
12+
ID="centos"
13+
VERSION_ID=$(cat /etc/centos-release | cut -f3 -d' ' | cut -f1 -d.)
14+
else
15+
echo "install-postgres.sh: cannot determine which Linux distro this is" >&2
16+
exit 1
17+
fi
18+
19+
if [ "${ID}" = "debian" -o "${ID}" = "ubuntu" ]; then
20+
export DEBIAN_FRONTEND=noninteractive
1721

18-
if [ "${ID}" = "debian" -o "${ID}" = "ubuntu" ]; then
19-
export DEBIAN_FRONTEND=noninteractive
20-
21-
apt-get install -y --no-install-recommends curl gnupg ca-certificates
22-
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
23-
mkdir -p /etc/apt/sources.list.d/
24-
echo "deb https://apt.postgresql.org/pub/repos/apt/ ${VERSION_CODENAME}-pgdg main" \
25-
>> /etc/apt/sources.list.d/pgdg.list
26-
apt-get update
27-
apt-get install -y --no-install-recommends \
28-
"postgresql-${PGVERSION}" \
29-
"postgresql-contrib-${PGVERSION}"
30-
elif [ "${ID}" = "almalinux" ]; then
31-
yum install -y \
32-
"postgresql-server" \
33-
"postgresql-devel" \
34-
"postgresql-contrib"
35-
elif [ "${ID}" = "centos" ]; then
36-
el="EL-${VERSION_ID%.*}-$(arch)"
37-
baseurl="https://download.postgresql.org/pub/repos/yum/reporpms"
38-
yum install -y "${baseurl}/${el}/pgdg-redhat-repo-latest.noarch.rpm"
39-
if [ ${VERSION_ID%.*} -ge 8 ]; then
40-
dnf -qy module disable postgresql
22+
apt-get install -y --no-install-recommends curl gnupg ca-certificates
23+
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
24+
mkdir -p /etc/apt/sources.list.d/
25+
echo "deb https://apt.postgresql.org/pub/repos/apt/ ${VERSION_CODENAME}-pgdg main" \
26+
>> /etc/apt/sources.list.d/pgdg.list
27+
apt-get update
28+
apt-get install -y --no-install-recommends \
29+
"postgresql-${PGVERSION}" \
30+
"postgresql-contrib-${PGVERSION}"
31+
elif [ "${ID}" = "almalinux" ]; then
32+
yum install -y \
33+
"postgresql-server" \
34+
"postgresql-devel" \
35+
"postgresql-contrib"
36+
elif [ "${ID}" = "centos" ]; then
37+
el="EL-${VERSION_ID%.*}-$(arch)"
38+
baseurl="https://download.postgresql.org/pub/repos/yum/reporpms"
39+
yum install -y "${baseurl}/${el}/pgdg-redhat-repo-latest.noarch.rpm"
40+
if [ ${VERSION_ID%.*} -ge 8 ]; then
41+
dnf -qy module disable postgresql
42+
fi
43+
yum install -y \
44+
"postgresql${PGVERSION}-server" \
45+
"postgresql${PGVERSION}-contrib"
46+
ln -s "/usr/pgsql-${PGVERSION}/bin/pg_config" "/usr/local/bin/pg_config"
47+
elif [ "${ID}" = "alpine" ]; then
48+
apk add shadow postgresql postgresql-dev postgresql-contrib
49+
else
50+
echo "install-postgres.sh: unsupported Linux distro: ${distro}" >&2
51+
exit 1
4152
fi
42-
yum install -y \
43-
"postgresql${PGVERSION}-server" \
44-
"postgresql${PGVERSION}-contrib"
45-
ln -s "/usr/pgsql-${PGVERSION}/bin/pg_config" "/usr/local/bin/pg_config"
46-
elif [ "${ID}" = "alpine" ]; then
47-
apk add shadow postgresql postgresql-dev postgresql-contrib
53+
54+
useradd -m -s /bin/bash apgtest
55+
56+
elif [[ $OSTYPE == darwin* ]]; then
57+
brew install postgresql
58+
4859
else
49-
echo "install-postgres.sh: Unsupported distro: ${distro}" >&2
60+
echo "install-postgres.sh: unsupported OS: ${OSTYPE}" >&2
5061
exit 1
5162
fi
52-
53-
useradd -m -s /bin/bash apgtest

.github/workflows/release.yml

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ jobs:
3737
mkdir -p dist/
3838
echo "${VERSION}" > dist/VERSION
3939
40-
- uses: actions/upload-artifact@v3
40+
- uses: actions/upload-artifact@v4
4141
with:
42-
name: dist
43-
path: dist/
42+
name: dist-version
43+
path: dist/VERSION
4444

4545
build-sdist:
4646
needs: validate-release-request
@@ -56,7 +56,7 @@ jobs:
5656
submodules: true
5757

5858
- name: Set up Python
59-
uses: actions/setup-python@v4
59+
uses: actions/setup-python@v5
6060
with:
6161
python-version: "3.x"
6262

@@ -65,9 +65,9 @@ jobs:
6565
pip install -U setuptools wheel pip
6666
python setup.py sdist
6767
68-
- uses: actions/upload-artifact@v3
68+
- uses: actions/upload-artifact@v4
6969
with:
70-
name: dist
70+
name: dist-sdist
7171
path: dist/*.tar.*
7272

7373
build-wheels-matrix:
@@ -77,10 +77,10 @@ jobs:
7777
include: ${{ steps.set-matrix.outputs.include }}
7878
steps:
7979
- uses: actions/checkout@v4
80-
- uses: actions/setup-python@v4
80+
- uses: actions/setup-python@v5
8181
with:
8282
python-version: "3.x"
83-
- run: pip install cibuildwheel==2.16.2
83+
- run: pip install cibuildwheel==2.21.3
8484
- id: set-matrix
8585
run: |
8686
MATRIX_INCLUDE=$(
@@ -119,17 +119,27 @@ jobs:
119119
if: runner.os == 'Linux'
120120
uses: docker/setup-qemu-action@v2
121121

122-
- uses: pypa/cibuildwheel@fff9ec32ed25a9c576750c91e06b410ed0c15db7 # v2.16.2
122+
- uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3
123123
with:
124124
only: ${{ matrix.only }}
125125
env:
126126
CIBW_BUILD_VERBOSITY: 1
127127

128-
- uses: actions/upload-artifact@v3
128+
- uses: actions/upload-artifact@v4
129129
with:
130-
name: dist
130+
name: dist-wheels-${{ matrix.only }}
131131
path: wheelhouse/*.whl
132132

133+
merge-artifacts:
134+
runs-on: ubuntu-latest
135+
needs: [build-sdist, build-wheels]
136+
steps:
137+
- name: Merge Artifacts
138+
uses: actions/upload-artifact/merge@v4
139+
with:
140+
name: dist
141+
delete-merged: true
142+
133143
publish-docs:
134144
needs: [build-sdist, build-wheels]
135145
runs-on: ubuntu-latest
@@ -145,7 +155,7 @@ jobs:
145155
submodules: true
146156

147157
- name: Set up Python
148-
uses: actions/setup-python@v4
158+
uses: actions/setup-python@v5
149159
with:
150160
python-version: "3.x"
151161

@@ -180,13 +190,22 @@ jobs:
180190
needs: [build-sdist, build-wheels, publish-docs]
181191
runs-on: ubuntu-latest
182192

193+
environment:
194+
name: pypi
195+
url: https://pypi.org/p/asyncpg
196+
permissions:
197+
id-token: write
198+
attestations: write
199+
contents: write
200+
deployments: write
201+
183202
steps:
184203
- uses: actions/checkout@v4
185204
with:
186205
fetch-depth: 5
187206
submodules: false
188207

189-
- uses: actions/download-artifact@v3
208+
- uses: actions/download-artifact@v4
190209
with:
191210
name: dist
192211
path: dist/
@@ -223,7 +242,4 @@ jobs:
223242
- name: Upload to PyPI
224243
uses: pypa/gh-action-pypi-publish@release/v1
225244
with:
226-
user: __token__
227-
password: ${{ secrets.PYPI_TOKEN }}
228-
# password: ${{ secrets.TEST_PYPI_TOKEN }}
229-
# repository_url: https://test.pypi.org/legacy/
245+
attestations: true

.github/workflows/tests.yml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,13 @@ jobs:
1717
# job.
1818
strategy:
1919
matrix:
20-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
20+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
2121
os: [ubuntu-latest, macos-latest, windows-latest]
2222
loop: [asyncio, uvloop]
2323
exclude:
2424
# uvloop does not support windows
2525
- loop: uvloop
2626
os: windows-latest
27-
# No 3.12 release yet
28-
- loop: uvloop
29-
python-version: "3.12"
3027

3128
runs-on: ${{ matrix.os }}
3229

@@ -51,23 +48,28 @@ jobs:
5148
missing_version_ok: yes
5249
version_file: asyncpg/_version.py
5350
version_line_pattern: |
54-
__version__\s*=\s*(?:['"])([[:PEP440:]])(?:['"])
51+
__version__(?:\s*:\s*typing\.Final)?\s*=\s*(?:['"])([[:PEP440:]])(?:['"])
52+
53+
- name: Setup PostgreSQL
54+
if: "!steps.release.outputs.is_release && matrix.os == 'macos-latest'"
55+
run: |
56+
brew install postgresql
5557
5658
- name: Set up Python ${{ matrix.python-version }}
57-
uses: actions/setup-python@v4
58-
if: steps.release.outputs.version == 0
59+
uses: actions/setup-python@v5
60+
if: "!steps.release.outputs.is_release"
5961
with:
6062
python-version: ${{ matrix.python-version }}
6163

6264
- name: Install Python Deps
63-
if: steps.release.outputs.version == 0
65+
if: "!steps.release.outputs.is_release"
6466
run: |
65-
.github/workflows/install-krb5.sh
67+
[ "$RUNNER_OS" = "Linux" ] && .github/workflows/install-krb5.sh
6668
python -m pip install -U pip setuptools wheel
6769
python -m pip install -e .[test]
6870
6971
- name: Test
70-
if: steps.release.outputs.version == 0
72+
if: "!steps.release.outputs.is_release"
7173
env:
7274
LOOP_IMPL: ${{ matrix.loop }}
7375
run: |
@@ -80,7 +82,7 @@ jobs:
8082
test-postgres:
8183
strategy:
8284
matrix:
83-
postgres-version: ["9.5", "9.6", "10", "11", "12", "13", "14", "15", "16"]
85+
postgres-version: ["9.5", "9.6", "10", "11", "12", "13", "14", "15", "16", "17"]
8486

8587
runs-on: ubuntu-latest
8688

@@ -101,10 +103,10 @@ jobs:
101103
missing_version_ok: yes
102104
version_file: asyncpg/_version.py
103105
version_line_pattern: |
104-
__version__\s*=\s*(?:['"])([[:PEP440:]])(?:['"])
106+
__version__(?:\s*:\s*typing\.Final)?\s*=\s*(?:['"])([[:PEP440:]])(?:['"])
105107
106108
- name: Set up PostgreSQL
107-
if: steps.release.outputs.version == 0
109+
if: "!steps.release.outputs.is_release"
108110
env:
109111
PGVERSION: ${{ matrix.postgres-version }}
110112
DISTRO_NAME: focal
@@ -115,20 +117,20 @@ jobs:
115117
>> "${GITHUB_ENV}"
116118
117119
- name: Set up Python ${{ matrix.python-version }}
118-
uses: actions/setup-python@v4
119-
if: steps.release.outputs.version == 0
120+
uses: actions/setup-python@v5
121+
if: "!steps.release.outputs.is_release"
120122
with:
121123
python-version: "3.x"
122124

123125
- name: Install Python Deps
124-
if: steps.release.outputs.version == 0
126+
if: "!steps.release.outputs.is_release"
125127
run: |
126-
.github/workflows/install-krb5.sh
128+
[ "$RUNNER_OS" = "Linux" ] && .github/workflows/install-krb5.sh
127129
python -m pip install -U pip setuptools wheel
128130
python -m pip install -e .[test]
129131
130132
- name: Test
131-
if: steps.release.outputs.version == 0
133+
if: "!steps.release.outputs.is_release"
132134
env:
133135
PGVERSION: ${{ matrix.postgres-version }}
134136
run: |

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ framework. You can read more about asyncpg in an introductory
1414
`blog post <http://magic.io/blog/asyncpg-1m-rows-from-postgres-to-python/>`_.
1515

1616
asyncpg requires Python 3.8 or later and is supported for PostgreSQL
17-
versions 9.5 to 16. Older PostgreSQL versions or other databases implementing
18-
the PostgreSQL protocol *may* work, but are not being actively tested.
17+
versions 9.5 to 17. Other PostgreSQL versions or other databases
18+
implementing the PostgreSQL protocol *may* work, but are not being
19+
actively tested.
1920

2021

2122
Documentation
@@ -88,8 +89,7 @@ Basic Usage
8889
)
8990
await conn.close()
9091
91-
loop = asyncio.get_event_loop()
92-
loop.run_until_complete(run())
92+
asyncio.run(run())
9393
9494
9595
License

0 commit comments

Comments
 (0)