Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7bd6c49
Add arm64 mac and linux wheels (#954)
ddelange Sep 27, 2022
5f908e6
Add Python 3.11 to the test matrix (#948)
elprans Sep 27, 2022
40b16ea
Exclude .venv from flake8 (#958)
jparise Oct 4, 2022
0e73fec
Upgrade to flake8 5.0.4 (from 3.9.2) (#961)
jparise Oct 11, 2022
84c99bf
Show an example of a custom Record class (#960)
jparise Oct 11, 2022
eccdf61
Use the exact type name in Record.__repr__ (#959)
jparise Oct 11, 2022
bb0cb39
Drop Python 3.6 support (#940)
bryanforbes Oct 26, 2022
eab7fdf
Test on Python 3.11 and PostgreSQL 15, fix workflow deprecations (#968)
elprans Oct 26, 2022
925cfe1
asyncpg v0.27.0
elprans Oct 26, 2022
95cf254
workflows/release: Don't ignore errors in individual wheel jobs
elprans Oct 26, 2022
a6e2f18
Post-release version bump
elprans Oct 26, 2022
8f6cc98
workflows: Use python-verion in setup-python actions explicitly
elprans Oct 26, 2022
43bd82c
Correct the development version
elprans Oct 26, 2022
d2e710f
Do not try to cleanup statements (#981)
fvannee Nov 28, 2022
9cb2c1c
Add Pool.is_closing() method (#973)
singingwolfboy Dec 3, 2022
7df9812
Fix test_tls_version for LibreSSL (#974)
CyberTailor Dec 3, 2022
bee17cb
Fixed tests so they pass on windows.
Dec 7, 2022
1c67511
push for workflows
Dec 8, 2022
fae9d9c
push for workflows
Dec 8, 2022
7a847ce
no image for python 3.6
Dec 8, 2022
a3d7342
merge ci changes from master
Dec 8, 2022
7d9234f
merge setup.py changes from master
Dec 11, 2022
a43b064
Add logging to server selection procedure
Dec 12, 2022
24ea4e5
formatting
Dec 12, 2022
3df816d
undo mistake
Dec 12, 2022
e24a091
fix test?
Dec 12, 2022
38984a6
disable tests for pg11 to see if all the rest of the test cases pass
Dec 12, 2022
86423c3
disable tests for pg11 to see if all the rest of the test cases pass
Dec 15, 2022
277ed96
add some more fixes that were already implemented
Dec 16, 2022
5737f76
Add support for read-write and read-only target_session_attribute opt…
Dec 16, 2022
c3133c0
fix little logical error
Dec 16, 2022
ae325ba
linter
Dec 16, 2022
980004c
Merge branch 'master' into target_session_attr
JesseDeLoore Dec 17, 2022
3bc8322
fix logic issue
Dec 18, 2022
4e97acc
Merge branch 'target_session_attr' of github.com:JesseDeLoore/asyncpg…
Dec 18, 2022
d824333
Update based on review.
Jan 29, 2023
08ad1f8
fix tests
Jan 29, 2023
7cdd2ba
See the results on pg11
Jan 29, 2023
19b7a17
...
Jan 30, 2023
247b1a5
Fix missing PyPI wheels (#993)
ddelange Feb 13, 2023
172b8f6
Handle environments without home dir (#1011)
LeonardBesson Mar 12, 2023
ea002ed
Apply fix
May 4, 2023
9f1d836
Merge branch 'master' into target_session_attr
JesseDeLoore May 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[flake8]
ignore = E402,E731,W503,W504,E252
exclude = .git,__pycache__,build,dist,.eggs,.github,.local
exclude = .git,__pycache__,build,dist,.eggs,.github,.local,.venv
9 changes: 7 additions & 2 deletions .github/workflows/install-postgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@ if [ "${ID}" = "debian" -o "${ID}" = "ubuntu" ]; then
apt-get install -y --no-install-recommends \
"postgresql-${PGVERSION}" \
"postgresql-contrib-${PGVERSION}"
elif [ "${ID}" = "almalinux" ]; then
yum install -y \
"postgresql-server" \
"postgresql-devel" \
"postgresql-contrib"
elif [ "${ID}" = "centos" ]; then
el="EL-${VERSION_ID}-$(arch)"
el="EL-${VERSION_ID%.*}-$(arch)"
baseurl="https://download.postgresql.org/pub/repos/yum/reporpms"
yum install -y "${baseurl}/${el}/pgdg-redhat-repo-latest.noarch.rpm"
if [ ${VERSION_ID} -ge 8 ]; then
if [ ${VERSION_ID%.*} -ge 8 ]; then
dnf -qy module disable postgresql
fi
yum install -y \
Expand Down
79 changes: 52 additions & 27 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
mkdir -p dist/
echo "${VERSION}" > dist/VERSION

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
Expand All @@ -50,37 +50,56 @@ jobs:
PIP_DISABLE_PIP_VERSION_CHECK: 1

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 50
submodules: true

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Build source distribution
run: |
pip install -U setuptools wheel pip
python setup.py sdist

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*.tar.*

build-wheels:
build-wheels-matrix:
needs: validate-release-request
runs-on: ubuntu-latest
outputs:
include: ${{ steps.set-matrix.outputs.include }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- run: pip install cibuildwheel==2.10.2
- id: set-matrix
run: |
MATRIX_INCLUDE=$(
{
cibuildwheel --print-build-identifiers --platform linux --arch x86_64,aarch64 | grep cp | jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \
&& cibuildwheel --print-build-identifiers --platform macos --arch x86_64,arm64 | grep cp | jq -nRc '{"only": inputs, "os": "macos-latest"}' \
&& cibuildwheel --print-build-identifiers --platform windows --arch x86,AMD64 | grep cp | jq -nRc '{"only": inputs, "os": "windows-latest"}'
} | jq -sc
)
echo "include=$MATRIX_INCLUDE" >> $GITHUB_OUTPUT

build-wheels:
needs: build-wheels-matrix
runs-on: ${{ matrix.os }}
name: Build ${{ matrix.only }}

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
cibw_python: ["cp36-*", "cp37-*", "cp38-*", "cp39-*", "cp310-*"]
cibw_arch: ["auto64", "auto32"]
exclude:
- os: macos-latest
cibw_arch: "auto32"
- os: ubuntu-latest
cibw_arch: "auto32"
include: ${{ fromJson(needs.build-wheels-matrix.outputs.include) }}

defaults:
run:
Expand All @@ -90,48 +109,54 @@ jobs:
PIP_DISABLE_PIP_VERSION_CHECK: 1

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 50
submodules: true

- uses: pypa/cibuildwheel@v2.8.0
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2

- uses: pypa/cibuildwheel@v2.10.2
with:
only: ${{ matrix.only }}
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: ${{ matrix.cibw_python }}
CIBW_ARCHS: ${{ matrix.cibw_arch }}
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: dist
path: wheelhouse/*.whl

publish-docs:
needs: validate-release-request
needs: [build-sdist, build-wheels]
runs-on: ubuntu-latest

env:
PIP_DISABLE_PIP_VERSION_CHECK: 1

steps:
- name: Checkout source
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 5
submodules: true

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: "3.x"

- name: Build docs
run: |
pip install -e .[dev]
make htmldocs

- name: Checkout gh-pages
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 5
ref: gh-pages
Expand All @@ -157,12 +182,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 5
submodules: false

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: dist
path: dist/
Expand All @@ -171,7 +196,7 @@ jobs:
id: relver
run: |
set -e
echo ::set-output name=version::$(cat dist/VERSION)
echo "version=$(cat dist/VERSION)" >> $GITHUB_OUTPUT
rm dist/VERSION

- name: Merge and tag the PR
Expand All @@ -197,7 +222,7 @@ jobs:
ls -al dist/

- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ jobs:
# job.
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
os: [ubuntu-latest, macos-latest, windows-latest]
loop: [asyncio, uvloop]
exclude:
# uvloop does not support Python 3.6
- loop: uvloop
python-version: "3.6"
# uvloop does not support windows
- loop: uvloop
os: windows-latest
Expand All @@ -38,7 +35,7 @@ jobs:
PIP_DISABLE_PIP_VERSION_CHECK: 1

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 50
submodules: true
Expand All @@ -54,7 +51,7 @@ jobs:
__version__\s*=\s*(?:['"])([[:PEP440:]])(?:['"])

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
if: steps.release.outputs.version == 0
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -79,15 +76,15 @@ jobs:
test-postgres:
strategy:
matrix:
postgres-version: ["9.5", "9.6", "10", "11", "12", "13", "14"]
postgres-version: ["9.5", "9.6", "10", "11", "12", "13", "14", "15"]

runs-on: ubuntu-latest

env:
PIP_DISABLE_PIP_VERSION_CHECK: 1

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 50
submodules: true
Expand All @@ -114,8 +111,10 @@ jobs:
>> "${GITHUB_ENV}"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
if: steps.release.outputs.version == 0
with:
python-version: "3.x"

- name: Install Python Deps
if: steps.release.outputs.version == 0
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ of PostgreSQL server binary protocol for use with Python's ``asyncio``
framework. You can read more about asyncpg in an introductory
`blog post <http://magic.io/blog/asyncpg-1m-rows-from-postgres-to-python/>`_.

asyncpg requires Python 3.6 or later and is supported for PostgreSQL
versions 9.5 to 14. Older PostgreSQL versions or other databases implementing
asyncpg requires Python 3.7 or later and is supported for PostgreSQL
versions 9.5 to 15. Older PostgreSQL versions or other databases implementing
the PostgreSQL protocol *may* work, but are not being actively tested.


Expand Down
1 change: 1 addition & 0 deletions asyncpg/_testbase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ def tearDown(self):


class HotStandbyTestCase(ClusterTestCase):

@classmethod
def setup_cluster(cls):
cls.master_cluster = cls.new_cluster(pg_cluster.TempCluster)
Expand Down
2 changes: 1 addition & 1 deletion asyncpg/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
# supported platforms, publish the packages on PyPI, merge the PR
# to the target branch, create a Git tag pointing to the commit.

__version__ = '0.26.0'
__version__ = '0.28.0.dev0'
2 changes: 1 addition & 1 deletion asyncpg/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ def init(self, **settings):
'pg_basebackup init exited with status {:d}:\n{}'.format(
process.returncode, output.decode()))

if self._pg_version <= (11, 0):
if self._pg_version < (12, 0):
with open(os.path.join(self._data_dir, 'recovery.conf'), 'w') as f:
f.write(textwrap.dedent("""\
standby_mode = 'on'
Expand Down
20 changes: 7 additions & 13 deletions asyncpg/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
import asyncio
import pathlib
import platform
import sys
import typing


PY_37 = sys.version_info >= (3, 7)
SYSTEM = platform.uname().system


Expand All @@ -20,7 +19,7 @@

CSIDL_APPDATA = 0x001a

def get_pg_home_directory() -> pathlib.Path:
def get_pg_home_directory() -> typing.Optional[pathlib.Path]:
# We cannot simply use expanduser() as that returns the user's
# home directory, whereas Postgres stores its config in
# %AppData% on Windows.
Expand All @@ -32,16 +31,11 @@ def get_pg_home_directory() -> pathlib.Path:
return pathlib.Path(buf.value) / 'postgresql'

else:
def get_pg_home_directory() -> pathlib.Path:
return pathlib.Path.home()


if PY_37:
def current_asyncio_task(loop):
return asyncio.current_task(loop)
else:
def current_asyncio_task(loop):
return asyncio.Task.current_task(loop)
def get_pg_home_directory() -> typing.Optional[pathlib.Path]:
try:
return pathlib.Path.home()
except (RuntimeError, KeyError):
return None


async def wait_closed(stream):
Expand Down
Loading