Skip to content

Commit bf17765

Browse files
committed
fix docs build - already installed packages not skipped
1 parent 8835109 commit bf17765

File tree

11 files changed

+446
-74
lines changed

11 files changed

+446
-74
lines changed

docs/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ADD MANIFEST.in ./
2323
ADD README.md ./
2424

2525
RUN pip install -e .[all]
26-
RUN python -m idom client install victory semantic-ui-react @material-ui/core
26+
RUN python -m idom install htm victory semantic-ui-react @material-ui/core
2727

2828
# Build the Docs
2929
# --------------

docs/source/examples.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Simply install your javascript library of choice using the ``idom`` CLI:
5757

5858
.. code-block:: bash
5959
60-
idom client install victory
60+
idom install victory
6161
6262
Then import the module with :class:`~idom.widgets.utils.Module`:
6363

docs/source/javascript-components.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ using the ``idom`` CLI:
3838

3939
.. code-block:: bash
4040
41-
idom client install @material-ui/core
41+
idom install @material-ui/core
4242
4343
Or at runtime with :func:`idom.client.module.install` (this is useful if you're working
4444
in a REPL or Jupyter Notebook):

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,4 @@ def test_docs(session: Session) -> None:
148148
def install_idom_dev(session: Session, extras: str = "stable") -> None:
149149
session.install("-e", f".[{extras}]")
150150
if "--no-restore" not in session.posargs:
151-
session.run("idom", "client", "restore")
151+
session.run("idom", "restore")

src/idom/cli.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,42 @@
1+
from logging.config import dictConfig
12
from typing import List
23

34
import typer
45
from rich.console import Console
56
from rich.table import Table
67

78
import idom
9+
from idom.client import _private
810
from idom.client import manage as manage_client
911

12+
from .log import logging_config_defaults
13+
1014

1115
main = typer.Typer()
1216
console = Console()
1317

14-
# --- Subcommands ---
15-
client = typer.Typer(name="client", short_help="Manage IDOM's built-in client")
16-
show = typer.Typer(name="show", short_help="Display information about IDOM")
17-
main.add_typer(client)
18-
main.add_typer(show)
18+
19+
@main.callback()
20+
def init() -> None:
21+
# reset logging config after Typer() has wrapped stdout
22+
dictConfig(logging_config_defaults())
1923

2024

21-
@client.command()
25+
@main.command()
2226
def install(packages: List[str]) -> None:
2327
"""Install a Javascript package from NPM into the client"""
2428
manage_client.build(packages, clean_build=False)
2529
return None
2630

2731

28-
@client.command()
32+
@main.command()
2933
def restore() -> None:
3034
"""Return to a fresh install of Ithe client"""
3135
manage_client.restore()
3236
return None
3337

3438

35-
@show.command()
39+
@main.command()
3640
def version(verbose: bool = False) -> None:
3741
"""Show version information"""
3842
if not verbose:
@@ -46,7 +50,7 @@ def version(verbose: bool = False) -> None:
4650

4751
table.add_row("idom", str(idom.__version__), "Python")
4852

49-
for js_pkg, js_ver in manage_client.dependency_versions().items():
53+
for js_pkg, js_ver in _private.build_dependencies().items():
5054
table.add_row(js_pkg, js_ver, "Javascript")
5155

5256
console.print(table)

src/idom/client/_private.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1+
import json
12
import re
23
import shutil
34
from pathlib import Path
4-
from typing import List, Tuple
5+
from typing import Dict, List, Tuple, cast
56

67
from idom.config import IDOM_CLIENT_BUILD_DIR
78

89

910
HERE = Path(__file__).parent
10-
11-
1211
APP_DIR = HERE / "app"
1312
BACKUP_BUILD_DIR = APP_DIR / "build"
1413

@@ -58,6 +57,11 @@ def split_package_name_and_version(pkg: str) -> Tuple[str, str]:
5857
return pkg, ""
5958

6059

60+
def build_dependencies() -> Dict[str, str]:
61+
package_json = build_dir() / "package.json"
62+
return cast(Dict[str, str], json.loads(package_json.read_text())["dependencies"])
63+
64+
6165
_JS_MODULE_EXPORT_PATTERN = re.compile(
6266
r";?\s*export\s*{([0-9a-zA-Z_$\s,]*)}\s*;", re.MULTILINE
6367
)

0 commit comments

Comments
 (0)