-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: lib versions * feat: show version in an About dialog * feat: simplify version handling * feat: embed libs metadata * feat: print version to the debug logs
- Loading branch information
1 parent
1d54d74
commit 80e20df
Showing
9 changed files
with
56 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .app_versions import get_app_version, get_lib_versions | ||
from .version import Version | ||
|
||
__all__ = ["Version"] | ||
__all__ = ["Version", "get_lib_versions", "get_app_version"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
from functools import cache | ||
from importlib.metadata import PackageNotFoundError, distributions, version | ||
|
||
UNKNOWN_VERSION = "unknown" | ||
|
||
@cache | ||
def get_app_version() -> str: | ||
try: | ||
# Change here if project is renamed and does not equal the package name | ||
return version("NanoVNASaver") | ||
except PackageNotFoundError: # pragma: no cover | ||
return UNKNOWN_VERSION | ||
|
||
@cache | ||
def get_lib_versions() -> list[str]: | ||
return [f"{dist.name}: {dist.version}" for dist in distributions()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
|
||
from NanoVNASaver.utils import get_app_version, get_lib_versions | ||
|
||
|
||
def test_get_app_version() -> None: | ||
result = get_app_version() | ||
|
||
assert result | ||
assert result != "unknown" | ||
|
||
def test_get_lib_versions() -> None: | ||
result1 = get_lib_versions() | ||
|
||
# at least 2xQt, numpy, scipy and NanoVNASaver itself | ||
assert len(result1) > 6 # noqa: PLR2004 |