Skip to content

Commit 9436e49

Browse files
committed
lint, run ci on pr, update pre-commit
1 parent fbb6bcb commit 9436e49

File tree

6 files changed

+34
-26
lines changed

6 files changed

+34
-26
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Python package
22

3-
on: [push]
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
48

59
jobs:
610

@@ -25,11 +29,13 @@ jobs:
2529
needs: lint
2630
strategy:
2731
matrix:
28-
os: [ubuntu-20.04, macos-12, windows-2019]
29-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
32+
os: [ubuntu-20.04, macos-13, windows-2019]
33+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
3034
exclude:
3135
- os: windows-2019
3236
python-version: '3.12'
37+
- os: windows-2019
38+
python-version: '3.13'
3339
runs-on: ${{ matrix.os }}
3440

3541
steps:

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.6.0
3+
rev: v5.0.0
44
hooks:
55
- id: check-added-large-files
66
- id: check-case-conflict
@@ -23,30 +23,30 @@ repos:
2323
- id: pretty-format-yaml
2424
args: [--autofix]
2525
- repo: https://github.com/tox-dev/pyproject-fmt
26-
rev: 1.8.0
26+
rev: 2.2.4
2727
hooks:
2828
- id: pyproject-fmt
2929
- repo: https://github.com/asottile/pyupgrade
30-
rev: v3.15.2
30+
rev: v3.16.0
3131
hooks:
3232
- id: pyupgrade
3333
args: [--py37-plus]
3434
- repo: https://github.com/psf/black-pre-commit-mirror
35-
rev: 24.4.2
35+
rev: 24.8.0
3636
hooks:
3737
- id: black
3838
- repo: https://github.com/PyCQA/isort
3939
rev: 5.13.2
4040
hooks:
4141
- id: isort
4242
- repo: https://github.com/PyCQA/bandit
43-
rev: 1.7.8
43+
rev: 1.7.10
4444
hooks:
4545
- id: bandit
4646
args: [-c, pyproject.toml]
4747
additional_dependencies: ['.[toml]']
4848
- repo: https://github.com/pycqa/flake8
49-
rev: 7.0.0
49+
rev: 7.1.1
5050
hooks:
5151
- id: flake8
5252
additional_dependencies:
@@ -56,14 +56,14 @@ repos:
5656
- flake8-mutable
5757
- flake8-simplify
5858
- repo: https://github.com/pre-commit/mirrors-mypy
59-
rev: v1.10.0
59+
rev: v1.13.0
6060
hooks:
6161
- id: mypy
6262
args: [--ignore-missing-imports, --install-types, --non-interactive]
6363
additional_dependencies:
6464
- lmdb==1.4.1
6565
- typing-extensions>=4.0.0
6666
- repo: https://github.com/Yelp/detect-secrets
67-
rev: v1.4.0
67+
rev: v1.5.0
6868
hooks:
6969
- id: detect-secrets

benchmark.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
from abc import ABC, abstractmethod
1010
from collections import defaultdict
1111
from contextlib import closing, suppress
12+
from importlib import import_module
1213
from random import randrange
1314
from typing import Any, Callable, ContextManager, DefaultDict, Dict, Iterable, List, Sequence, TextIO
1415

15-
from importlib import import_module
1616
from genutility.iter import batch
1717
from genutility.time import MeasureTime
1818
from pytablewriter import MarkdownTableWriter
@@ -40,12 +40,12 @@ def __init__(self, db_tpl, db_type, db_module):
4040
self.combined = -1
4141

4242
def load_module(self, name):
43-
""""Load module and ignore benchmark if module is unavailable"""
43+
""" "Load module and ignore benchmark if module is unavailable"""
4444
if name is None or name in sys.modules:
4545
return True
4646

4747
try:
48-
globals()[name.split('.')[-1]] = import_module(name)
48+
globals()[name.split(".")[-1]] = import_module(name)
4949
print(f"Loaded module {name}")
5050
except ImportError:
5151
return False
@@ -293,7 +293,7 @@ def __init__(self, db_tpl):
293293
super().__init__(db_tpl, "shelve", "shelve")
294294

295295
def open(self):
296-
return shelve.open(self.path)
296+
return shelve.open(self.path) # nosec B301
297297

298298

299299
class VedisBenchmark(JsonEncodedBenchmark):

pyproject.toml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[build-system]
22
build-backend = "flit_core.buildapi"
33
requires = [
4-
"flit_core<4,>=3.2",
4+
"flit-core<4,>=3.2",
55
]
66

77
[project]
88
name = "lmdbm"
99
readme = "readme.md"
10-
authors = [{name = "Dobatymo", email = "Dobatymo@users.noreply.github.com"}]
11-
requires-python = ">= 3.7"
10+
authors = [ { name = "Dobatymo", email = "Dobatymo@users.noreply.github.com" } ]
11+
requires-python = ">=3.7"
1212
classifiers = [
1313
"Intended Audience :: Developers",
1414
"License :: OSI Approved :: ISC License (ISCL)",
@@ -20,6 +20,7 @@ classifiers = [
2020
"Programming Language :: Python :: 3.10",
2121
"Programming Language :: Python :: 3.11",
2222
"Programming Language :: Python :: 3.12",
23+
"Programming Language :: Python :: 3.13",
2324
"Topic :: Database",
2425
]
2526
dynamic = [
@@ -30,8 +31,7 @@ dependencies = [
3031
"lmdb",
3132
"typing-extensions>=4",
3233
]
33-
[project.optional-dependencies]
34-
bench = [
34+
optional-dependencies.bench = [
3535
"genutility[iter,rich,time]>=0.0.103",
3636
"pysos==1.2.9",
3737
"pytablewriter==0.63",
@@ -41,11 +41,10 @@ bench = [
4141
"unqlite==0.9.2",
4242
"vedis==0.7.1",
4343
]
44-
test = [
44+
optional-dependencies.test = [
4545
"genutility[test]",
4646
]
47-
[project.urls]
48-
Home = "https://github.com/Dobatymo/lmdb-python-dbm"
47+
urls.Home = "https://github.com/Dobatymo/lmdb-python-dbm"
4948

5049
[tool.black]
5150
line-length = 120
@@ -58,4 +57,4 @@ profile = "black"
5857
line_length = 120
5958

6059
[tool.bandit]
61-
skips = ["B101"]
60+
skips = [ "B101" ]

readme.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ As of `lmdb==1.2.1` the docs say that calling `lmdb.Environment.set_mapsize` fro
4343

4444
## Benchmarks
4545

46-
See `benchmark.py` and `requirements-bench.txt`. Other storage engines which could be tested: `wiredtiger`, `berkeleydb`.
46+
Install `lmdbm[bench]` and run `benchmark.py`. Other storage engines which could be tested: `wiredtiger`, `berkeleydb`.
47+
4748
Storage engines not benchmarked:
48-
- `tinydb` (because it doesn't have built-in str/bytes keys)
49+
- `tinydb` (because it doesn't have built-in str/bytes keys)
4950

5051
### continuous writes in seconds (best of 3)
5152
| items | lmdbm |lmdbm-batch|pysos |sqlitedict|sqlitedict-batch|dbm.dumb|semidbm|vedis |vedis-batch|unqlite|unqlite-batch|

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ max-line-length = 120
33
select = B, E7, E9, W2, W3, W6, F
44
ignore = E704
55
exclude = .git,.mypy_cache,__pycache__,build,dist
6+
per-file-ignores =
7+
benchmark.py:F821

0 commit comments

Comments
 (0)