-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build backend: Add source tree -> source dist -> wheel tests
- Loading branch information
Showing
19 changed files
with
301 additions
and
55 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/dist/ | ||
/build-root/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# built_by_uv | ||
|
||
A package to be built with the uv build backend that uses all features exposed by the build backend. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
We don't want this file in the source dist or wheel. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[project] | ||
name = "built-by-uv" | ||
version = "0.1.0" | ||
description = "A package to be built with the uv build backend that uses all features exposed by the build backend" | ||
#rreadme = "README.md" | ||
requires-python = ">=3.12" | ||
dependencies = ["anyio>=4,<5"] | ||
|
||
[build-system] | ||
requires = ["uv>=0.4.15,<5"] | ||
build-backend = "uv" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def greet() -> str: | ||
return "Hello 👋" |
3 changes: 3 additions & 0 deletions
3
scripts/packages/built-by-uv/src/built_by_uv/arithmetic/__init__.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .circle import area as circle_area | ||
|
||
__all__ = ["circle_area"] |
12 changes: 12 additions & 0 deletions
12
scripts/packages/built-by-uv/src/built_by_uv/arithmetic/circle.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from functools import lru_cache | ||
from pathlib import Path | ||
|
||
|
||
@lru_cache(maxsize=1) | ||
def pi() -> float: | ||
return float(Path(__file__).parent.joinpath("pi.txt").read_text().strip()) | ||
|
||
|
||
def area(radius: float) -> float: | ||
"""Use a non-Python file (`pi.txt`).""" | ||
return radius**2 * pi() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.14159 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
# Test source tree -> source dist -> wheel and run pytest after. | ||
# We can't test this through the build backend setting directly since we want | ||
# to use the debug build of uv, so we use the internal API instead. | ||
|
||
set -e | ||
|
||
cargo build | ||
uv venv -p 3.12 -q | ||
mkdir -p dist | ||
rm -f dist/* | ||
../../../target/debug/uv build-backend build-sdist dist/ | ||
rm -rf build-root | ||
mkdir build-root | ||
cd build-root | ||
tar -tvf ../dist/built_by_uv-0.1.0.tar.gz | ||
tar xf ../dist/built_by_uv-0.1.0.tar.gz | ||
cd built-by-uv-0.1.0 | ||
../../../../../target/debug/uv build-backend build-wheel ../../dist | ||
unzip -l ../../dist/built_by_uv-0.1.0-py3-none-any.whl | ||
cd ../.. | ||
uv pip install -q pytest dist/built_by_uv-0.1.0-py3-none-any.whl | ||
pytest |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import pytest | ||
from built_by_uv import greet | ||
from built_by_uv.arithmetic.circle import area | ||
|
||
|
||
def test_circle(): | ||
assert area(2) == pytest.approx(12.56636) | ||
|
||
|
||
def test_greet(): | ||
assert greet() == "Hello 👋" |
Oops, something went wrong.