From 091735bb2ed5a8d6e12474c002d2cb3264fe2fe1 Mon Sep 17 00:00:00 2001 From: David Brochart Date: Tue, 17 Feb 2026 14:28:37 +0100 Subject: [PATCH 1/5] Use uv build backend --- .github/workflows/test.yml | 14 ++-- publish.py | 55 --------------- pyproject.toml | 105 +++++++++++++---------------- {jpterm => src/jpterm}/__init__.py | 0 {jpterm => src/jpterm}/cli.py | 0 5 files changed, 55 insertions(+), 119 deletions(-) delete mode 100644 publish.py rename {jpterm => src/jpterm}/__init__.py (100%) rename {jpterm => src/jpterm}/cli.py (100%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e4b63cc..73f4819 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,14 +42,14 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v6 - - - name: Set up Python - uses: actions/setup-python@v6 + - uses: astral-sh/setup-uv@v7 with: python-version: ${{ matrix.python-version }} - - - name: Install hatch - run: pip install hatch + activate-environment: "true" + - name: Install jpterm and plugins + run: | + uv venv + uv pip install -e "." - name: Run jpterm - run: hatch run dev:jpterm --help + run: uv run jpterm --help diff --git a/publish.py b/publish.py deleted file mode 100644 index 5cbb8a0..0000000 --- a/publish.py +++ /dev/null @@ -1,55 +0,0 @@ -import subprocess -from pathlib import Path - -import httpx -import toml - - -def run(cmd: str, cwd: str | None = None) -> list[str]: - res = subprocess.run(cmd.split(), capture_output=True, cwd=cwd) - return res.stdout.decode().splitlines() - - -Path("dist").mkdir(exist_ok=True) -pyproject = toml.load("pyproject.toml") -jpterm_version = pyproject["project"]["version"] -for dependency in pyproject["project"]["dependencies"]: - idx = dependency.find("==") - version = dependency[idx + 2:].strip() - package = dependency[:idx].strip() - if package == "txl": - txl_version = version - if package.startswith("txl"): - response = httpx.get(f"https://pypi.org/pypi/{package}/json") - releases = response.json()["releases"].keys() - if version not in releases: - print(f"Building {package}-{version}") - package_dir = Path() - dist_dir = "../dist" - if package == "txl": - package_dir /= package - else: - package_dir = package_dir / "plugins" / package[len("txl_"):] - dist_dir = f"../{dist_dir}" - package_pyproject = toml.load(package_dir / "pyproject.toml") - package_pyproject["project"]["version"] = version - for idx, dependency in enumerate(package_pyproject["project"]["dependencies"]): - if dependency.startswith("txl") and not dependency.startswith("txl_"): - package_pyproject["project"]["dependencies"][idx] = f"txl =={txl_version}" - with open(package_dir / "pyproject.toml", "w") as f: - toml.dump(package_pyproject, f) - break - with open(package_dir / "pyproject.toml", "w") as f: - toml.dump(package_pyproject, f) - run(f"hatch build {dist_dir}", cwd=str(package_dir)) - for path in Path("dist").iterdir(): - if f"{package}-{version}" in path.name: - break - else: - raise RuntimeError( - f"Wrong version for package {package}: did you forget to bump it to {version}?" - ) - - -print(f"Building jpterm-{jpterm_version}") -run("hatch build") diff --git a/pyproject.toml b/pyproject.toml index 28df73b..fea41a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +requires = ["uv_build"] +build-backend = "uv_build" [project] name = "jpterm" @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ] @@ -26,29 +27,29 @@ keywords = [ ] dependencies = [ "rich-click >=1.6.0", - "txl ==0.3.3", - "txl_cell ==0.3.7", - "txl_console ==0.3.7", - "txl_editors ==0.3.7", - "txl_file_browser ==0.3.7", - "txl_image_viewer ==0.3.7", - "txl_jpterm ==0.3.8", - "txl_kernel ==0.3.9", - "txl_local_contents ==0.3.7", - "txl_local_terminals ==0.3.8", - "txl_local_kernels ==0.3.7", - "txl_notebook_editor ==0.3.7", - "txl_remote_contents ==0.3.7", - "txl_remote_terminals ==0.3.7", - "txl_remote_kernels ==0.3.7", - "txl_text_editor ==0.3.7", - "txl_markdown_viewer ==0.3.7", - "txl_terminal ==0.3.7", - "txl_launcher ==0.3.7", - "txl_widgets ==0.3.7", + "txl >=0.3.3,<0.4.0", + "txl_cell >=0.3.7,<0.4.0", + "txl_console >=0.3.7,<0.4.0", + "txl_editors >=0.3.7,<0.4.0", + "txl_file_browser >=0.3.7,<0.4.0", + "txl_image_viewer >=0.3.7,<0.4.0", + "txl_jpterm >=0.3.8,<0.4.0", + "txl_kernel >=0.3.9,<0.4.0", + "txl_local_contents >=0.3.7,<0.4.0", + "txl_local_terminals >=0.3.8,<0.4.0", + "txl_local_kernels >=0.3.7,<0.4.0", + "txl_notebook_editor >=0.3.7,<0.4.0", + "txl_remote_contents >=0.3.7,<0.4.0", + "txl_remote_terminals >=0.3.7,0.4.0", + "txl_remote_kernels >=0.3.7<0.4.0", + "txl_text_editor >=0.3.7,0.4.0", + "txl_markdown_viewer >=0.3.7,<0.4.0", + "txl_terminal >=0.3.7,<0.4.0", + "txl_launcher >=0.3.7,<0.4.0", + "txl_widgets >=0.3.7<0.4.0", ] -[project.optional-dependencies] +[dependency-groups] docs = [ "mkdocs", "mkdocs-material", @@ -61,41 +62,31 @@ jpterm = "jpterm.cli:main" [project.urls] Homepage = "https://github.com/davidbrochart/jpterm" -[tool.hatch.envs.docs] -features = ["docs"] +[tool.uv.workspace] +members = ["plugins/*", "txl"] -[tool.hatch.envs.docs.scripts] -build = "mkdocs build --clean --strict" -serve = "mkdocs serve --dev-addr localhost:8000" - -[tool.hatch.envs.dev] -pre-install-commands = [ - "pip install pre-commit", - "pip install textual-dev", - "pip install -e ./txl", - "pip install -e ./plugins/cell", - "pip install -e ./plugins/console", - "pip install -e ./plugins/editors", - "pip install -e ./plugins/file_browser", - "pip install -e ./plugins/image_viewer", - "pip install -e ./plugins/jpterm", - "pip install -e ./plugins/kernel", - "pip install -e ./plugins/local_contents", - "pip install -e ./plugins/local_terminals", - "pip install -e ./plugins/local_kernels", - "pip install -e ./plugins/notebook_editor", - "pip install -e ./plugins/remote_contents", - "pip install -e ./plugins/remote_terminals", - "pip install -e ./plugins/remote_kernels", - "pip install -e ./plugins/text_editor", - "pip install -e ./plugins/markdown_viewer", - "pip install -e ./plugins/terminal", - "pip install -e ./plugins/launcher", - "pip install -e ./plugins/widgets", - - 'pip install "jupyterlab>=4"', - 'pip install "jupyter-collaboration >=2"', -] +[tool.uv.sources] +jpterm = { workspace = true } +txl = { workspace = true } +txl-cell = { workspace = true } +txl-console = { workspace = true } +txl-editors = { workspace = true } +txl-file_browser = { workspace = true } +txl-image_viewer = { workspace = true } +txl-jpterm = { workspace = true } +txl-kernel = { workspace = true } +txl-local_contents = { workspace = true } +txl-local_terminals = { workspace = true } +txl-local_kernels = { workspace = true } +txl-notebook_editor = { workspace = true } +txl-remote_contents = { workspace = true } +txl-remote_terminals = { workspace = true } +txl-remote_kernels = { workspace = true } +txl-text_editor = { workspace = true } +txl-markdown_viewer = { workspace = true } +txl-terminal = { workspace = true } +txl-launcher = { workspace = true } +txl-widgets = { workspace = true } [tool.ruff.lint] select = [ diff --git a/jpterm/__init__.py b/src/jpterm/__init__.py similarity index 100% rename from jpterm/__init__.py rename to src/jpterm/__init__.py diff --git a/jpterm/cli.py b/src/jpterm/cli.py similarity index 100% rename from jpterm/cli.py rename to src/jpterm/cli.py From 564ab9662e9bd3e2382c9f91740ab437700cbcc7 Mon Sep 17 00:00:00 2001 From: David Brochart Date: Tue, 17 Feb 2026 14:33:10 +0100 Subject: [PATCH 2/5] Clear venv if exists --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 73f4819..49a788c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,7 +48,7 @@ jobs: activate-environment: "true" - name: Install jpterm and plugins run: | - uv venv + uv venv --clear uv pip install -e "." - name: Run jpterm From 28301cbee80a10e351fd5a3402f0e6abf2d05e42 Mon Sep 17 00:00:00 2001 From: David Brochart Date: Tue, 17 Feb 2026 14:34:32 +0100 Subject: [PATCH 3/5] typo --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fea41a0..bc9bd31 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,9 +40,9 @@ dependencies = [ "txl_local_kernels >=0.3.7,<0.4.0", "txl_notebook_editor >=0.3.7,<0.4.0", "txl_remote_contents >=0.3.7,<0.4.0", - "txl_remote_terminals >=0.3.7,0.4.0", + "txl_remote_terminals >=0.3.7,<0.4.0", "txl_remote_kernels >=0.3.7<0.4.0", - "txl_text_editor >=0.3.7,0.4.0", + "txl_text_editor >=0.3.7,<0.4.0", "txl_markdown_viewer >=0.3.7,<0.4.0", "txl_terminal >=0.3.7,<0.4.0", "txl_launcher >=0.3.7,<0.4.0", From a2935a6221b6760f2199bad6dad8f69ec8d235c9 Mon Sep 17 00:00:00 2001 From: David Brochart Date: Tue, 17 Feb 2026 14:36:08 +0100 Subject: [PATCH 4/5] again --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bc9bd31..a7c5706 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,12 +41,12 @@ dependencies = [ "txl_notebook_editor >=0.3.7,<0.4.0", "txl_remote_contents >=0.3.7,<0.4.0", "txl_remote_terminals >=0.3.7,<0.4.0", - "txl_remote_kernels >=0.3.7<0.4.0", + "txl_remote_kernels >=0.3.7,<0.4.0", "txl_text_editor >=0.3.7,<0.4.0", "txl_markdown_viewer >=0.3.7,<0.4.0", "txl_terminal >=0.3.7,<0.4.0", "txl_launcher >=0.3.7,<0.4.0", - "txl_widgets >=0.3.7<0.4.0", + "txl_widgets >=0.3.7,<0.4.0", ] [dependency-groups] From 85d8ae3bc76f515cd4ca8193710c9072e118be56 Mon Sep 17 00:00:00 2001 From: David Brochart Date: Tue, 17 Feb 2026 14:44:31 +0100 Subject: [PATCH 5/5] Update publish.yml --- .github/workflows/publish.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 11288b8..65fc333 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,14 +11,9 @@ jobs: environment: release steps: - uses: actions/checkout@v6 - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: 3.x - - name: Install dependencies - run: pip install hatch httpx toml - - name: Create packages - run: python publish.py + - uses: astral-sh/setup-uv@v7 + - name: Build packages + run: uv build --all-packages - name: Archive packages uses: actions/upload-artifact@v6 with: