Skip to content

Commit

Permalink
Added entrypoint and version info.
Browse files Browse the repository at this point in the history
This closes #6
  • Loading branch information
ckoerber committed Oct 7, 2021
1 parent 8a17048 commit 646e8bc
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lsqfitgui/frontend/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from lsqfitgui.plot.fit import plot_fit, plot_residuals
from lsqfitgui.util.function import parse_function_expression
from lsqfitgui.util.versions import get_entrypoint_string, get_version_string


def document_function(
Expand Down Expand Up @@ -56,6 +57,7 @@ def get_content(fit, name: str = "Lsqfit GUI"):
[
html.H4("Fit function"),
html.Div(document_function(fit.fcn, fit.p)),
html.Pre(get_entrypoint_string() + "\n" + get_version_string()),
html.H4("Fit parameters"),
html.Pre(str(fit)),
],
Expand Down
29 changes: 29 additions & 0 deletions lsqfitgui/util/versions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""Utility regarding version numbers."""
import __main__ as main
from os.path import basename

from gvar import __version__ as gvar_version
from lsqfit import __version__ as lsqfit_version
from lsqfitgui.version import __version__ as lsqfitgui_version


def get_version_string() -> str:
"""Return version string of dependencies."""
return (
"("
+ " | ".join(
[
f"gvar: {gvar_version}",
f"lsqfit: {lsqfit_version}",
f"lsqfitgui: {lsqfitgui_version}",
]
)
+ ")"
)


def get_entrypoint_string(filename_only: bool = True) -> str:
"""Get name of the entry point script."""
full_name = main.__file__
name = basename(full_name) if filename_only else full_name
return f"Entrypoint: {name}"
3 changes: 3 additions & 0 deletions lsqfitgui/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Version infos."""

__version__ = "0.0.1"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
"""Setup file for lsqfitgui."""
from lsqfitgui.version import __version__

__author__ = "@ckoerber"
__version__ = "0.0.1"

from os import path

Expand Down

0 comments on commit 646e8bc

Please sign in to comment.