From 7609b70d8d9fa28f2c71d3ab7cbabc4ba49c67c3 Mon Sep 17 00:00:00 2001 From: Trevor Manz Date: Mon, 28 Oct 2024 17:26:49 -0400 Subject: [PATCH 1/5] Add PEP 735 dependency groups with instructions for how to use uv --- .../__snapshots__/index.test.js.snap | 330 ++++++++++++++---- packages/create-anywidget/create.js | 33 +- 2 files changed, 286 insertions(+), 77 deletions(-) diff --git a/packages/create-anywidget/__tests__/__snapshots__/index.test.js.snap b/packages/create-anywidget/__tests__/__snapshots__/index.test.js.snap index 70eb09e2..a5160fde 100644 --- a/packages/create-anywidget/__tests__/__snapshots__/index.test.js.snap +++ b/packages/create-anywidget/__tests__/__snapshots__/index.test.js.snap @@ -11,10 +11,26 @@ exports[`create-anywidget (Bun) > template-react 1`] = ` pip install ipyfoo \`\`\` -## Development installation +or with [uv](https://github.com/astral-sh/uv): -Create a virtual environment and and install ipyfoo in *editable* mode with the -optional development dependencies: +\`\`\`sh +uv add ipyfoo +uv add --script foo.py ipyfoo # add to a standalone script +\`\`\` + +## Development + +We recommend using [uv](https://github.com/astral-sh/uv) for development. +It will automatically manage virtual environments and dependencies for you. + +\`\`\` +uv run jupyter lab example.ipynb +\`\`\` + +You can create a .venv for your editor with \`uv sync\`. + +Alternatively, you can create a virtual environment and install the package in +*editable* mode with the optional development dependencies: \`\`\`sh python -m venv .venv @@ -104,18 +120,21 @@ src/ipyfoo/static requires = ["hatchling"] build-backend = "hatchling.build" -[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] readme = "README.md" +# For projects not using \`uv\`, you can install these development dependencies with: +# \`pip install -e ".[dev]"\` +# If you're using \`uv\` for development, feel free to remove this section. [project.optional-dependencies] dev = ["watchfiles", "jupyterlab"] -# automatically add the dev feature to the default env (e.g., hatch shell) -[tool.hatch.envs.default] -features = ["dev"] +# Dependency groups (recognized by \`uv\`). For more details, visit: +# https://peps.python.org/pep-0735/ +[dependency-groups] +dev = ["watchfiles", "jupyterlab"] [tool.hatch.build] @@ -215,10 +234,26 @@ exports[`create-anywidget (Bun) > template-react-ts 1`] = ` pip install ipyfoo \`\`\` -## Development installation +or with [uv](https://github.com/astral-sh/uv): + +\`\`\`sh +uv add ipyfoo +uv add --script foo.py ipyfoo # add to a standalone script +\`\`\` -Create a virtual environment and and install ipyfoo in *editable* mode with the -optional development dependencies: +## Development + +We recommend using [uv](https://github.com/astral-sh/uv) for development. +It will automatically manage virtual environments and dependencies for you. + +\`\`\` +uv run jupyter lab example.ipynb +\`\`\` + +You can create a .venv for your editor with \`uv sync\`. + +Alternatively, you can create a virtual environment and install the package in +*editable* mode with the optional development dependencies: \`\`\`sh python -m venv .venv @@ -313,18 +348,21 @@ src/ipyfoo/static requires = ["hatchling"] build-backend = "hatchling.build" -[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] readme = "README.md" +# For projects not using \`uv\`, you can install these development dependencies with: +# \`pip install -e ".[dev]"\` +# If you're using \`uv\` for development, feel free to remove this section. [project.optional-dependencies] dev = ["watchfiles", "jupyterlab"] -# automatically add the dev feature to the default env (e.g., hatch shell) -[tool.hatch.envs.default] -features = ["dev"] +# Dependency groups (recognized by \`uv\`). For more details, visit: +# https://peps.python.org/pep-0735/ +[dependency-groups] +dev = ["watchfiles", "jupyterlab"] [tool.hatch.build] @@ -452,10 +490,26 @@ exports[`create-anywidget (Bun) > template-vanilla 1`] = ` pip install ipyfoo \`\`\` -## Development installation +or with [uv](https://github.com/astral-sh/uv): + +\`\`\`sh +uv add ipyfoo +uv add --script foo.py ipyfoo # add to a standalone script +\`\`\` + +## Development + +We recommend using [uv](https://github.com/astral-sh/uv) for development. +It will automatically manage virtual environments and dependencies for you. + +\`\`\` +uv run jupyter lab example.ipynb +\`\`\` + +You can create a .venv for your editor with \`uv sync\`. -Create a virtual environment and and install ipyfoo in *editable* mode with the -optional development dependencies: +Alternatively, you can create a virtual environment and install the package in +*editable* mode with the optional development dependencies: \`\`\`sh python -m venv .venv @@ -541,18 +595,21 @@ src/ipyfoo/static requires = ["hatchling"] build-backend = "hatchling.build" -[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] readme = "README.md" +# For projects not using \`uv\`, you can install these development dependencies with: +# \`pip install -e ".[dev]"\` +# If you're using \`uv\` for development, feel free to remove this section. [project.optional-dependencies] dev = ["watchfiles", "jupyterlab"] -# automatically add the dev feature to the default env (e.g., hatch shell) -[tool.hatch.envs.default] -features = ["dev"] +# Dependency groups (recognized by \`uv\`). For more details, visit: +# https://peps.python.org/pep-0735/ +[dependency-groups] +dev = ["watchfiles", "jupyterlab"] [tool.hatch.build] @@ -653,10 +710,26 @@ exports[`create-anywidget (Bun) > template-vanilla-deno-jsdoc 1`] = ` pip install ipyfoo \`\`\` -## Development installation +or with [uv](https://github.com/astral-sh/uv): + +\`\`\`sh +uv add ipyfoo +uv add --script foo.py ipyfoo # add to a standalone script +\`\`\` + +## Development + +We recommend using [uv](https://github.com/astral-sh/uv) for development. +It will automatically manage virtual environments and dependencies for you. + +\`\`\` +uv run jupyter lab example.ipynb +\`\`\` -Create a virtual environment and and install ipyfoo in *editable* mode with the -optional development dependencies: +You can create a .venv for your editor with \`uv sync\`. + +Alternatively, you can create a virtual environment and install the package in +*editable* mode with the optional development dependencies: \`\`\`sh python -m venv .venv @@ -710,18 +783,21 @@ in the notebook. requires = ["hatchling"] build-backend = "hatchling.build" -[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] readme = "README.md" +# For projects not using \`uv\`, you can install these development dependencies with: +# \`pip install -e ".[dev]"\` +# If you're using \`uv\` for development, feel free to remove this section. [project.optional-dependencies] dev = ["watchfiles", "jupyterlab"] -# automatically add the dev feature to the default env (e.g., hatch shell) -[tool.hatch.envs.default] -features = ["dev"] +# Dependency groups (recognized by \`uv\`). For more details, visit: +# https://peps.python.org/pep-0735/ +[dependency-groups] +dev = ["watchfiles", "jupyterlab"] ", "path": "pyproject.toml", }, @@ -850,10 +926,26 @@ exports[`create-anywidget (Bun) > template-vanilla-ts 1`] = ` pip install ipyfoo \`\`\` -## Development installation +or with [uv](https://github.com/astral-sh/uv): + +\`\`\`sh +uv add ipyfoo +uv add --script foo.py ipyfoo # add to a standalone script +\`\`\` + +## Development -Create a virtual environment and and install ipyfoo in *editable* mode with the -optional development dependencies: +We recommend using [uv](https://github.com/astral-sh/uv) for development. +It will automatically manage virtual environments and dependencies for you. + +\`\`\` +uv run jupyter lab example.ipynb +\`\`\` + +You can create a .venv for your editor with \`uv sync\`. + +Alternatively, you can create a virtual environment and install the package in +*editable* mode with the optional development dependencies: \`\`\`sh python -m venv .venv @@ -943,18 +1035,21 @@ src/ipyfoo/static requires = ["hatchling"] build-backend = "hatchling.build" -[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] readme = "README.md" +# For projects not using \`uv\`, you can install these development dependencies with: +# \`pip install -e ".[dev]"\` +# If you're using \`uv\` for development, feel free to remove this section. [project.optional-dependencies] dev = ["watchfiles", "jupyterlab"] -# automatically add the dev feature to the default env (e.g., hatch shell) -[tool.hatch.envs.default] -features = ["dev"] +# Dependency groups (recognized by \`uv\`). For more details, visit: +# https://peps.python.org/pep-0735/ +[dependency-groups] +dev = ["watchfiles", "jupyterlab"] [tool.hatch.build] @@ -1090,10 +1185,26 @@ exports[`create-anywidget > template-react 1`] = ` pip install ipyfoo \`\`\` -## Development installation +or with [uv](https://github.com/astral-sh/uv): -Create a virtual environment and and install ipyfoo in *editable* mode with the -optional development dependencies: +\`\`\`sh +uv add ipyfoo +uv add --script foo.py ipyfoo # add to a standalone script +\`\`\` + +## Development + +We recommend using [uv](https://github.com/astral-sh/uv) for development. +It will automatically manage virtual environments and dependencies for you. + +\`\`\` +uv run jupyter lab example.ipynb +\`\`\` + +You can create a .venv for your editor with \`uv sync\`. + +Alternatively, you can create a virtual environment and install the package in +*editable* mode with the optional development dependencies: \`\`\`sh python -m venv .venv @@ -1185,18 +1296,21 @@ src/ipyfoo/static requires = ["hatchling"] build-backend = "hatchling.build" -[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] readme = "README.md" +# For projects not using \`uv\`, you can install these development dependencies with: +# \`pip install -e ".[dev]"\` +# If you're using \`uv\` for development, feel free to remove this section. [project.optional-dependencies] dev = ["watchfiles", "jupyterlab"] -# automatically add the dev feature to the default env (e.g., hatch shell) -[tool.hatch.envs.default] -features = ["dev"] +# Dependency groups (recognized by \`uv\`). For more details, visit: +# https://peps.python.org/pep-0735/ +[dependency-groups] +dev = ["watchfiles", "jupyterlab"] [tool.hatch.build] @@ -1296,10 +1410,26 @@ exports[`create-anywidget > template-react-ts 1`] = ` pip install ipyfoo \`\`\` -## Development installation +or with [uv](https://github.com/astral-sh/uv): + +\`\`\`sh +uv add ipyfoo +uv add --script foo.py ipyfoo # add to a standalone script +\`\`\` -Create a virtual environment and and install ipyfoo in *editable* mode with the -optional development dependencies: +## Development + +We recommend using [uv](https://github.com/astral-sh/uv) for development. +It will automatically manage virtual environments and dependencies for you. + +\`\`\` +uv run jupyter lab example.ipynb +\`\`\` + +You can create a .venv for your editor with \`uv sync\`. + +Alternatively, you can create a virtual environment and install the package in +*editable* mode with the optional development dependencies: \`\`\`sh python -m venv .venv @@ -1395,18 +1525,21 @@ src/ipyfoo/static requires = ["hatchling"] build-backend = "hatchling.build" -[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] readme = "README.md" +# For projects not using \`uv\`, you can install these development dependencies with: +# \`pip install -e ".[dev]"\` +# If you're using \`uv\` for development, feel free to remove this section. [project.optional-dependencies] dev = ["watchfiles", "jupyterlab"] -# automatically add the dev feature to the default env (e.g., hatch shell) -[tool.hatch.envs.default] -features = ["dev"] +# Dependency groups (recognized by \`uv\`). For more details, visit: +# https://peps.python.org/pep-0735/ +[dependency-groups] +dev = ["watchfiles", "jupyterlab"] [tool.hatch.build] @@ -1534,10 +1667,26 @@ exports[`create-anywidget > template-vanilla 1`] = ` pip install ipyfoo \`\`\` -## Development installation +or with [uv](https://github.com/astral-sh/uv): + +\`\`\`sh +uv add ipyfoo +uv add --script foo.py ipyfoo # add to a standalone script +\`\`\` + +## Development + +We recommend using [uv](https://github.com/astral-sh/uv) for development. +It will automatically manage virtual environments and dependencies for you. + +\`\`\` +uv run jupyter lab example.ipynb +\`\`\` + +You can create a .venv for your editor with \`uv sync\`. -Create a virtual environment and and install ipyfoo in *editable* mode with the -optional development dependencies: +Alternatively, you can create a virtual environment and install the package in +*editable* mode with the optional development dependencies: \`\`\`sh python -m venv .venv @@ -1625,18 +1774,21 @@ src/ipyfoo/static requires = ["hatchling"] build-backend = "hatchling.build" -[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] readme = "README.md" +# For projects not using \`uv\`, you can install these development dependencies with: +# \`pip install -e ".[dev]"\` +# If you're using \`uv\` for development, feel free to remove this section. [project.optional-dependencies] dev = ["watchfiles", "jupyterlab"] -# automatically add the dev feature to the default env (e.g., hatch shell) -[tool.hatch.envs.default] -features = ["dev"] +# Dependency groups (recognized by \`uv\`). For more details, visit: +# https://peps.python.org/pep-0735/ +[dependency-groups] +dev = ["watchfiles", "jupyterlab"] [tool.hatch.build] @@ -1737,10 +1889,26 @@ exports[`create-anywidget > template-vanilla-deno-jsdoc 1`] = ` pip install ipyfoo \`\`\` -## Development installation +or with [uv](https://github.com/astral-sh/uv): + +\`\`\`sh +uv add ipyfoo +uv add --script foo.py ipyfoo # add to a standalone script +\`\`\` + +## Development + +We recommend using [uv](https://github.com/astral-sh/uv) for development. +It will automatically manage virtual environments and dependencies for you. + +\`\`\` +uv run jupyter lab example.ipynb +\`\`\` -Create a virtual environment and and install ipyfoo in *editable* mode with the -optional development dependencies: +You can create a .venv for your editor with \`uv sync\`. + +Alternatively, you can create a virtual environment and install the package in +*editable* mode with the optional development dependencies: \`\`\`sh python -m venv .venv @@ -1794,18 +1962,21 @@ in the notebook. requires = ["hatchling"] build-backend = "hatchling.build" -[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] readme = "README.md" +# For projects not using \`uv\`, you can install these development dependencies with: +# \`pip install -e ".[dev]"\` +# If you're using \`uv\` for development, feel free to remove this section. [project.optional-dependencies] dev = ["watchfiles", "jupyterlab"] -# automatically add the dev feature to the default env (e.g., hatch shell) -[tool.hatch.envs.default] -features = ["dev"] +# Dependency groups (recognized by \`uv\`). For more details, visit: +# https://peps.python.org/pep-0735/ +[dependency-groups] +dev = ["watchfiles", "jupyterlab"] ", "path": "pyproject.toml", }, @@ -1934,10 +2105,26 @@ exports[`create-anywidget > template-vanilla-ts 1`] = ` pip install ipyfoo \`\`\` -## Development installation +or with [uv](https://github.com/astral-sh/uv): + +\`\`\`sh +uv add ipyfoo +uv add --script foo.py ipyfoo # add to a standalone script +\`\`\` + +## Development -Create a virtual environment and and install ipyfoo in *editable* mode with the -optional development dependencies: +We recommend using [uv](https://github.com/astral-sh/uv) for development. +It will automatically manage virtual environments and dependencies for you. + +\`\`\` +uv run jupyter lab example.ipynb +\`\`\` + +You can create a .venv for your editor with \`uv sync\`. + +Alternatively, you can create a virtual environment and install the package in +*editable* mode with the optional development dependencies: \`\`\`sh python -m venv .venv @@ -2028,18 +2215,21 @@ src/ipyfoo/static requires = ["hatchling"] build-backend = "hatchling.build" -[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] readme = "README.md" +# For projects not using \`uv\`, you can install these development dependencies with: +# \`pip install -e ".[dev]"\` +# If you're using \`uv\` for development, feel free to remove this section. [project.optional-dependencies] dev = ["watchfiles", "jupyterlab"] -# automatically add the dev feature to the default env (e.g., hatch shell) -[tool.hatch.envs.default] -features = ["dev"] +# Dependency groups (recognized by \`uv\`). For more details, visit: +# https://peps.python.org/pep-0735/ +[dependency-groups] +dev = ["watchfiles", "jupyterlab"] [tool.hatch.build] diff --git a/packages/create-anywidget/create.js b/packages/create-anywidget/create.js index ec2f529b..ac77a4e5 100644 --- a/packages/create-anywidget/create.js +++ b/packages/create-anywidget/create.js @@ -75,18 +75,21 @@ let pyproject_toml = (name) => requires = ["hatchling"] build-backend = "hatchling.build" -[project] name = "${name}" version = "0.0.0" dependencies = ["anywidget"] readme = "README.md" +# For projects not using \`uv\`, you can install these development dependencies with: +# \`pip install -e ".[dev]"\` +# If you're using \`uv\` for development, feel free to remove this section. [project.optional-dependencies] dev = ["watchfiles", "jupyterlab"] -# automatically add the dev feature to the default env (e.g., hatch shell) -[tool.hatch.envs.default] -features = ["dev"] +# Dependency groups (recognized by \`uv\`). For more details, visit: +# https://peps.python.org/pep-0735/ +[dependency-groups] +dev = ["watchfiles", "jupyterlab"] `; /** @@ -160,10 +163,26 @@ let readme = (name, type = "bundled") => { pip install ${name} \`\`\` -## Development installation +or with [uv](https://github.com/astral-sh/uv): + +\`\`\`sh +uv add ${name} +uv add --script foo.py ${name} # add to a standalone script +\`\`\` + +## Development + +We recommend using [uv](https://github.com/astral-sh/uv) for development. +It will automatically manage virtual environments and dependencies for you. + +\`\`\` +uv run jupyter lab example.ipynb +\`\`\` + +You can create a .venv for your editor with \`uv sync\`. -Create a virtual environment and and install ${name} in *editable* mode with the -optional development dependencies: +Alternatively, you can create a virtual environment and install the package in +*editable* mode with the optional development dependencies: \`\`\`sh python -m venv .venv From 2ef195d748d2031a91bc30166e9cb9cbac5e6310 Mon Sep 17 00:00:00 2001 From: Trevor Manz Date: Mon, 28 Oct 2024 17:27:32 -0400 Subject: [PATCH 2/5] Add changeset --- .changeset/brown-cougars-cover.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/brown-cougars-cover.md diff --git a/.changeset/brown-cougars-cover.md b/.changeset/brown-cougars-cover.md new file mode 100644 index 00000000..abf670f4 --- /dev/null +++ b/.changeset/brown-cougars-cover.md @@ -0,0 +1,5 @@ +--- +"create-anywidget": patch +--- + +Support `uv` and update project instructions From f7d499b176ebccca914281e716779bffd3428459 Mon Sep 17 00:00:00 2001 From: Trevor Manz Date: Mon, 28 Oct 2024 17:28:44 -0400 Subject: [PATCH 3/5] fix: Add project field --- .../__tests__/__snapshots__/index.test.js.snap | 10 ++++++++++ packages/create-anywidget/create.js | 1 + 2 files changed, 11 insertions(+) diff --git a/packages/create-anywidget/__tests__/__snapshots__/index.test.js.snap b/packages/create-anywidget/__tests__/__snapshots__/index.test.js.snap index a5160fde..c6c50255 100644 --- a/packages/create-anywidget/__tests__/__snapshots__/index.test.js.snap +++ b/packages/create-anywidget/__tests__/__snapshots__/index.test.js.snap @@ -120,6 +120,7 @@ src/ipyfoo/static requires = ["hatchling"] build-backend = "hatchling.build" +[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] @@ -348,6 +349,7 @@ src/ipyfoo/static requires = ["hatchling"] build-backend = "hatchling.build" +[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] @@ -595,6 +597,7 @@ src/ipyfoo/static requires = ["hatchling"] build-backend = "hatchling.build" +[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] @@ -783,6 +786,7 @@ in the notebook. requires = ["hatchling"] build-backend = "hatchling.build" +[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] @@ -1035,6 +1039,7 @@ src/ipyfoo/static requires = ["hatchling"] build-backend = "hatchling.build" +[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] @@ -1296,6 +1301,7 @@ src/ipyfoo/static requires = ["hatchling"] build-backend = "hatchling.build" +[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] @@ -1525,6 +1531,7 @@ src/ipyfoo/static requires = ["hatchling"] build-backend = "hatchling.build" +[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] @@ -1774,6 +1781,7 @@ src/ipyfoo/static requires = ["hatchling"] build-backend = "hatchling.build" +[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] @@ -1962,6 +1970,7 @@ in the notebook. requires = ["hatchling"] build-backend = "hatchling.build" +[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] @@ -2215,6 +2224,7 @@ src/ipyfoo/static requires = ["hatchling"] build-backend = "hatchling.build" +[project] name = "ipyfoo" version = "0.0.0" dependencies = ["anywidget"] diff --git a/packages/create-anywidget/create.js b/packages/create-anywidget/create.js index ac77a4e5..a5f07f9b 100644 --- a/packages/create-anywidget/create.js +++ b/packages/create-anywidget/create.js @@ -75,6 +75,7 @@ let pyproject_toml = (name) => requires = ["hatchling"] build-backend = "hatchling.build" +[project] name = "${name}" version = "0.0.0" dependencies = ["anywidget"] From 00b105ada05671fadcd718a5b279b8fcf8ec4a76 Mon Sep 17 00:00:00 2001 From: Trevor Manz Date: Mon, 28 Oct 2024 17:33:54 -0400 Subject: [PATCH 4/5] Update instructions --- .../__snapshots__/index.test.js.snap | 90 +++++++------------ packages/create-anywidget/create.js | 9 +- 2 files changed, 33 insertions(+), 66 deletions(-) diff --git a/packages/create-anywidget/__tests__/__snapshots__/index.test.js.snap b/packages/create-anywidget/__tests__/__snapshots__/index.test.js.snap index c6c50255..85abd94c 100644 --- a/packages/create-anywidget/__tests__/__snapshots__/index.test.js.snap +++ b/packages/create-anywidget/__tests__/__snapshots__/index.test.js.snap @@ -15,7 +15,6 @@ or with [uv](https://github.com/astral-sh/uv): \`\`\`sh uv add ipyfoo -uv add --script foo.py ipyfoo # add to a standalone script \`\`\` ## Development @@ -23,19 +22,17 @@ uv add --script foo.py ipyfoo # add to a standalone script We recommend using [uv](https://github.com/astral-sh/uv) for development. It will automatically manage virtual environments and dependencies for you. -\`\`\` +\`\`\`sh uv run jupyter lab example.ipynb \`\`\` -You can create a .venv for your editor with \`uv sync\`. - -Alternatively, you can create a virtual environment and install the package in -*editable* mode with the optional development dependencies: +Alternatively, create and manage your own virtual environment: \`\`\`sh python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" +jupyter lab \`\`\` You then need to install the JavaScript dependencies and run the development server. @@ -239,7 +236,6 @@ or with [uv](https://github.com/astral-sh/uv): \`\`\`sh uv add ipyfoo -uv add --script foo.py ipyfoo # add to a standalone script \`\`\` ## Development @@ -247,19 +243,17 @@ uv add --script foo.py ipyfoo # add to a standalone script We recommend using [uv](https://github.com/astral-sh/uv) for development. It will automatically manage virtual environments and dependencies for you. -\`\`\` +\`\`\`sh uv run jupyter lab example.ipynb \`\`\` -You can create a .venv for your editor with \`uv sync\`. - -Alternatively, you can create a virtual environment and install the package in -*editable* mode with the optional development dependencies: +Alternatively, create and manage your own virtual environment: \`\`\`sh python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" +jupyter lab \`\`\` You then need to install the JavaScript dependencies and run the development server. @@ -496,7 +490,6 @@ or with [uv](https://github.com/astral-sh/uv): \`\`\`sh uv add ipyfoo -uv add --script foo.py ipyfoo # add to a standalone script \`\`\` ## Development @@ -504,19 +497,17 @@ uv add --script foo.py ipyfoo # add to a standalone script We recommend using [uv](https://github.com/astral-sh/uv) for development. It will automatically manage virtual environments and dependencies for you. -\`\`\` +\`\`\`sh uv run jupyter lab example.ipynb \`\`\` -You can create a .venv for your editor with \`uv sync\`. - -Alternatively, you can create a virtual environment and install the package in -*editable* mode with the optional development dependencies: +Alternatively, create and manage your own virtual environment: \`\`\`sh python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" +jupyter lab \`\`\` You then need to install the JavaScript dependencies and run the development server. @@ -717,7 +708,6 @@ or with [uv](https://github.com/astral-sh/uv): \`\`\`sh uv add ipyfoo -uv add --script foo.py ipyfoo # add to a standalone script \`\`\` ## Development @@ -725,19 +715,17 @@ uv add --script foo.py ipyfoo # add to a standalone script We recommend using [uv](https://github.com/astral-sh/uv) for development. It will automatically manage virtual environments and dependencies for you. -\`\`\` +\`\`\`sh uv run jupyter lab example.ipynb \`\`\` -You can create a .venv for your editor with \`uv sync\`. - -Alternatively, you can create a virtual environment and install the package in -*editable* mode with the optional development dependencies: +Alternatively, create and manage your own virtual environment: \`\`\`sh python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" +jupyter lab \`\`\` Open \`example.ipynb\` in JupyterLab, VS Code, or your favorite editor @@ -934,7 +922,6 @@ or with [uv](https://github.com/astral-sh/uv): \`\`\`sh uv add ipyfoo -uv add --script foo.py ipyfoo # add to a standalone script \`\`\` ## Development @@ -942,19 +929,17 @@ uv add --script foo.py ipyfoo # add to a standalone script We recommend using [uv](https://github.com/astral-sh/uv) for development. It will automatically manage virtual environments and dependencies for you. -\`\`\` +\`\`\`sh uv run jupyter lab example.ipynb \`\`\` -You can create a .venv for your editor with \`uv sync\`. - -Alternatively, you can create a virtual environment and install the package in -*editable* mode with the optional development dependencies: +Alternatively, create and manage your own virtual environment: \`\`\`sh python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" +jupyter lab \`\`\` You then need to install the JavaScript dependencies and run the development server. @@ -1194,7 +1179,6 @@ or with [uv](https://github.com/astral-sh/uv): \`\`\`sh uv add ipyfoo -uv add --script foo.py ipyfoo # add to a standalone script \`\`\` ## Development @@ -1202,19 +1186,17 @@ uv add --script foo.py ipyfoo # add to a standalone script We recommend using [uv](https://github.com/astral-sh/uv) for development. It will automatically manage virtual environments and dependencies for you. -\`\`\` +\`\`\`sh uv run jupyter lab example.ipynb \`\`\` -You can create a .venv for your editor with \`uv sync\`. - -Alternatively, you can create a virtual environment and install the package in -*editable* mode with the optional development dependencies: +Alternatively, create and manage your own virtual environment: \`\`\`sh python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" +jupyter lab \`\`\` You then need to install the JavaScript dependencies and run the development server. @@ -1420,7 +1402,6 @@ or with [uv](https://github.com/astral-sh/uv): \`\`\`sh uv add ipyfoo -uv add --script foo.py ipyfoo # add to a standalone script \`\`\` ## Development @@ -1428,19 +1409,17 @@ uv add --script foo.py ipyfoo # add to a standalone script We recommend using [uv](https://github.com/astral-sh/uv) for development. It will automatically manage virtual environments and dependencies for you. -\`\`\` +\`\`\`sh uv run jupyter lab example.ipynb \`\`\` -You can create a .venv for your editor with \`uv sync\`. - -Alternatively, you can create a virtual environment and install the package in -*editable* mode with the optional development dependencies: +Alternatively, create and manage your own virtual environment: \`\`\`sh python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" +jupyter lab \`\`\` You then need to install the JavaScript dependencies and run the development server. @@ -1678,7 +1657,6 @@ or with [uv](https://github.com/astral-sh/uv): \`\`\`sh uv add ipyfoo -uv add --script foo.py ipyfoo # add to a standalone script \`\`\` ## Development @@ -1686,19 +1664,17 @@ uv add --script foo.py ipyfoo # add to a standalone script We recommend using [uv](https://github.com/astral-sh/uv) for development. It will automatically manage virtual environments and dependencies for you. -\`\`\` +\`\`\`sh uv run jupyter lab example.ipynb \`\`\` -You can create a .venv for your editor with \`uv sync\`. - -Alternatively, you can create a virtual environment and install the package in -*editable* mode with the optional development dependencies: +Alternatively, create and manage your own virtual environment: \`\`\`sh python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" +jupyter lab \`\`\` You then need to install the JavaScript dependencies and run the development server. @@ -1901,7 +1877,6 @@ or with [uv](https://github.com/astral-sh/uv): \`\`\`sh uv add ipyfoo -uv add --script foo.py ipyfoo # add to a standalone script \`\`\` ## Development @@ -1909,19 +1884,17 @@ uv add --script foo.py ipyfoo # add to a standalone script We recommend using [uv](https://github.com/astral-sh/uv) for development. It will automatically manage virtual environments and dependencies for you. -\`\`\` +\`\`\`sh uv run jupyter lab example.ipynb \`\`\` -You can create a .venv for your editor with \`uv sync\`. - -Alternatively, you can create a virtual environment and install the package in -*editable* mode with the optional development dependencies: +Alternatively, create and manage your own virtual environment: \`\`\`sh python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" +jupyter lab \`\`\` Open \`example.ipynb\` in JupyterLab, VS Code, or your favorite editor @@ -2118,7 +2091,6 @@ or with [uv](https://github.com/astral-sh/uv): \`\`\`sh uv add ipyfoo -uv add --script foo.py ipyfoo # add to a standalone script \`\`\` ## Development @@ -2126,19 +2098,17 @@ uv add --script foo.py ipyfoo # add to a standalone script We recommend using [uv](https://github.com/astral-sh/uv) for development. It will automatically manage virtual environments and dependencies for you. -\`\`\` +\`\`\`sh uv run jupyter lab example.ipynb \`\`\` -You can create a .venv for your editor with \`uv sync\`. - -Alternatively, you can create a virtual environment and install the package in -*editable* mode with the optional development dependencies: +Alternatively, create and manage your own virtual environment: \`\`\`sh python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" +jupyter lab \`\`\` You then need to install the JavaScript dependencies and run the development server. diff --git a/packages/create-anywidget/create.js b/packages/create-anywidget/create.js index a5f07f9b..4d013e00 100644 --- a/packages/create-anywidget/create.js +++ b/packages/create-anywidget/create.js @@ -168,7 +168,6 @@ or with [uv](https://github.com/astral-sh/uv): \`\`\`sh uv add ${name} -uv add --script foo.py ${name} # add to a standalone script \`\`\` ## Development @@ -176,19 +175,17 @@ uv add --script foo.py ${name} # add to a standalone script We recommend using [uv](https://github.com/astral-sh/uv) for development. It will automatically manage virtual environments and dependencies for you. -\`\`\` +\`\`\`sh uv run jupyter lab example.ipynb \`\`\` -You can create a .venv for your editor with \`uv sync\`. - -Alternatively, you can create a virtual environment and install the package in -*editable* mode with the optional development dependencies: +Alternatively, create and manage your own virtual environment: \`\`\`sh python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" +jupyter lab \`\`\` `; From 153e1a4bed70b55fbf89e611d6bfd81abb842503 Mon Sep 17 00:00:00 2001 From: Trevor Manz Date: Mon, 28 Oct 2024 17:44:35 -0400 Subject: [PATCH 5/5] update readme --- .../__snapshots__/index.test.js.snap | 92 +++++++++++++++---- packages/create-anywidget/create.js | 11 ++- 2 files changed, 83 insertions(+), 20 deletions(-) diff --git a/packages/create-anywidget/__tests__/__snapshots__/index.test.js.snap b/packages/create-anywidget/__tests__/__snapshots__/index.test.js.snap index 85abd94c..308017a8 100644 --- a/packages/create-anywidget/__tests__/__snapshots__/index.test.js.snap +++ b/packages/create-anywidget/__tests__/__snapshots__/index.test.js.snap @@ -32,13 +32,20 @@ Alternatively, create and manage your own virtual environment: python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" -jupyter lab +jupyter lab example.ipynb \`\`\` -You then need to install the JavaScript dependencies and run the development server. +The widget front-end code bundles it's JavaScript dependencies. After setting up Python, +make sure to install these dependencies locally: \`\`\`sh npm install +\`\`\` + +While developing, you can run the following in a separate terminal to automatically +rebuild JavaScript as you make changes: + +\`\`\`sh npm run dev \`\`\` @@ -253,13 +260,20 @@ Alternatively, create and manage your own virtual environment: python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" -jupyter lab +jupyter lab example.ipynb \`\`\` -You then need to install the JavaScript dependencies and run the development server. +The widget front-end code bundles it's JavaScript dependencies. After setting up Python, +make sure to install these dependencies locally: \`\`\`sh npm install +\`\`\` + +While developing, you can run the following in a separate terminal to automatically +rebuild JavaScript as you make changes: + +\`\`\`sh npm run dev \`\`\` @@ -507,13 +521,20 @@ Alternatively, create and manage your own virtual environment: python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" -jupyter lab +jupyter lab example.ipynb \`\`\` -You then need to install the JavaScript dependencies and run the development server. +The widget front-end code bundles it's JavaScript dependencies. After setting up Python, +make sure to install these dependencies locally: \`\`\`sh npm install +\`\`\` + +While developing, you can run the following in a separate terminal to automatically +rebuild JavaScript as you make changes: + +\`\`\`sh npm run dev \`\`\` @@ -725,7 +746,7 @@ Alternatively, create and manage your own virtual environment: python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" -jupyter lab +jupyter lab example.ipynb \`\`\` Open \`example.ipynb\` in JupyterLab, VS Code, or your favorite editor @@ -939,13 +960,20 @@ Alternatively, create and manage your own virtual environment: python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" -jupyter lab +jupyter lab example.ipynb \`\`\` -You then need to install the JavaScript dependencies and run the development server. +The widget front-end code bundles it's JavaScript dependencies. After setting up Python, +make sure to install these dependencies locally: \`\`\`sh npm install +\`\`\` + +While developing, you can run the following in a separate terminal to automatically +rebuild JavaScript as you make changes: + +\`\`\`sh npm run dev \`\`\` @@ -1196,13 +1224,20 @@ Alternatively, create and manage your own virtual environment: python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" -jupyter lab +jupyter lab example.ipynb \`\`\` -You then need to install the JavaScript dependencies and run the development server. +The widget front-end code bundles it's JavaScript dependencies. After setting up Python, +make sure to install these dependencies locally: \`\`\`sh npm install +\`\`\` + +While developing, you can run the following in a separate terminal to automatically +rebuild JavaScript as you make changes: + +\`\`\`sh npm run dev \`\`\` @@ -1419,13 +1454,20 @@ Alternatively, create and manage your own virtual environment: python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" -jupyter lab +jupyter lab example.ipynb \`\`\` -You then need to install the JavaScript dependencies and run the development server. +The widget front-end code bundles it's JavaScript dependencies. After setting up Python, +make sure to install these dependencies locally: \`\`\`sh npm install +\`\`\` + +While developing, you can run the following in a separate terminal to automatically +rebuild JavaScript as you make changes: + +\`\`\`sh npm run dev \`\`\` @@ -1674,13 +1716,20 @@ Alternatively, create and manage your own virtual environment: python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" -jupyter lab +jupyter lab example.ipynb \`\`\` -You then need to install the JavaScript dependencies and run the development server. +The widget front-end code bundles it's JavaScript dependencies. After setting up Python, +make sure to install these dependencies locally: \`\`\`sh npm install +\`\`\` + +While developing, you can run the following in a separate terminal to automatically +rebuild JavaScript as you make changes: + +\`\`\`sh npm run dev \`\`\` @@ -1894,7 +1943,7 @@ Alternatively, create and manage your own virtual environment: python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" -jupyter lab +jupyter lab example.ipynb \`\`\` Open \`example.ipynb\` in JupyterLab, VS Code, or your favorite editor @@ -2108,13 +2157,20 @@ Alternatively, create and manage your own virtual environment: python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" -jupyter lab +jupyter lab example.ipynb \`\`\` -You then need to install the JavaScript dependencies and run the development server. +The widget front-end code bundles it's JavaScript dependencies. After setting up Python, +make sure to install these dependencies locally: \`\`\`sh npm install +\`\`\` + +While developing, you can run the following in a separate terminal to automatically +rebuild JavaScript as you make changes: + +\`\`\`sh npm run dev \`\`\` diff --git a/packages/create-anywidget/create.js b/packages/create-anywidget/create.js index 4d013e00..9fcf9f5e 100644 --- a/packages/create-anywidget/create.js +++ b/packages/create-anywidget/create.js @@ -185,17 +185,24 @@ Alternatively, create and manage your own virtual environment: python -m venv .venv source .venv/bin/activate pip install -e ".[dev]" -jupyter lab +jupyter lab example.ipynb \`\`\` `; if (type === "bundled") { body = body.concat(`\ -You then need to install the JavaScript dependencies and run the development server. +The widget front-end code bundles it's JavaScript dependencies. After setting up Python, +make sure to install these dependencies locally: \`\`\`sh npm install +\`\`\` + +While developing, you can run the following in a separate terminal to automatically +rebuild JavaScript as you make changes: + +\`\`\`sh npm run dev \`\`\`