Skip to content

Commit

Permalink
Use plyvel for the leveldb backend
Browse files Browse the repository at this point in the history
Rationales:
- quickumls fails to install on Python 3.12 due to py-leveldb
- py-leveldb looks unmaintained and is unlikely to receive support for Python 3.12
- plyvel provides a suitable replacement and is compatible with Python 3.12 onwards

Closes Georgetown-IR-Lab#98
  • Loading branch information
ghisvail committed Aug 12, 2024
1 parent b8fed22 commit ff005ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions quickumls/toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# installed modules
import numpy
import leveldb
import plyvel
try:
import unqlite
UNQLITE_AVAILABLE = True
Expand Down Expand Up @@ -240,12 +240,12 @@ def __init__(self, path, database_backend='leveldb'):
self.semtypes_db_put = self.semtypes_db.store
self.semtypes_db_get = self.semtypes_db.fetch
elif database_backend == 'leveldb':
self.cui_db = leveldb.LevelDB(os.path.join(path, 'cui.leveldb'))
self.cui_db_put = self.cui_db.Put
self.cui_db_get = self.cui_db.Get
self.semtypes_db = leveldb.LevelDB(os.path.join(path, 'semtypes.leveldb'))
self.semtypes_db_put = self.semtypes_db.Put
self.semtypes_db_get = self.semtypes_db.Get
self.cui_db = plyvel.DB(os.path.join(path, 'cui.leveldb'))
self.cui_db_put = self.cui_db.put
self.cui_db_get = self.cui_db.get
self.semtypes_db = plyvel.DB(os.path.join(path, 'semtypes.leveldb'))
self.semtypes_db_put = self.semtypes_db.put
self.semtypes_db_get = self.semtypes_db.get
else:
raise ValueError(f'database_backend {database_backend} not recognized')

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
leveldb>=0.193
plyvel>=1.5.1
numpy>=1.8.2
spacy>=3.0.6
unidecode>=0.4.19
Expand Down

0 comments on commit ff005ac

Please sign in to comment.