uv migration#398
Merged
Merged
Conversation
- pyproject.toml: convert [tool.poetry] to PEP 621 [project], dev deps to PEP 735 [dependency-groups], switch build backend to hatchling. notebook moves into a `jupyter` optional-extra. - Replace poetry.lock with uv.lock; drop generated requirements*.txt (Docker now consumes uv.lock directly). - Makefile: poetry run -> uv run; make update simplified to uv sync -U. - Dockerfiles: canonical Astral pattern (pinned uv 0.10.4, cache+bind mounts, two-step uv sync, UV_COMPILE_BYTECODE/LINK_MODE/NO_DEV/ PYTHON_DOWNLOADS env). michelson-kernel image installs the jupyter extra; the headless pytezos image does not. - Workflows: astral-sh/setup-uv@v6 in place of pipx install poetry + actions/setup-python; uv publish for release; uv.lock in trigger path filters. Bump the matrix's "oldest" Python from 3.9 to 3.10 to match requires-python. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
.dockerignore still allowlisted poetry.lock and requirements** but uv.lock was excluded by the leading `*` deny rule, so the Dockerfile bind mount of uv.lock failed during `docker build`. CLAUDE.md was authored earlier in the migration session but never checked in. It reflects the new uv-based workflow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pre-3.18 the Jupyter stack came along with `pip install pytezos` because `notebook` was a top-level runtime dependency. Now that notebook lives behind the `jupyter` extra, the `michelson-kernel` console script (which imports `ipykernel`/`jupyter_client` at module level) needs the extra to import cleanly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Without a pin uv picks the lowest interpreter satisfying requires-python (>=3.10), which makes black emit a noisy AST-safety warning whenever its target-version list includes a higher version. Pinning to 3.13 (the latest CI tier) eliminates the warning and gives local dev the same Python the latest matrix slot runs on. The boilerplate Python .gitignore was excluding .python-version; for a uv-based project it is useful to ship so contributors get the same interpreter automatically. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
kill_existing_containers() is registered atexit and unconditionally instantiates DockerClient(). When the docker daemon socket is absent (e.g. inside the published pytezos image, or any CI/sandbox without DinD), Python's atexit machinery catches the resulting DockerException but prints it to stderr as "Exception ignored in atexit callback...". The hook is best-effort cleanup; wrap the whole body in contextlib.suppress so it stays silent when there is nothing to clean up. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
michelson_kernel/{cli,kernel}.py import ipykernel and jupyter_client
at module level. Previously they were pulled transitively through
notebook 6.x, which made the dependency invisible from pyproject.toml
and fragile against any future change to the notebook pin.
This is purely additive — the resolved versions in uv.lock are
unchanged (ipykernel 6.29.5, jupyter-client 7.4.9).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
notebook==6.5.7 imports distutils unconditionally (notebook/utils.py: `from distutils.version import LooseVersion`). Python 3.12 removed distutils, so jupyter-notebook crashed on startup inside the michelson-kernel image (python:3.12-alpine3.22) — the ENTRYPOINT had been functionally broken since the image moved to 3.12. Notebook 7 is built on jupyter-server and works on 3.12+. Also drop the `--no-mathjax` flag — notebook 7's argparser rejects it. Verified locally: image boots, the michelson kernelspec is registered and visible via the /api/kernelspecs REST endpoint. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- src/pytezos/rpc/node.py: retry transient octez 5xx responses (kind: temporary, mempool/prevalidator assertion text), but never retry protocol errors (id startswith proto.) — those are domain failures. - src/pytezos/sandbox/node.py: have the autobaker thread wait one block interval before its first bake; baking immediately races with the pending protocol activation and trips prevalidator.ml:1918. - tests/integration_tests/test_callback_view.py: switch test_onchain_view off the dead Harbinger wrapper (which FAILWITHs 900) onto 3Route v4 (KT1V5XKmey...), an active DEX router with a stable getToken view. - Makefile: $(OSTYPE) is a shell var not exported into Make's env, so the test-ci sandbox conditional was always false on Linux and the sandbox suite never ran in CI. Switch to $(shell uname -s) compared against Linux/Darwin so the gating actually works. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…licitly Two review remarks on the uv-migration branch addressed in a single fixup: 1. e2a5a51 (".python-version" pin) — the underlying issue was a black AST-safety warning emitted whenever it ran on an interpreter lower than the highest entry in [tool.black].target-version. The proper in-pyproject fix is to align target-version with the actual floor declared by requires-python (py310), not to drag a stray .python-version into the repo as a side-channel pin. Pytezos still supports 3.10–3.13; bumping requires-python would be a real breaking change for users for the sake of silencing a dev warning, so we keep the floor as is. Revert .python-version and the .gitignore tweak. 2. f7e5192 (atexit silencer) — wrapping the whole hook body in suppress(Exception) was too broad: it would also swallow real bugs in the container-list path or in container.stop. The only error we actually need to absorb is DockerException raised by DockerClient() when the daemon socket is unreachable. Replace the outer suppress with a narrow try/except DockerException + early return; the inner per-container suppress stays as-is (best-effort stop). Verified: - black --check src tests scripts --exclude ".*/docs.py" runs clean on both Python 3.10 and 3.13 with no AST warnings. - mypy + ruff clean on src/pytezos/sandbox/node.py. - kill_existing_containers() with no docker socket returns silently; with a working daemon the listing/stop path runs as before. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Test Results 4 files 4 suites 2m 25s ⏱️ Results for commit 175aa33. ♻️ This comment has been updated with latest results. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Switches dependency management from Poetry to uv (PEP 621
[project]+ PEP 735[dependency-groups],uv.lockcommitted). Includes fixes for issues surfaced during verification.Changes
pyproject.tomluses standard[project]+[dependency-groups], hatchling as build backenduv.lock;make install→uv sync --all-extras --all-groups --link-mode symlink --locked3.13via.python-version(matches CI latest tier)uvpattern (multi-stage, cache mounts,UV_COMPILE_BYTECODE,UV_LINK_MODE=copy).dockerignoreforuv.lock(was excluding it via leftover Poetry rules)astral-sh/setup-uv@v6make test-cino longer skips the sandbox suite on Linux silently —$(OSTYPE)is a shell var Make doesn't inherit, replaced with$(shell uname -s)againstLinux/Darwinpip install pytezosno longer ships the Jupyter stack as a side effect. Themichelson-kernelconsole script now requirespip install pytezos[jupyter](pre-3.18 the same effect happened transitively vianotebookbeing a top-level dep)ipykernel>=6andjupyter-client>=7explicitly in thejupyterextra (they're imported at module level bymichelson_kernel.{cli,kernel})notebookto>=7,<8: notebook 6.x importsdistutils.version.LooseVersion, which Python 3.12 removed (PEP 632). The michelson-kernel image (python:3.12-alpine3.22) couldn't launch on master before this. Drop the now-unrecognised--no-mathjaxflag from the entrypointRpcNode.requestnow retrieskind: temporary5xx responses (and plain-textprevalidator.mlassertions) with exponential backoff.proto.*errors are explicitly NOT retried so legitimate Michelson failures (script_rejected,FAILWITH) surface immediatelyprevalidator.ml:1918kill_existing_containerscatchesDockerExceptionexplicitly so it silently no-ops in environments without a docker daemon (was printing "Exception ignored in atexit callback" to stderr)test_onchain_viewswitched off the dead Harbinger oracle wrapper (KT1F6Amn..., FAILWITHs 900) onto 3Route v4 (KT1V5XKmey...), an active DEX router with a stablegetToken(0)view*_test_results.xmlTest plan
make installfrom a clean checkoutmake lint(isort, black, ruff, mypy)make test— full local suite passesmake test-ci— 4 JUnit XMLs: unit 761 / contract 348 / integration 21 / sandbox 19, all passingdocker buildfor bothpytezos.dockerfileandmichelson-kernel.dockerfiletest_1_originate_contract10x in a row, 10/10 pass🤖 Generated with Claude Code