Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to build with uv #134

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion thx/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import tomli
from trailrunner.core import project_root

from .types import Config, ConfigError, Job, Version
from .types import Builder, Config, ConfigError, Job, Version


def ensure_dict(value: Any, key: str) -> Dict[str, Any]:
Expand Down Expand Up @@ -134,6 +134,15 @@ def load_config(path: Optional[Path] = None) -> Config:
content = pyproject.read_text()
data = tomli.loads(content).get("tool", {}).get("thx", {})

try:
builder_str = data.pop("builder", Builder.AUTO.value)
builder = Builder(builder_str)
except ValueError:
raise ConfigError(
f"Option tool.thx.builder: invalid value {builder_str!r}; "
f"expected one of {', '.join(b.value for b in Builder)}"
)

default: List[str] = ensure_listish(data.pop("default", None), "tool.thx.default")
jobs: List[Job] = parse_jobs(data.pop("jobs", {}))
versions: List[Version] = sorted(
Expand Down Expand Up @@ -170,6 +179,7 @@ def load_config(path: Optional[Path] = None) -> Config:
requirements=requirements,
extras=extras,
watch_paths=watch_paths,
builder=builder,
)
)

Expand Down
Loading