diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml index e5e216293..8df6ce0d0 100644 --- a/.github/workflows/build-binaries.yml +++ b/.github/workflows/build-binaries.yml @@ -43,6 +43,8 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} + - name: "Prep README.md" + run: python scripts/transform_readme.py --target pypi - name: "Build sdist" uses: PyO3/maturin-action@v1 with: @@ -70,6 +72,8 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} architecture: x64 + - name: "Prep README.md" + run: python scripts/transform_readme.py --target pypi - name: "Build wheels - x86_64" uses: PyO3/maturin-action@v1 with: @@ -109,6 +113,8 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} architecture: x64 + - name: "Prep README.md" + run: python scripts/transform_readme.py --target pypi - name: "Build wheels - universal2" uses: PyO3/maturin-action@v1 with: @@ -159,6 +165,8 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} architecture: ${{ matrix.platform.arch }} + - name: "Prep README.md" + run: python scripts/transform_readme.py --target pypi - name: "Build wheels" uses: PyO3/maturin-action@v1 with: @@ -206,6 +214,8 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} architecture: x64 + - name: "Prep README.md" + run: python scripts/transform_readme.py --target pypi - name: "Build wheels" uses: PyO3/maturin-action@v1 with: @@ -282,6 +292,8 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} + - name: "Prep README.md" + run: python scripts/transform_readme.py --target pypi - name: "Build wheels" uses: PyO3/maturin-action@v1 with: @@ -347,6 +359,8 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} + - name: "Prep README.md" + run: python scripts/transform_readme.py --target pypi - name: "Build wheels" uses: PyO3/maturin-action@v1 with: @@ -414,6 +428,8 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} + - name: "Prep README.md" + run: python scripts/transform_readme.py --target pypi - name: "Build wheels" uses: PyO3/maturin-action@v1 with: @@ -484,6 +500,8 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} architecture: x64 + - name: "Prep README.md" + run: python scripts/transform_readme.py --target pypi - name: "Build wheels" uses: PyO3/maturin-action@v1 with: @@ -546,6 +564,8 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} + - name: "Prep README.md" + run: python scripts/transform_readme.py --target pypi - name: "Build wheels" uses: PyO3/maturin-action@v1 with: diff --git a/README.md b/README.md index 1e3540ef0..80be6c057 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,17 @@ An extremely fast Python package installer and resolver, written in Rust. Designed as a drop-in replacement for common `pip` and `pip-tools` workflows. -uv is backed by [Astral](https://astral.sh), the creators of [Ruff](https://github.com/astral-sh/ruff). +

+ + + + Shows a bar chart with benchmark results. + +

+ +

+ Installing the Trio dependencies with a warm cache. +

## Highlights @@ -29,6 +39,8 @@ uv is backed by [Astral](https://astral.sh), the creators of [Ruff](https://gith dependencies, direct URL dependencies, local dependencies, constraints, source distributions, HTML and JSON indexes, and more. +uv is backed by [Astral](https://astral.sh), the creators of [Ruff](https://github.com/astral-sh/ruff). + ## Getting Started Install uv with our standalone installers, or from [PyPI](https://pypi.org/project/uv/): diff --git a/assets/svg/Benchmark-Dark.svg b/assets/svg/Benchmark-Dark.svg new file mode 100644 index 000000000..cf61643e1 --- /dev/null +++ b/assets/svg/Benchmark-Dark.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + 0s + + 2s + + 4s + + + + + + + + + + + + uv + + poetry + + pdm + + pip-sync + + + + + + + + + + + + + + 0.99s + + 1.90s + + 4.63s + + + + 0.06s + + + + + + + + + + + + diff --git a/assets/svg/Benchmark-Light.svg b/assets/svg/Benchmark-Light.svg new file mode 100644 index 000000000..aa878563e --- /dev/null +++ b/assets/svg/Benchmark-Light.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + 0s + + 2s + + 4s + + + + + + + + + + + + uv + + poetry + + pdm + + pip-sync + + + + + + + + + + + + + + 0.99s + + 1.90s + + 4.63s + + + + 0.06s + + + + + + + + + + + + diff --git a/scripts/transform_readme.py b/scripts/transform_readme.py new file mode 100644 index 000000000..6708c1725 --- /dev/null +++ b/scripts/transform_readme.py @@ -0,0 +1,64 @@ +"""Transform the README.md to support a specific deployment target. + +By default, we assume that our README.md will be rendered on GitHub. However, different +targets have different strategies for rendering light- and dark-mode images. This script +adjusts the images in the README.md to support the given target. +""" + +from __future__ import annotations + +import argparse +from pathlib import Path + +URL = "https://github.com/astral-sh/uv/assets/1309177/{}" +URL_LIGHT = URL.format("629e59c0-9c6e-4013-9ad4-adb2bcf5080d") +URL_DARK = URL.format("03aa9163-1c79-4a87-a31d-7a9311ed9310") + +# https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#specifying-the-theme-an-image-is-shown-to +GITHUB = f""" +

+ + + + Shows a bar chart with benchmark results. + +

+""" + +# https://github.com/pypi/warehouse/issues/11251 +PYPI = f""" +

+ Shows a bar chart with benchmark results. +

+""" + + +def main(target: str) -> None: + """Modify the README.md to support the given target.""" + with Path("README.md").open(encoding="utf8") as fp: + content = fp.read() + if GITHUB not in content: + msg = "README.md is not in the expected format." + raise ValueError(msg) + + if target == "pypi": + with Path("README.md").open("w", encoding="utf8") as fp: + fp.write(content.replace(GITHUB, PYPI)) + else: + msg = f"Unknown target: {target}" + raise ValueError(msg) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="Modify the README.md to support a specific deployment target.", + ) + parser.add_argument( + "--target", + type=str, + required=True, + choices=("pypi", "mkdocs"), + ) + args = parser.parse_args() + + main(target=args.target)