mirror of
https://github.com/astral-sh/uv.git
synced 2025-12-23 09:19:48 +00:00
Some checks are pending
CI / check system | pyston (push) Blocked by required conditions
CI / check system | alpine (push) Blocked by required conditions
CI / check system | python on macos aarch64 (push) Blocked by required conditions
CI / check system | pypy on ubuntu (push) Blocked by required conditions
CI / check system | conda3.8 on windows x86-64 (push) Blocked by required conditions
CI / cargo publish dry-run (push) Blocked by required conditions
CI / cargo dev generate-all (push) Blocked by required conditions
CI / lint (push) Waiting to run
CI / cargo clippy | ubuntu (push) Blocked by required conditions
CI / cargo clippy | windows (push) Blocked by required conditions
CI / cargo test | ubuntu (push) Blocked by required conditions
CI / cargo test | macos (push) Blocked by required conditions
CI / cargo test | windows (push) Blocked by required conditions
CI / check windows trampoline | aarch64 (push) Blocked by required conditions
CI / build binary | linux libc (push) Blocked by required conditions
CI / check windows trampoline | i686 (push) Blocked by required conditions
CI / check windows trampoline | x86_64 (push) Blocked by required conditions
CI / test windows trampoline | aarch64 (push) Blocked by required conditions
CI / test windows trampoline | i686 (push) Blocked by required conditions
CI / test windows trampoline | x86_64 (push) Blocked by required conditions
CI / build binary | linux aarch64 (push) Blocked by required conditions
CI / build binary | linux musl (push) Blocked by required conditions
CI / build binary | macos aarch64 (push) Blocked by required conditions
CI / build binary | macos x86_64 (push) Blocked by required conditions
CI / smoke test | macos (push) Blocked by required conditions
CI / build binary | windows x86_64 (push) Blocked by required conditions
CI / ecosystem test | pydantic/pydantic-core (push) Blocked by required conditions
CI / ecosystem test | prefecthq/prefect (push) Blocked by required conditions
CI / ecosystem test | pallets/flask (push) Blocked by required conditions
CI / integration test | github actions (push) Blocked by required conditions
CI / check system | conda3.11 on windows x86-64 (push) Blocked by required conditions
CI / cargo shear (push) Waiting to run
CI / typos (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / check system | conda3.8 on linux x86-64 (push) Blocked by required conditions
CI / Determine changes (push) Waiting to run
CI / build binary | windows aarch64 (push) Blocked by required conditions
CI / build binary | msrv (push) Blocked by required conditions
CI / build binary | freebsd (push) Blocked by required conditions
CI / smoke test | linux (push) Blocked by required conditions
CI / smoke test | linux aarch64 (push) Blocked by required conditions
CI / smoke test | windows x86_64 (push) Blocked by required conditions
CI / smoke test | windows aarch64 (push) Blocked by required conditions
CI / integration test | activate nushell venv (push) Blocked by required conditions
CI / integration test | conda on ubuntu (push) Blocked by required conditions
CI / integration test | deadsnakes python3.9 on ubuntu (push) Blocked by required conditions
CI / integration test | free-threaded on windows (push) Blocked by required conditions
CI / integration test | aarch64 windows implicit (push) Blocked by required conditions
CI / integration test | aarch64 windows explicit (push) Blocked by required conditions
CI / integration test | windows python install manager (push) Blocked by required conditions
CI / integration test | pypy on ubuntu (push) Blocked by required conditions
CI / integration test | pypy on windows (push) Blocked by required conditions
CI / integration test | graalpy on ubuntu (push) Blocked by required conditions
CI / integration test | graalpy on windows (push) Blocked by required conditions
CI / integration test | pyodide on ubuntu (push) Blocked by required conditions
CI / integration test | free-threaded python on github actions (push) Blocked by required conditions
CI / integration test | pyenv on wsl x86-64 (push) Blocked by required conditions
CI / integration test | determine publish changes (push) Blocked by required conditions
CI / integration test | registries (push) Blocked by required conditions
CI / integration test | uv publish (push) Blocked by required conditions
CI / integration test | uv_build (push) Blocked by required conditions
CI / check cache | ubuntu (push) Blocked by required conditions
CI / check cache | macos aarch64 (push) Blocked by required conditions
CI / check system | python on debian (push) Blocked by required conditions
CI / check system | python on fedora (push) Blocked by required conditions
CI / check system | python on ubuntu (push) Blocked by required conditions
CI / check system | python on rocky linux 10 (push) Blocked by required conditions
CI / check system | python on rocky linux 8 (push) Blocked by required conditions
CI / check system | python on rocky linux 9 (push) Blocked by required conditions
CI / check system | graalpy on ubuntu (push) Blocked by required conditions
CI / check system | homebrew python on macos aarch64 (push) Blocked by required conditions
CI / check system | x86-64 python on macos aarch64 (push) Blocked by required conditions
CI / check system | python on macos x86-64 (push) Blocked by required conditions
CI / check system | python3.10 on windows x86-64 (push) Blocked by required conditions
CI / check system | python3.10 on windows x86 (push) Blocked by required conditions
CI / check system | python3.13 on windows x86-64 (push) Blocked by required conditions
CI / check system | x86-64 python3.13 on windows aarch64 (push) Blocked by required conditions
CI / check system | aarch64 python3.13 on windows aarch64 (push) Blocked by required conditions
CI / check system | windows registry (push) Blocked by required conditions
CI / check system | python3.12 via chocolatey (push) Blocked by required conditions
CI / check system | python3.9 via pyenv (push) Blocked by required conditions
CI / check system | python3.13 (push) Blocked by required conditions
CI / check system | conda3.11 on macos aarch64 (push) Blocked by required conditions
CI / check system | conda3.8 on macos aarch64 (push) Blocked by required conditions
CI / check system | conda3.11 on linux x86-64 (push) Blocked by required conditions
CI / check system | amazonlinux (push) Blocked by required conditions
CI / check system | embedded python3.10 on windows x86-64 (push) Blocked by required conditions
CI / benchmarks | walltime aarch64 linux (push) Blocked by required conditions
CI / benchmarks | instrumented (push) Blocked by required conditions
zizmor / Run zizmor (push) Waiting to run
This also removes the file-specific targets from prettier execution which means we're including `.json`, `.css`, and `.html` files, which seems like an improvement. Co-authored-by: Claude <noreply@anthropic.com>
159 lines
5 KiB
Python
159 lines
5 KiB
Python
# /// script
|
|
# requires-python = ">=3.13"
|
|
# dependencies = []
|
|
# ///
|
|
|
|
import json
|
|
import pathlib
|
|
import subprocess
|
|
|
|
GENERATED_HEADER = "<!-- This file is generated. DO NOT EDIT -->"
|
|
|
|
UV_TEMPLATE = """{GENERATED_HEADER}
|
|
|
|
# uv
|
|
|
|
uv is a Python package and project manager.
|
|
|
|
See the [documentation](https://docs.astral.sh/uv/) or [repository](https://github.com/astral-sh/uv)
|
|
for more information.
|
|
|
|
This crate is the entry point to the uv command-line interface. The Rust API exposed here is not
|
|
considered public interface.
|
|
|
|
This is version {uv_version}. The source can be found [here]({source_url}).
|
|
|
|
The following uv workspace members are also available:
|
|
|
|
{WORKSPACE_MEMBERS}
|
|
|
|
uv's workspace members are considered internal and will have frequent breaking changes.
|
|
|
|
See uv's [crate versioning policy](https://docs.astral.sh/uv/reference/policies/versioning/#crate-versioning) for details on versioning.
|
|
"""
|
|
|
|
|
|
MEMBER_TEMPLATE = """{GENERATED_HEADER}
|
|
|
|
# {name}
|
|
|
|
This crate is an internal component of [uv](https://crates.io/crates/uv). The Rust API exposed here is
|
|
unstable and will have frequent breaking changes.
|
|
|
|
This version ({crate_version}) is a component of [uv {uv_version}]({uv_crates_io_url}). The source can
|
|
be found [here]({source_url}).
|
|
|
|
See uv's [crate versioning
|
|
policy](https://docs.astral.sh/uv/reference/policies/versioning/#crate-versioning) for details on
|
|
versioning.
|
|
"""
|
|
|
|
|
|
REPO_URL = "https://github.com/astral-sh/uv"
|
|
|
|
|
|
def main() -> None:
|
|
result = subprocess.run(
|
|
["cargo", "metadata", "--format-version", "1"],
|
|
capture_output=True,
|
|
text=True,
|
|
check=True,
|
|
)
|
|
content = json.loads(result.stdout)
|
|
packages = {package["id"]: package for package in content["packages"]}
|
|
|
|
# Find the uv version from the uv crate
|
|
uv_version = None
|
|
for package in content["packages"]:
|
|
if package["name"] == "uv":
|
|
uv_version = package["version"]
|
|
break
|
|
if uv_version is None:
|
|
raise RuntimeError("Could not find uv crate")
|
|
|
|
workspace_root = pathlib.Path(content["workspace_root"])
|
|
readme_path = workspace_root / "crates" / "uv" / "README.md"
|
|
|
|
workspace_members = []
|
|
for workspace_member in content["workspace_members"]:
|
|
package = packages[workspace_member]
|
|
name = package["name"]
|
|
# Skip the main uv crate
|
|
if name == "uv":
|
|
continue
|
|
# Skip crates with publish = false
|
|
if package.get("publish") == []:
|
|
continue
|
|
workspace_members.append(name)
|
|
|
|
workspace_members.sort()
|
|
|
|
members_list = "\n".join(
|
|
f"- [{name}](https://crates.io/crates/{name})" for name in workspace_members
|
|
)
|
|
|
|
# Generate README for the main uv crate
|
|
uv_source_url = f"{REPO_URL}/blob/{uv_version}/crates/uv"
|
|
readme_content = UV_TEMPLATE.format(
|
|
GENERATED_HEADER=GENERATED_HEADER,
|
|
WORKSPACE_MEMBERS=members_list,
|
|
uv_version=uv_version,
|
|
source_url=uv_source_url,
|
|
)
|
|
readme_path.write_text(readme_content)
|
|
|
|
# Track all generated README paths for formatting at the end
|
|
generated_paths = [readme_path]
|
|
|
|
# Generate READMEs for all workspace members
|
|
for workspace_member in content["workspace_members"]:
|
|
package = packages[workspace_member]
|
|
name = package["name"]
|
|
|
|
# Skip the main uv crate (already handled above)
|
|
if name == "uv":
|
|
continue
|
|
|
|
# Determine the README path for this crate
|
|
manifest_path = pathlib.Path(package["manifest_path"])
|
|
crate_dir = manifest_path.parent
|
|
member_readme_path = crate_dir / "README.md"
|
|
|
|
# Check if README already exists
|
|
if member_readme_path.exists():
|
|
existing_content = member_readme_path.read_text()
|
|
# Skip if it doesn't have the generated header
|
|
if not existing_content.startswith(GENERATED_HEADER):
|
|
print(f"Skipping {name}: existing README without generated header")
|
|
continue
|
|
|
|
# Get the crate version and compute source URL
|
|
crate_version = package["version"]
|
|
# Compute relative path from workspace root to crate directory
|
|
relative_crate_path = crate_dir.relative_to(workspace_root)
|
|
source_url = f"{REPO_URL}/blob/{uv_version}/{relative_crate_path}"
|
|
|
|
# Generate the README content
|
|
uv_crates_io_url = f"https://crates.io/crates/uv/{uv_version}"
|
|
member_readme_content = MEMBER_TEMPLATE.format(
|
|
GENERATED_HEADER=GENERATED_HEADER,
|
|
name=name,
|
|
crate_version=crate_version,
|
|
uv_version=uv_version,
|
|
uv_crates_io_url=uv_crates_io_url,
|
|
source_url=source_url,
|
|
)
|
|
member_readme_path.write_text(member_readme_content)
|
|
generated_paths.append(member_readme_path)
|
|
|
|
print(f"Generated README for {name}")
|
|
|
|
# Format all generated READMEs once at the end
|
|
subprocess.run(
|
|
["npx", "prettier", "--write"] + [str(path) for path in generated_paths],
|
|
check=True,
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|