Skip to content

Commit 1617506

Browse files
typechecking and Makefile for convenience
1 parent 76c1156 commit 1617506

6 files changed

Lines changed: 31 additions & 13 deletions

File tree

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
install:
2+
bun install
3+
uv sync --all-extras
4+
5+
clean:
6+
rm -rf node_modules .venv
7+
8+
build:
9+
bun run build
10+
uv build
11+
12+
test:
13+
uv run pytest hiplot --durations=10
14+
15+
check:
16+
# uv run mypy --strict --implicit-reexport hiplot
17+
uv run ty check
18+

hiplot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .experiment import (Experiment, ExperimentFetcherDoesntApply, ExperimentValidationError, ExperimentValidationCircularRef,
66
ExperimentValidationMissingParent, Datapoint, ExperimentDisplayed, ValueDef, ValueType, Displays)
77
from .server import run_server, run_server_main
8-
from .pkginfo import version as __version__, package_name
8+
from .pkginfo import __version__, package_name
99

1010
from . import fetchers
1111

hiplot/pkginfo.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
# Dynamic version from installed package metadata
88
# This ensures __version__ matches pyproject.toml when installed via pip
99
try:
10-
from importlib.metadata import version, PackageNotFoundError
10+
from importlib.metadata import version as get_version, PackageNotFoundError
1111
try:
12-
version = version(package_name)
12+
__version__ = get_version(package_name)
1313
except PackageNotFoundError:
1414
# Package is not installed (e.g., running from source checkout)
15-
version = "0.0.0.dev0"
15+
__version__ = "0.0.0.dev0"
1616
except ImportError:
1717
# Python < 3.8 fallback
1818
try:
1919
import importlib_metadata
20-
version = importlib_metadata.version(package_name)
20+
__version__ = importlib_metadata.version(package_name)
2121
except Exception:
22-
version = "0.0.0.dev0"
22+
__version__ = "0.0.0.dev0"

hiplot/render.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def html_inlinize(html: str, replace_local: bool = True) -> str:
3636
static_root = str(Path(__file__).parent)
3737
soup = BeautifulSoup(html, "html.parser")
3838
for i in soup.find_all("link"):
39-
href = i["href"]
39+
href = str(i["href"])
4040
if href.startswith("http") or href.startswith("//"):
4141
continue
4242
if not replace_local:
@@ -54,7 +54,7 @@ def html_inlinize(html: str, replace_local: bool = True) -> str:
5454
i["href"] = f"data:{SUFFIX_TO_TYPE[file.suffix]};base64,{base64.b64encode(file.open('rb').read()).decode('ascii')}"
5555
for i in soup.find_all("script"):
5656
try:
57-
src = i["src"]
57+
src = str(i["src"])
5858
except KeyError:
5959
continue
6060
if src.startswith("http") or src.startswith("//"):

hiplot/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def data() -> Any: # pylint: disable=unused-variable
5151

5252
def run_server_main() -> int:
5353
parser = argparse.ArgumentParser(prog="HiPlot", description="Start HiPlot webserver")
54-
parser.add_argument('--version', action='version', version=f'{pkginfo.package_name} {pkginfo.version}')
54+
parser.add_argument('--version', action='version', version=f'{pkginfo.package_name} {pkginfo.__version__}')
5555
parser.add_argument("--host", type=str, default="127.0.0.1")
5656
parser.add_argument("--port", type=int, default=5005)
5757
parser.add_argument("--dev", action='store_true', help="Enable Flask Debug mode (watches for files modifications, etc..)")

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ all = [
6161
# Development dependencies
6262
dev = [
6363
"pytest",
64-
"mypy",
64+
"ty",
6565
"ipykernel",
6666
"wheel",
67-
"selenium",
67+
# "selenium",
6868
"mistune==0.8.4",
6969
"twine",
7070
"pre-commit",
@@ -74,14 +74,14 @@ dev = [
7474
"optuna",
7575
"sphinx==5.2.0",
7676
"guzzle_sphinx_theme==0.7.11",
77-
"m2r2==0.3.3",
77+
"m2r2>=0.3.4",
7878
"flask",
7979
"flask-compress",
8080
"ipython>=7.0.1",
8181
]
8282

8383
[project.scripts]
84-
hiplot = "hiplot.server:run_server_main"
84+
hiplot-mm = "hiplot.server:run_server_main"
8585
hiplot-render = "hiplot.render:hiplot_render_main"
8686

8787
[project.urls]

0 commit comments

Comments
 (0)