Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 3.13 support #371

Merged
merged 14 commits into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
70 changes: 36 additions & 34 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12', pypy-3.10]
python-version: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12', '3.13', pypy-3.10]
impl: [cpython, cffi]
purity: [pure, with-pylmdb-mods]

Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
pytest

- name: Save wheel
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.impl }}-${{ matrix.purity }}.whl"
path: dist/lmdb-*.whl
Expand All @@ -112,7 +112,7 @@ jobs:
if: >-
matrix.python-version == '3.10' && runner.os == 'Linux' &&
matrix.purity == 'with-pylmdb-mods' && matrix.impl == 'cpython'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
path: vers.txt
name: vers.txt
Expand All @@ -124,7 +124,7 @@ jobs:
matrix.python-version == '3.10' && runner.os == 'Linux' &&
matrix.purity == 'with-pylmdb-mods' && matrix.impl == 'cpython'

uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
path: dist/lmdb*.tar.gz
name: source
Expand All @@ -136,7 +136,7 @@ jobs:
uses: RalfG/python-wheels-manylinux-build@v0.7.1
with:
python-versions: >-
cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312
cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313
build-requirements: 'patch-ng'

- name: What do we have
Expand All @@ -148,7 +148,7 @@ jobs:
if: >-
matrix.python-version == '3.10' && runner.os == 'Linux' &&
matrix.purity == 'with-pylmdb-mods' && matrix.impl == 'cpython'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
path: dist/lmdb*manylinux*.whl
name: manylinux
Expand All @@ -160,7 +160,7 @@ jobs:
matrix:
impl: [cpython, cffi]
purity: [pure, with-pylmdb-mods]
PYTHON: ["cp37-cp37m" , "cp38-cp38" , "cp39-cp39", "cp310-cp310", "cp311-cp311", 'cp312-cp312']
PYTHON: ["cp37-cp37m" , "cp38-cp38" , "cp39-cp39", "cp310-cp310", "cp311-cp311", 'cp312-cp312', 'cp313-cp313']
steps:
- uses: actions/checkout@v2
- run: |
Expand Down Expand Up @@ -190,60 +190,54 @@ jobs:
echo \"Windows: Envs are cpython=$Env:LMDB_FORCE_CPYTHON
cffi=$Env:LMDB_FORCE_CFFI pure=$Env:LMDB_PURE system=$Env:LMDB_FORCE_SYSTEM\";
.venv/bin/pip install setuptools flake8 pytest patch-ng;
/opt/python/${{ matrix.PYTHON }}/bin/python -m pip install setuptools;
/opt/python/${{ matrix.PYTHON }}/bin/python setup.py develop bdist_wheel;
ls dist;
/opt/python/${{ matrix.PYTHON }}/bin/python -m pip install pytest;
if \[ ${{ matrix.PYTHON }} != cp36-cp36 \] && \[ ${{ matrix.PYTHON }} != cp38-cp38 \] ; then
echo \"Envs are cpython=$LMDB_FORCE_CPYTHON cffi=$LMDB_FORCE_CFFI pure=$LMDB_PURE system=$LMDB_FORCE_SYSTEM\";
echo \"Envs are cpython=$LMDB_FORCE_CPYTHON cffi=$LMDB_FORCE_CFFI pure=$LMDB_PURE system=$LMDB_FORCE_SYSTEM\";
if \[ ${{ matrix.PYTHON }} != cp36-cp36 \] && \[ ${{ matrix.PYTHON }} != cp38-cp38 \] && \[ ${{ matrix.PYTHON }} != cp311-cp311 \] ; then
/opt/python/${{ matrix.PYTHON }}/bin/python -m pytest;
fi;
if \[ ${{ matrix.PYTHON }} == cp310-cp310 \] && \[ ${{ runner.os }} == 'Linux' \] && \[ ${{ matrix.purity }} == 'with-pylmdb-mods' \] && \[ ${{ matrix.impl }} == 'cpython' \] ; then
/opt/python/${{ matrix.PYTHON }}/bin/python -c \"import lmdb; print(lmdb.__version__, end='')\" > vers.txt;
fi;"
- uses: actions/upload-artifact@v2
/opt/python/${{ matrix.PYTHON }}/bin/python -c \"import lmdb; print(lmdb.__version__, end='')\" > vers.txt;
- uses: actions/upload-artifact@v4
with:
name: "${{ runner.os }}-${{ matrix.PYTHON }}-${{ matrix.impl }}-${{ matrix.purity }}.whl"
path: dist/lmdb-*.whl

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: >-
matrix.PYTHON == 'cp310-cp310' && runner.os == 'Linux' &&
matrix.purity == 'with-pylmdb-mods' && matrix.impl == 'cpython'
with:
path: vers.txt
name: vers.txt
- uses: actions/upload-artifact@v2
if: >-
matrix.PYTHON == 'cp310-cp310' && runner.os == 'Linux' &&
matrix.purity == 'with-pylmdb-mods' && matrix.impl == 'cpython'
with:
path: dist/lmdb*.tar.gz
name: source
name: vers.txt.aarch64
- uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2014_aarch64
if: >-
matrix.PYTHON == 'cp310-cp310' && runner.os == 'Linux' &&
matrix.purity == 'with-pylmdb-mods' && matrix.impl == 'cpython'
with:
python-versions: >-
cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312
cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313
build-requirements: 'patch-ng'
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: >-
matrix.PYTHON == 'cp310-cp310' && runner.os == 'Linux' &&
matrix.purity == 'with-pylmdb-mods' && matrix.impl == 'cpython'
with:
path: dist/lmdb*manylinux*.whl
name: manylinux
name: manylinux.aarch64

