8000 Update liblmdb, add building for 3.12 (#361) · jnwatson/py-lmdb@4ab5cb2 · GitHub 8000
[go: up one dir, main page]

Skip to content

Commit 4ab5cb2

Browse files
authored
Update liblmdb, add building for 3.12 (#361)
* Pull lmdb 0.9.31 from upstream. * Get Python 3.12 building in CI. * Remove 2.7 builds as Github Actions removed support * Add `import setuptools` to CI since not in 3.12 venv anymore * Update supported versions, fix #358 * Update py-lmdb patch for lmdb 0.9.31 * Remove 2.7 cruft * Drop 3.7 building on MacOS since not easily supported in CI * Update changelog * Reduce tests a bit
1 parent 57c6920 commit 4ab5cb2

File tree

12 files changed

+165
-235
lines changed

12 files changed

+165
-235
lines changed

.github/workflows/python-package.yml

Lines changed: 21 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,22 @@ jobs:
1616
strategy:
1717
matrix:
1818
os: [ubuntu-20.04, macos-latest, windows-latest]
19-
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, '3.10', '3.11', pypy-2.7, pypy-3.9]
19+
python-version: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12', pypy-3.10]
2020
impl: [cpython, cffi]
2121
purity: [pure, with-pylmdb-mods]
2222

2323
exclude:
24-
- python-version: pypy-2.7
24+
# Pypy doesn't work with cpython
25+
- python-version: pypy-3.10
2526
impl: cpython
26-
- python-version: pypy-3.9
27-
impl: cpython
28-
# CFFI has trouble building on Windows for 3.5 "self.find_available_vc_vers()[-1]" fails
29-
- python-version: 3.5
30-
os: windows-latest
31-
# Microsoft removed VC 9.0 installer so Python 2.7 modules can no longer be built on Windows
32-
- python-version: 2.7
33-
os: windows-latest
34-
# Doesn't seem to exist on github MacOS
35-
- python-version: pypy-3.9
27+
# macos latest is now arm64 and 3.7 doesn't have arm64 build
28+
- python-version: 3.7
3629
os: macos-latest
3730

3831
steps:
3932
- uses: actions/checkout@v2
4033
- name: Set up Python ${{ matrix.python-version }}
41-
uses: actions/setup-python@v2
34+
uses: actions/setup-python@v5
4235
with:
4336
python-version: ${{ matrix.python-version }}
4437
- name: Set env vars Windows
@@ -79,7 +72,7 @@ jobs:
7972
cffi=$LMDB_FORCE_CFFI pure=$LMDB_PURE system=$LMDB_FORCE_SYSTEM"
8073
echo "Windows: Envs are cpython=$Env:LMDB_FORCE_CPYTHON
8174
cffi=$Env:LMDB_FORCE_CFFI pure=$Env:LMDB_PURE system=$Env:LMDB_FORCE_SYSTEM"
82-
python -m pip install wheel
75+
python -m pip install setuptools wheel
8376
# Install this separately since sometimes Github Actions can't find it
8477
python -m pip install cffi
8578
python -m pip install flake8 pytest patch-ng
@@ -94,7 +87,9 @@ jobs:
9487
#
9588
- name: Test with pytest
9689
# Limit the test cycle a little
97-
if: matrix.python-version != '3.6' && matrix.python-version != '3.8'
90+
if: >-
91+
matrix.python-version != '3.7' && matrix.python-version != '3.9' &&
92+
matrix.python-version != '3.11'
9893
run: |
9994
echo "Envs are cpython=$LMDB_FORCE_CPYTHON cffi=$LMDB_FORCE_CFFI
10095
pure=$LMDB_PURE system=$LMDB_FORCE_SYSTEM"
@@ -141,7 +136,7 @@ jobs:
141136
uses: RalfG/python-wheels-manylinux-build@v0.7.1
142137
with:
143138
python-versions: >-
144-
cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311
139+
cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312
145140
build-requirements: 'patch-ng'
146141

147142
- name: What do we have
@@ -165,7 +160,7 @@ jobs:
165160
matrix:
166161
impl: [cpython, cffi]
167162
purity: [pure, with-pylmdb-mods]
168-
PYTHON: ["cp36-cp36m", "cp37-cp37m" , "cp38-cp38" , "cp39-cp39", "cp310-cp310", "cp311-cp311"]
163+
PYTHON: ["cp37-cp37m" , "cp38-cp38" , "cp39-cp39", "cp310-cp310", "cp311-cp311"]
169164
steps:
170165
- uses: actions/checkout@v2
171166
- run: |
@@ -179,7 +174,7 @@ jobs:
179174
python --version;
180175
/opt/python/${{ matrix.PYTHON }}/bin/python -m venv .venv;
181176
yum install -y libffi-devel;
182-
.venv/bin/pip install -U pip wheel cffi six;
177+
.venv/bin/pip install -U pip setuptools wheel cffi six;
183178
if \[ ${{ matrix.impl }} == cpython \] ; then
184179
echo LMDB_FORCE_CPYTHON=1
185180
else
@@ -194,7 +189,7 @@ jobs:
194189
cffi=$LMDB_FORCE_CFFI pure=$LMDB_PURE system=$LMDB_FORCE_SYSTEM\";
195190
echo \"Windows: Envs are cpython=$Env:LMDB_FORCE_CPYTHON
196191
cffi=$Env:LMDB_FORCE_CFFI pure=$Env:LMDB_PURE system=$Env:LMDB_FORCE_SYSTEM\";
197-
.venv/bin/pip install flake8 pytest patch-ng;
192+
.venv/bin/pip install setuptools flake8 pytest patch-ng;
198193
/opt/python/${{ matrix.PYTHON }}/bin/python setup.py develop bdist_wheel;
199194
ls dist;
200195
/opt/python/${{ matrix.PYTHON }}/bin/python -m pip install pytest;
@@ -212,29 +207,29 @@ jobs:
212207

213208
- uses: actions/upload-artifact@v2
214209
if: >-
215-
matrix.PYTHON == 'cp310-cp310' && runner.os == 'Linux' &&
210+
matrix.PYTHON == 'cp310-cp310' && runner.os == 'Linux' &&
216211
matrix.purity == 'with-pylmdb-mods' && matrix.impl == 'cpython'
217212
with:
218213
path: vers.txt
219214
name: vers.txt
220215
- uses: actions/upload-artifact@v2
221216
if: >-
222-
matrix.PYTHON == 'cp310-cp310' && runner.os == 'Linux' &&
217+
matrix.PYTHON == 'cp310-cp310' && runner.os == 'Linux' &&
223218
matrix.purity == 'with-pylmdb-mods' && matrix.impl == 'cpython'
224219
with:
225220
path: dist/lmdb*.tar.gz
226221
name: source
227222
- uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2014_aarch64
228223
if: >-
229-
matrix.PYTHON == 'cp310-cp310' && runner.os == 'Linux' &&
224+
matrix.PYTHON == 'cp310-cp310' && runner.os == 'Linux' &&
230225
matrix.purity == 'with-pylmdb-mods' && matrix.impl == 'cpython'
231226
with:
232227
python-versions: >-
233-
cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311
228+
cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312
234229
build-requirements: 'patch-ng'
235230
- uses: actions/upload-artifact@v2
236231
if: >-
237-
matrix.PYTHON == 'cp310-cp310' && runner.os == 'Linux' &&
232+
matrix.PYTHON == 'cp310-cp310' && runner.os == 'Linux' &&
238233
matrix.purity == 'with-pylmdb-mods' && matrix.impl == 'cpython'
239234
with:
240235
path: dist/lmdb*manylinux*.whl
@@ -248,41 +243,15 @@ jobs:
248243
# We publish a subset of the targets we test
249244
matrix:
250245
os: [macos-latest, windows-latest]
251-
python-version: ['2.7', '3.5', '3.6', '3.7', '3.8', '3.9', '3.10', '3.11', pypy-2.7, pypy-3.9]
246+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', pypy-3.10]
252247
impl: [cpython, cffi]
253248
purity: [with-pylmdb-mods]
254249

255250
exclude:
256-
- python-version: 'pypy-2.7'
257-
impl: cpython
258-
- python-version: 'pypy-3.9'
251+
- python-version: 'pypy-3.10'
259252
impl: cpython
260-
- python-version: '2.7'
261-
impl: cffi
262-
- python-version: '3.5'
263-
impl: cffi
264-
- python-version: '3.6'
265-
impl: cffi
266253
- python-version: '3.7'
267-
impl: cffi
268-
- python-version: '3.8'
269-
impl: cffi
270-
- python-version: '3.9'
271-
impl: cffi
272-
- python-version: '3.10'
273-
impl: cffi
274-
- python-version: '3.11'
275-
impl: cffi
276-
# CFFI has trouble building on Windows for 3.5 "self.find_available_vc_vers()[-1]" fails
277-
- python-version: 3.5
278-
os: windows-latest
279-
# Microsoft removed VC 9.0 installer so Python 2.7 modules can no longer be built on Windows
280-
- python-version: '2.7'
281-
os: windows-latest
282-
# Doesn't seem to exist on github MacOS
283-
- python-version: pypy-3.9
284254
os: macos-latest
285-
286255
include:
287256
# Ubuntu artifacts apply to all python versions
288257
- os: ubuntu-20.04

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2024-06-25 1.5.0
2+
* Add Python 3.12 binaries.
3+
4+
* Update bundled LMDB to 0.9.31.
5+
6+
* Remove Python 2.7 support.
7+
18
2022-04-04 v1.4.1
29
* Update CI to build manylinux binaries.
310

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ See [the documentation](https://lmdb.readthedocs.io) for more information.
77

88
# Python Version Support Statement
99

10-
This project has been around for a while. Previously, it supported all the way back to before 2.5. Currently py-lmdb
11-
supports Python 2.7, Python >= 3.5, and pypy.
12-
13-
Python 2.7 is now end-of-life. If you are still using Python 2.7, you should strongly considering porting to Python
14-
3.
15-
16-
That said, this project will continue to support running on Python 2.7 until Github Actions remove support for it.
10+
This project has been around for a while. Previously, it supported all the way back to before 2.5. Currently, py-lmdb
11+
supports Python >= 3.5 and pypy.
1712

13+
The last version of py-lmdb that supported Python 2.7 was 1.4.1.

docs/index.rst

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ lmdb
1111
This is a universal Python binding for the `LMDB 'Lightning' Database
1212
<http://lmdb.tech/>`_. Two variants are provided and automatically selected
1313
during install: a `CFFI <https://cffi.readthedocs.io/en/release-0.5/>`_ variant
14-
that supports `PyPy <http://www.pypy.org/>`_ and all versions of CPython >=2.7,
15-
and a C extension that supports CPython >=2.7 and >=3.4. Both variants
16-
provide the same interface.
14+
that supports `PyPy <http://www.pypy.org/>`_ and all versions of CPython >=3.5,
15+
and a C extension that supports >= 3.5. Both variants provide the same interface.
1716

1817
LMDB is a tiny database with some excellent properties:
1918

@@ -41,21 +40,12 @@ to be installed via pip and easy_install without the need for a compiler to be
4140
present. The binary releases statically link against the bundled version of
4241
LMDB.
4342

44-
Initially 32-bit and 64-bit binaries are provided for Python 2.7; in future
45-
binaries will be published for all supported versions of Python.
46-
4743
To install, use a command like:
4844

4945
::
5046

5147
C:\Python27\python -mpip install lmdb
5248

53-
Or:
54-
55-
::
56-
57-
C:\Python27\python -measy_install lmdb
58-
5949

6050
Installation: UNIX
6151
++++++++++++++++++
@@ -78,14 +68,12 @@ depend on the CPython development headers. On Debian/Ubuntu:
7868

7969
apt-get install libffi-dev python-dev build-essential
8070

81-
To install the C extension, ensure a C compiler and `pip` or `easy_install` are
71+
To install the C extension, ensure a C compiler and `pip` are
8272
available and type:
8373

8474
::
8575

8676
pip install lmdb
87-
# or
88-
easy_install lmdb
8977

9078
The CFFI variant may be used on CPython by setting the ``LMDB_FORCE_CFFI``
9179
environment variable before installation, or before module import with an
@@ -194,21 +182,11 @@ written the dirty pages to disk.
194182
Bytestrings
195183
+++++++++++
196184

197-
This documentation uses `bytestring` to mean either the Python<=2.7
198-
:py:func:`str` type, or the Python>=3.0 :py:func:`bytes` type, depending on the
199-
Python version in use.
200-
201-
Due to the design of Python 2.x, LMDB will happily accept Unicode instances
202-
where :py:func:`str` instances are expected, so long as they contain only ASCII
203-
characters, in which case they are implicitly encoded to ASCII. You should not
204-
rely on this behaviour! It results in brittle programs that often break the
205-
moment they are deployed in production. Always explicitly encode and decode any
206-
Unicode values before passing them to LMDB.
185+
This documentation uses `bytestring` to mean the Python>=3.0 :py:func:`bytes`
186+
type.
207187

208188
This documentation uses :py:func:`bytes` in examples. In Python 3.x this is a
209-
distinct type, whereas in Python 2.7 it is simply an alias for
210-
:py:func:`str`.
211-
189+
distinct type.
212190

213191
Buffers
214192
+++++++

lib/lmdb.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ typedef int mdb_filehandle_t;
200200
/** Library minor version */
201201
#define MDB_VERSION_MINOR 9
202202
/** Library patch version */
203-
#define MDB_VERSION_PATCH 29
203+
#define MDB_VERSION_PATCH 31
204204

205205
/** Combine args a,b,c into a single integer for easy version comparisons */
206206
#define MDB_VERINT(a,b,c) (((a) << 24) | ((b) << 16) | (c))
@@ -210,7 +210,7 @@ typedef int mdb_filehandle_t;
210210
MDB_VERINT(MDB_VERSION_MAJOR,MDB_VERSION_MINOR,MDB_VERSION_PATCH)
211211

212212
/** The release date of this library version */
213-
#define MDB_VERSION_DATE "March 16, 2021"
213+
#define MDB_VERSION_DATE "July 10, 2023"
214214

215215
/** A stringifier for the version info */
216216
#define MDB_VERSTR(a,b,c,d) "LMDB " #a "." #b "." #c ": (" d ")"

0 commit comments

Comments
 (0)
0