Skip to content

Commit 97de1f3

Browse files
chore(package): Update package server to use UV
Also fix version_updater regex
1 parent c63f240 commit 97de1f3

File tree

3 files changed

+16
-51
lines changed

3 files changed

+16
-51
lines changed

misc/version_updater.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ def _only_major_version(version: str) -> str:
6363
WASM_PACK_GA_VERSION = ReplaceRegex(r"wasm-pack-version: [0-9.]+", "wasm-pack-version: {version}")
6464
PYTHON_DOCKER_VERSION = ReplaceRegex(r"python:\d.\d+", hide_patch_version("python:{version}"))
6565
PYTHON_SMALL_VERSION = ReplaceRegex(r"python\d.\d+", hide_patch_version("python{version}"))
66+
PYPROJECT_PYTHON_VERSION = ReplaceRegex(
67+
r'requires-python = "~=.*"', 'requires-python = "~={version}"'
68+
)
6669
TOML_LICENSE_FIELD = ReplaceRegex(r'license = ".*"', 'license = "{version}"')
6770
TOML_VERSION_FIELD = ReplaceRegex(r'version = ".*"', 'version = "{version}"')
6871
JSON_LICENSE_FIELD = ReplaceRegex(r'"license": ".*"', '"license": "{version}"')
@@ -326,16 +329,11 @@ def set_tool_version(tool: Tool, version: str) -> None:
326329
ReplaceRegex(r"Rust v[0-9.]+", "Rust v{version}"),
327330
RUSTUP_INSTALL,
328331
],
329-
Tool.Python: [
330-
ReplaceRegex(r"python v[0-9.]+", hide_patch_version("python v{version}")),
331-
ReplaceRegex(r"pyenv install [0-9.]+", "pyenv install {version}"),
332-
ReplaceRegex(r"pyenv prefix [0-9.]+", "pyenv prefix {version}"),
333-
],
334332
Tool.Uv: [
335333
ReplaceRegex(r"uv >=[0-9.]+", "uv >={version}"),
336334
ReplaceRegex(
337-
r"curl -LsSf https://astral\.sh/uv/.*/install\.sh | sh",
338-
"curl -LsSf https://astral.sh/uv/{version}/install.sh",
335+
r"https://astral\.sh/uv/.*/install\.sh",
336+
"https://astral.sh/uv/{version}/install.sh",
339337
),
340338
],
341339
Tool.Node: [
@@ -399,9 +397,7 @@ def set_tool_version(tool: Tool, version: str) -> None:
399397
ROOT_DIR / "docs/conf.py": {
400398
Tool.Parsec: [ReplaceRegex(r'version = ".*"', 'version = "{version}"')]
401399
},
402-
ROOT_DIR / "docs/pyproject.toml": {
403-
Tool.Python: [ReplaceRegex(r'^python = "\^[0-9.]+"$', 'python = "^{version}"')]
404-
},
400+
ROOT_DIR / "docs/pyproject.toml": {Tool.Python: [PYPROJECT_PYTHON_VERSION]},
405401
ROOT_DIR / "libparsec/version": {Tool.Parsec: [ReplaceRegex(r"^.*$", "{version}")]},
406402
ROOT_DIR / "LICENSE": {
407403
Tool.Parsec: [
@@ -419,8 +415,8 @@ def set_tool_version(tool: Tool, version: str) -> None:
419415
Tool.Rust: [RUSTUP_INSTALL],
420416
Tool.Uv: [
421417
ReplaceRegex(
422-
r"curl -LsSf https://astral\.sh/uv/.*/install\.sh | sh",
423-
"curl -LsSf https://astral.sh/uv/{version}/install.sh",
418+
r"https://astral\.sh/uv/.*/install\.sh",
419+
"https://astral.sh/uv/{version}/install.sh",
424420
)
425421
],
426422
},
@@ -430,8 +426,8 @@ def set_tool_version(tool: Tool, version: str) -> None:
430426
Tool.Python: [PYTHON_SMALL_VERSION],
431427
Tool.Uv: [
432428
ReplaceRegex(
433-
r"curl -LsSf https://astral\.sh/uv/.*/install\.sh | sh",
434-
"curl -LsSf https://astral.sh/uv/{version}/install.sh",
429+
r"https://astral\.sh/uv/.*/install\.sh",
430+
"https://astral.sh/uv/{version}/install.sh",
435431
)
436432
],
437433
},
@@ -450,7 +446,7 @@ def set_tool_version(tool: Tool, version: str) -> None:
450446
r'"Programming Language :: Python :: .*"',
451447
hide_patch_version('"Programming Language :: Python :: {version}"'),
452448
),
453-
ReplaceRegex(r'python = "~.*"', 'python = "~{version}"'),
449+
PYPROJECT_PYTHON_VERSION,
454450
ReplaceRegex(
455451
r'build = "cp\d+-{manylinux,macos,win}\*"',
456452
hide_patch_version('build = "cp{version}-{{manylinux,macos,win}}*"', separator=""),

server/packaging/server/in-docker-build.sh

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,15 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --defaul
77
export PATH="/root/.cargo/bin:$PATH"
88
cargo --version
99

10-
# Install Poetry
11-
curl -sSL https://install.python-poetry.org | python - --version=2.1.1
10+
# Install UV
11+
curl -LsSL https://astral.sh/uv/0.8.4/install.sh | sh
1212
export PATH="/root/.local/bin:$PATH"
13-
poetry --version
14-
# Install plugin for poetry export
15-
poetry self add poetry-plugin-export
13+
uv --version
1614

1715
# Install parsec in virtual env
1816
python -m venv venv
1917
. ./venv/bin/activate
2018

21-
# Installing the Python project is a bit tricky:
22-
# - `pip install .` ignores dependency pinning :(
23-
# - `poetry install` install the main project as a symlink in the virtualenv :(
24-
# So instead we ask poetry to generate a `requirements.txt` that contains the
25-
# pinned dependencies, then pip install this, and finally do a regular
26-
# `pip install .` that will only install our project given all dependencies are
27-
# already installed.
28-
29-
# Only keep dependencies from `main` group (i.e. the base dependencies), as other groups are for dev
30-
poetry --project ./server export --output requirements.txt --with=main
31-
# Install the dependencies...
32-
pip install -r ./requirements.txt
33-
# ...and our project
3419
# Compile in release mode
3520
# Also don't bundle OpenSSL shared library (it is already in the Docker image !)
3621
UV_LIBPARSEC_BUILD_PROFILE=release \

server/packaging/testbed-server/in-docker-build.sh

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,14 @@ export PATH="/root/.cargo/bin:$PATH"
88
cargo --version
99

1010
# Install Poetry
11-
curl -sSL https://install.python-poetry.org | python - --version=2.1.1
11+
curl -LsSL https://astral.sh/uv/0.8.4/install.sh | sh
1212
export PATH="/root/.local/bin:$PATH"
13-
poetry --version
14-
# Install plugin for poetry export
15-
poetry self add poetry-plugin-export
13+
uv --version
1614

1715
# Install parsec in virtual env
1816
python -m venv venv
1917
. ./venv/bin/activate
2018

21-
# Installing the Python project is a bit tricky:
22-
# - `pip install .` ignores dependency pinning :(
23-
# - `poetry install` install the main project as a symlink in the virtualenv :(
24-
# So instead we ask poetry to generate a `requirements.txt` that contains the
25-
# pinned dependencies, then pip install this, and finally do a regular
26-
# `pip install .` that will only install our project given all dependencies are
27-
# already installed.
28-
29-
# Only keep dependencies from `main` group (i.e. the base dependencies) and
30-
# testbed-server, as other groups are for dev
31-
poetry --project ./server export --output requirements.txt --with=main,testbed-server
32-
# Install the dependencies...
33-
pip install -r ./requirements.txt
34-
# ...and our project
3519
# Compile in CI mode to reduce size while still retain `test-utils` feature
3620
# Also don't bundle OpenSSL shared library (it is already in the Docker image !)
3721
UV_LIBPARSEC_BUILD_PROFILE=ci \

0 commit comments

Comments
 (0)