publish:
needs: build
permissions:
id-token: write # This is required for passwordless publishing to PyPI
needs: [build, build_aarch64]
# N.B. the host running twine to upload is distinct from the target image
runs-on: ubuntu-20.04
strategy:
# We publish a subset of the targets we test
matrix:
os: [macos-latest, windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', pypy-3.10]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', pypy-3.10]
impl: [cpython, cffi]
purity: [with-pylmdb-mods]

Expand All @@ -264,6 +258,8 @@ jobs:
impl: cffi
- python-version: '3.12'
impl: cffi
- python-version: '3.13'
impl: cffi

include:
# Ubuntu artifacts apply to all python versions
Expand All @@ -275,21 +271,28 @@ jobs:
steps:
- name: Download source
if: matrix.os == 'ubuntu-20.04'
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: source
path: dist

- name: Download manylinux artifact
- name: Download manylinux artifacts
if: matrix.os == 'ubuntu-20.04'
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: manylinux
path: dist

- name: Download aarch64 manylinux artifacts
if: matrix.os == 'ubuntu-20.04'
uses: actions/download-artifact@v4
with:
name: manylinux.aarch64
path: dist

- name: Download non-Linux wheel
if: matrix.os != 'ubuntu-20.04'
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: "${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.impl }}-${{ matrix.purity }}.whl"
path: dist
Expand All @@ -302,12 +305,11 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1

with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true

- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
# with: password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion lmdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ def _reading_docs():
from lmdb.cffi import __all__
from lmdb.cffi import __doc__

__version__ = '1.5.1'
__version__ = '1.5.1.dev0'
12 changes: 12 additions & 0 deletions lmdb/cpython.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,21 @@ val_from_buffer(MDB_val *val, PyObject *buf)
type_error("Won't implicitly convert Unicode to bytes; use .encode()");
return -1;
}
#if PY_VERSION_HEX < 0x030d0000
return PyObject_AsReadBuffer(buf,
(const void **) &val->mv_data,
(Py_ssize_t *) &val->mv_size);
#else
Py_buffer view;
int ret;
ret = PyObject_GetBuffer(buf, &view, PyBUF_SIMPLE);
if(ret == 0) {
val->mv_data = view.buf;
val->mv_size = view.len;
PyBuffer_Release(&view);
}
return ret;
#endif
}

/* ------------------- */
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def grep_version():
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Database",
"Topic :: Database :: Database Engines/Servers",
],
Expand Down
Loading