Skip to content

Commit 50cda9f

Browse files
authored
Version 0.9.0 (#67)
1 parent 3d2c536 commit 50cda9f

File tree

6 files changed

+33
-21
lines changed

6 files changed

+33
-21
lines changed

CHANGES.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
Version 0.9.0 - October 30, 2023
2+
- This is a maintenance release, minor deprecation fixes
3+
- Python minimum required version is enforced to Python 3.8 in pyproject.toml
4+
- To follow Python conventions, renamed in "oqs/oqs.py"
5+
is_KEM_enabled() -> is_kem_enabled()
6+
get_enabled_KEM_mechanisms() -> get_enabled_kem_mechanisms()
7+
get_supported_KEM_mechanisms() -> get_supported_kem_mechanisms()
8+
19
Version 0.8.0 - July 5, 2023
210
- This is a maintenance release, minor fixes
11+
- Minimalistic Docker support
312
- Migrated installation method to pyproject.toml
413
- Removed AppVeyor and CircleCI, all continuous integration is now done
514
via GitHub actions

RELEASE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# liboqs-python version 0.8.0
1+
# liboqs-python version 0.9.0
22

33
---
44

@@ -21,12 +21,12 @@ intended use.
2121

2222
## Release notes
2323

24-
This release of liboqs-python was released on July 5, 2023. Its release page on GitHub
25-
is https://github.com/open-quantum-safe/liboqs-python/releases/tag/0.8.0.
24+
This release of liboqs-python was released on October 30, 2023. Its release page on GitHub
25+
is https://github.com/open-quantum-safe/liboqs-python/releases/tag/0.9.0.
2626

2727
---
2828

2929
## What's New
3030

31-
This is the 8th release of liboqs-python. For a list of changes
31+
This is the 9th release of liboqs-python. For a list of changes
3232
see [CHANGES.txt](https://github.com/open-quantum-safe/liboqs-python/blob/main/CHANGES.txt).

examples/kem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
print("liboqs version:", oqs.oqs_version())
1111
print("liboqs-python version:", oqs.oqs_python_version())
1212
print("Enabled KEM mechanisms:")
13-
kems = oqs.get_enabled_KEM_mechanisms()
13+
kems = oqs.get_enabled_kem_mechanisms()
1414
pprint(kems, compact=True)
1515

1616
# create client and server with sample KEM mechanisms

oqs/oqs.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import ctypes as ct # to call native
1111
import ctypes.util as ctu
12-
import pkg_resources # to determine the module's version
12+
import importlib.metadata # to determine module version at runtime
1313
import platform # to learn the OS we're on
1414
import sys
1515
import warnings
@@ -24,16 +24,16 @@ def _load_shared_obj(name):
2424
paths = []
2525

2626
# search typical locations
27-
paths += [ctu.find_library("oqs")]
28-
paths += [ctu.find_library("liboqs")]
27+
paths += [ctu.find_library(name)]
28+
paths += [ctu.find_library("lib" + name)]
2929
dll = ct.windll if platform.system() == "Windows" else ct.cdll
3030

3131
for path in paths:
3232
if path:
3333
lib = dll.LoadLibrary(path)
3434
return lib
3535

36-
raise RuntimeError("No liboqs shared libraries found")
36+
raise RuntimeError("No " + name + " shared libraries found")
3737

3838

3939
try:
@@ -63,9 +63,9 @@ def oqs_version():
6363
def oqs_python_version():
6464
"""liboqs-python version string."""
6565
try:
66-
result = pkg_resources.require("liboqs-python")[0].version
67-
except pkg_resources.DistributionNotFound:
68-
warnings.warn("Please install liboqs-python using setup.py")
66+
result = importlib.metadata.version("liboqs-python")
67+
except importlib.metadata.PackageNotFoundError:
68+
warnings.warn("Please install liboqs-python using pip install")
6969
return None
7070
return result
7171

@@ -133,6 +133,7 @@ def __init__(self, alg_name, secret_key=None):
133133
get_enabled_KEM_mechanisms().
134134
:param secret_key: optional if generating by generate_keypair() later.
135135
"""
136+
super().__init__()
136137
self.alg_name = alg_name
137138
if alg_name not in _enabled_KEMs:
138139
# perhaps it's a supported but not enabled alg
@@ -214,7 +215,7 @@ def __repr__(self):
214215
native().OQS_KEM_alg_identifier.restype = ct.c_char_p
215216

216217

217-
def is_KEM_enabled(alg_name):
218+
def is_kem_enabled(alg_name):
218219
"""
219220
Returns True if the KEM algorithm is enabled.
220221
@@ -225,15 +226,15 @@ def is_KEM_enabled(alg_name):
225226

226227
_KEM_alg_ids = [native().OQS_KEM_alg_identifier(i) for i in range(native().OQS_KEM_alg_count())]
227228
_supported_KEMs = [i.decode() for i in _KEM_alg_ids]
228-
_enabled_KEMs = [i for i in _supported_KEMs if is_KEM_enabled(i)]
229+
_enabled_KEMs = [i for i in _supported_KEMs if is_kem_enabled(i)]
229230

230231

231-
def get_enabled_KEM_mechanisms():
232+
def get_enabled_kem_mechanisms():
232233
"""Returns the list of enabled KEM mechanisms."""
233234
return _enabled_KEMs
234235

235236

236-
def get_supported_KEM_mechanisms():
237+
def get_supported_kem_mechanisms():
237238
"""Returns the list of supported KEM mechanisms."""
238239
return _supported_KEMs
239240

@@ -273,6 +274,7 @@ def __init__(self, alg_name, secret_key=None):
273274
get_enabled_sig_mechanisms().
274275
:param secret_key: optional, if generated by generate_keypair().
275276
"""
277+
super().__init__()
276278
if alg_name not in _enabled_sigs:
277279
# perhaps it's a supported but not enabled alg
278280
if alg_name in _supported_sigs:

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "liboqs-python"
10-
version = "0.8.0"
10+
requires-python = ">=3.8"
11+
version = "0.9.0"
1112
description = "Python wrapper for liboqs, providing post-quantum public key cryptography algorithms"
1213
authors = [
1314
{ name = "Open Quantum Safe project", email = "[email protected]" },

tests/test_kem.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
def test_correctness():
13-
for alg_name in oqs.get_enabled_KEM_mechanisms():
13+
for alg_name in oqs.get_enabled_kem_mechanisms():
1414
if any(item in alg_name for item in disabled_KEM_patterns):
1515
continue
1616
yield check_correctness, alg_name
@@ -25,7 +25,7 @@ def check_correctness(alg_name):
2525

2626

2727
def test_wrong_ciphertext():
28-
for alg_name in oqs.get_enabled_KEM_mechanisms():
28+
for alg_name in oqs.get_enabled_kem_mechanisms():
2929
if any(item in alg_name for item in disabled_KEM_patterns):
3030
continue
3131
yield check_wrong_ciphertext, alg_name
@@ -52,8 +52,8 @@ def test_not_supported():
5252

5353
def test_not_enabled():
5454
# TODO: test broken as the compiled lib determines which algorithms are supported and enabled
55-
for alg_name in oqs.get_supported_KEM_mechanisms():
56-
if alg_name not in oqs.get_enabled_KEM_mechanisms():
55+
for alg_name in oqs.get_supported_kem_mechanisms():
56+
if alg_name not in oqs.get_enabled_kem_mechanisms():
5757
# found a non-enabled but supported alg
5858
try:
5959
with oqs.KeyEncapsulation(alg_name) as kem:

0 commit comments

Comments
 (0)