From 2d55cd3fc05a8642dfa1be11cbdab9294a9c774e Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Fri, 19 Dec 2025 17:35:18 +0900 Subject: [PATCH 1/5] Replace typer with click --- pyodide_lock/cli.py | 77 ++++++++++++++++++++++++++++----------------- pyproject.toml | 7 +++-- tests/test_cli.py | 3 +- tests/test_wheel.py | 2 +- 4 files changed, 56 insertions(+), 33 deletions(-) diff --git a/pyodide_lock/cli.py b/pyodide_lock/cli.py index dae782f..b778d0d 100644 --- a/pyodide_lock/cli.py +++ b/pyodide_lock/cli.py @@ -1,41 +1,60 @@ from pathlib import Path -import typer +import click from .spec import PyodideLockSpec from .utils import add_wheels_to_spec -main = typer.Typer(help="manipulate pyodide-lock.json lockfiles.") +@click.group(help="Manipulate pyodide-lock.json lockfiles.") +def main(): + """Manipulate pyodide-lock.json lockfiles.""" + pass -@main.command() + +@main.command(short_help="Add wheels to a pyodide-lock.json lockfile.") +@click.argument( + "wheels", nargs=-1, type=click.Path(exists=True, path_type=Path), required=True +) +@click.option( + "--ignore-missing-dependencies", + is_flag=True, + default=False, + help="If this is true, dependencies which are not in the original lockfile or " + "the added wheels will be added to the lockfile. Warning: This will allow a broken lockfile to be created.", +) +@click.option( + "--input", + type=click.Path(path_type=Path), + default=Path("pyodide-lock.json"), + help="Source lockfile", +) +@click.option( + "--output", + type=click.Path(path_type=Path), + default=Path("pyodide-lock-new.json"), + help="Updated lockfile", +) +@click.option( + "--base-path", + type=click.Path(path_type=Path), + default=None, + help="Base path for wheels - wheel file names will be created relative to this path.", +) +@click.option( + "--wheel-url", + type=str, + default="", + help="Base url which will be appended to the wheel location. " + "Use this if you are hosting these wheels on a different server to core pyodide packages", +) def add_wheels( - wheels: list[Path], - ignore_missing_dependencies: bool = typer.Option( - help="If this is true, dependencies " - "which are not in the original lockfile or " - "the added wheels will be added to the lockfile. " - "Warning: This will allow a broken lockfile to " - "be created.", - default=False, - ), - input: Path = typer.Option( - help="Source lockfile", default=Path("pyodide-lock.json") - ), - output: Path = typer.Option( - help="Updated lockfile", default=Path("pyodide-lock-new.json") - ), - base_path: Path = typer.Option( - help="Base path for wheels - wheel file " - "names will be created relative to this path.", - default=None, - ), - wheel_url: str = typer.Option( - help="Base url which will be appended to the wheel location." - "Use this if you are hosting these wheels on a different " - "server to core pyodide packages", - default="", - ), + wheels, + ignore_missing_dependencies, + input, + output, + base_path, + wheel_url, ): """Add a set of package wheels to an existing pyodide-lock.json and write it out to pyodide-lock-new.json diff --git a/pyproject.toml b/pyproject.toml index 87c0f4a..2b45c5e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ dynamic = ["version"] [project.optional-dependencies] cli = [ - "typer", + "click", ] wheel = [ "pkginfo", @@ -33,7 +33,7 @@ dev = [ "pytest", "pytest-cov", "build", - "typer", + "click", # from wheel "pkginfo", "packaging", @@ -77,6 +77,9 @@ select = [ "PLE", # pylint errors "UP", # pyupgrade ] +ignore = [ + "E501", # line too long +] [tool.pytest.ini_options] addopts = ''' diff --git a/tests/test_cli.py b/tests/test_cli.py index ca4cba2..401eda6 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,4 +1,4 @@ -from typer.testing import CliRunner +from click.testing import CliRunner from pyodide_lock.cli import main from pyodide_lock.spec import PyodideLockSpec @@ -15,6 +15,7 @@ def test_add_wheels_cli_integration(tmp_path, example_lock_spec, test_wheel_list result = runner.invoke( main, [ + "add-wheels", str(test_wheel_list[0]), "--input", str(input_file), diff --git a/tests/test_wheel.py b/tests/test_wheel.py index f512b03..bd95e06 100644 --- a/tests/test_wheel.py +++ b/tests/test_wheel.py @@ -79,7 +79,7 @@ def test_base_relative_path(test_wheel_list, example_lock_spec): assert "needs-one" in example_lock_spec.packages assert "needs-one-opt" in example_lock_spec.packages assert example_lock_spec.packages["needs-one-opt"].file_name.startswith( - "http://www.nowhere.org/dist/nEEds" + "http://www.nowhere.org/dist/needs" ) From b0b8a76d135cf64bdfb76d62d1c0b725cc1025d7 Mon Sep 17 00:00:00 2001 From: ryanking13 Date: Fri, 2 Jan 2026 15:26:05 +0900 Subject: [PATCH 2/5] Address comment --- pyodide_lock/cli.py | 4 ++++ pyproject.toml | 1 + 2 files changed, 5 insertions(+) diff --git a/pyodide_lock/cli.py b/pyodide_lock/cli.py index b778d0d..d8ebe8b 100644 --- a/pyodide_lock/cli.py +++ b/pyodide_lock/cli.py @@ -64,6 +64,10 @@ def add_wheels( this will fail if a dependency isn't available in either the existing lock file, or in the set of new wheels. + \b + Arguments: + WHEELS: List of paths to wheel files. (required) + """ sp = PyodideLockSpec.from_json(input) sp = add_wheels_to_spec( diff --git a/pyproject.toml b/pyproject.toml index 2b45c5e..f630bb7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ dynamic = ["version"] [project.optional-dependencies] cli = [ "click", + "pyodide-cli", ] wheel = [ "pkginfo", From d9a128fb27aa31c51cbcd9417043e7a292597edf Mon Sep 17 00:00:00 2001 From: ryanking13 Date: Fri, 2 Jan 2026 15:26:21 +0900 Subject: [PATCH 3/5] Fix pyodide-cli version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f630bb7..a8098c1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ dynamic = ["version"] [project.optional-dependencies] cli = [ "click", - "pyodide-cli", + "pyodide-cli>=0.4.0", ] wheel = [ "pkginfo", From b7a4ee9191bf6ebb50344f30f0c72c7d041891c5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 2 Jan 2026 06:26:39 +0000 Subject: [PATCH 4/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyodide_lock/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyodide_lock/cli.py b/pyodide_lock/cli.py index d8ebe8b..5b08cca 100644 --- a/pyodide_lock/cli.py +++ b/pyodide_lock/cli.py @@ -67,7 +67,7 @@ def add_wheels( \b Arguments: WHEELS: List of paths to wheel files. (required) - + """ sp = PyodideLockSpec.from_json(input) sp = add_wheels_to_spec( From 5d34bffb0ad383043307506cedbee18b067eea63 Mon Sep 17 00:00:00 2001 From: ryanking13 Date: Fri, 2 Jan 2026 15:29:08 +0900 Subject: [PATCH 5/5] changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1a039f..5bab48f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +## [0.1.1] - 2026-01-02 + +Dropped `typer` dependency for CLI. +[#39](https://github.com/pyodide/pyodide-lock/pull/39) + ## [0.1.0] - 2025-08-16 No functional changes. pyodide-lock is no longer an alpha version.