diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..d27118d --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,10 @@ +--- +version: "2" + +build: + os: "ubuntu-22.04" + tools: + python: "3.12" + +sphinx: + configuration: doc/conf.py diff --git a/NEWS.rst b/NEWS.rst index 4093051..f0832fe 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -2,6 +2,18 @@ Version history =============== +Plyvel 1.5.1 +============ + +Release date: 2024-01-15 + +* Add Python 3.12 support + +* Rebuild Linux wheels, including Python 3.12 wheels. + +* Allow using plyvel.DB as a context manager + (`pr #151 `_) + Plyvel 1.5.0 ============ diff --git a/doc/api.rst b/doc/api.rst index 2b2cf02..e35c168 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -35,6 +35,11 @@ LevelDB database. Most arguments are optional; only the database name is required. + Instances of this class can be used as context managers + (Python's ``with`` block). When the ``with`` block terminates, + the database automatically closes without an explicit call to + :py:meth:`DB.close`. + See the descriptions for :cpp:class:`DB`, :cpp:func:`DB::Open`, :cpp:class:`Cache`, :cpp:class:`FilterPolicy`, and :cpp:class:`Comparator` in the LevelDB C++ API for more information. diff --git a/doc/user.rst b/doc/user.rst index 330bd8b..9a29648 100644 --- a/doc/user.rst +++ b/doc/user.rst @@ -48,6 +48,13 @@ To close the database we just opened, use :py:meth:`DB.close` and inspect the >>> db.closed True +:py:class:`DB` instances can also be used as context managers, which +will cause the database to close itself at the end of the ``with`` +block:: + + with plyvel.DB('/tmp/testdb/') as db: + ... + Alternatively, you can just delete the variable that points to it, but this might not close the database immediately, e.g. because active iterators are using it:: diff --git a/plyvel/_version.py b/plyvel/_version.py index 551a364..4ffd924 100644 --- a/plyvel/_version.py +++ b/plyvel/_version.py @@ -5,4 +5,4 @@ # Note: don't add any non-trivial logic here; this file is also loaded # from setup.py file when the module has not yet been compiled! -__version__ = '1.5.0' +__version__ = '1.5.1' diff --git a/requirements-test.txt b/requirements-test.txt index dfdd43d..074321b 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,2 +1,3 @@ pytest>=3.6 pytest-cov +setuptools diff --git a/tox.ini b/tox.ini index 0df3ada..20df1d1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] -envlist = py310, py39, py38, py37 +envlist = py312, py311, py310, py39, py38, py37 [testenv] deps = -rrequirements-test.txt commands = make test -whitelist_externals = make +allowlist_externals = make