Skip to content

Commit 7f7e291

Browse files
authored
Use Python version of library as version (#969)
* Use Python version of library as version * Fix test
1 parent 45714f0 commit 7f7e291

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

python/basix/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# WINDOWSDLL
1414

1515
from basix._basixcpp import MapType
16-
from basix._basixcpp import __version__ # type: ignore
1716
from basix import cell, finite_element, lattice, polynomials, quadrature, sobolev_spaces
1817
from basix.cell import CellType, geometry, topology
1918
from basix.finite_element import (
@@ -33,6 +32,10 @@
3332
from basix.sobolev_spaces import SobolevSpace
3433
from basix.utils import index
3534

35+
from importlib.metadata import metadata
36+
37+
__version__ = metadata("fenics-basix")["Version"]
38+
3639
__all__ = [
3740
"cell",
3841
"finite_element",

test/test_version.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# SPDX-License-Identifier: MIT
44

55
import re
6-
from importlib.metadata import version
76

87
import pytest
98

@@ -23,7 +22,7 @@ def is_canonical(version):
2322
)
2423

2524

26-
def test_version(python_version=version("fenics-basix"), cpp_version=basix.__version__):
25+
def test_version(python_version=basix.__version__, cpp_version=basix._basixcpp.__version__):
2726
assert is_canonical(python_version)
2827

2928
# Strip Python-specific versioning (dev, post) and compare with C++

0 commit comments

Comments
 (0)