From e1a4bca3f775f2bbd041b7b39e7a0903b218bda7 Mon Sep 17 00:00:00 2001 From: David Huggins-Daines Date: Fri, 25 Oct 2024 13:29:37 -0400 Subject: [PATCH 1/2] docs: add notes about the use of UV in hatch-test --- docs/how-to/environment/dependency-resolution.md | 8 +++++++- src/hatch/cli/test/__init__.py | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/how-to/environment/dependency-resolution.md b/docs/how-to/environment/dependency-resolution.md index 7e6c928b4..ff5bd2cc4 100644 --- a/docs/how-to/environment/dependency-resolution.md +++ b/docs/how-to/environment/dependency-resolution.md @@ -12,9 +12,15 @@ PIP_INDEX_URL = "https://token:{env:GITLAB_API_TOKEN}@gitlab.com/api/v4/groups/< PIP_EXTRA_INDEX_URL = "https://token:{env:GITLAB_API_TOKEN}@gitlab.com/api/v4/groups//-/packages/pypi/simple/ https://pypi.org/simple/" ``` +Note that Hatch's *internal* environments, such as the `hatch-test` +matrix used by the [`test` command](../../../cli/reference/#hatch-test), +now use `uv`. Therefore if you wish change their dependency +resolution behaviour, you will need to also set the corresponding +environment variables, as described below. + ## UV -If you're [using UV](select-installer.md), a different set of [environment variables](https://github.com/astral-sh/uv/tree/0.1.35#environment-variables) are available to configure its behavior. The previous example would look like this instead: + you're [using UV](select-installer.md), a different set of [environment variables](https://github.com/astral-sh/uv/tree/0.1.35#environment-variables) are available to configure its behavior. The previous example would look like this instead: ```toml config-example [tool.hatch.envs.default.env-vars] diff --git a/src/hatch/cli/test/__init__.py b/src/hatch/cli/test/__init__.py index 48640636f..7a4c4c773 100644 --- a/src/hatch/cli/test/__init__.py +++ b/src/hatch/cli/test/__init__.py @@ -71,6 +71,12 @@ def test( The inclusion option is treated as an intersection while the exclusion option is treated as a union i.e. an environment must match all of the included variables to be selected while matching any of the excluded variables will prevent selection. + \b + !!! tip + The `hatch-test` matrix [uses UV](../../how-to/environment/select-installer) as its installer by + default. If you wish to control dependency resolution for your tests (to use a custom or extra + PyPI index for instance), you must [set its specific environment + variables](../../how-to/environment/dependency-resolution#UV) """ app: Application = ctx.obj From 218a23c90f4871982a0c12562cddf696ab318c42 Mon Sep 17 00:00:00 2001 From: David Huggins-Daines Date: Fri, 25 Oct 2024 13:33:01 -0400 Subject: [PATCH 2/2] fix(docs): typo --- docs/how-to/environment/dependency-resolution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/how-to/environment/dependency-resolution.md b/docs/how-to/environment/dependency-resolution.md index ff5bd2cc4..f3e63cb35 100644 --- a/docs/how-to/environment/dependency-resolution.md +++ b/docs/how-to/environment/dependency-resolution.md @@ -20,7 +20,7 @@ environment variables, as described below. ## UV - you're [using UV](select-installer.md), a different set of [environment variables](https://github.com/astral-sh/uv/tree/0.1.35#environment-variables) are available to configure its behavior. The previous example would look like this instead: +If you're [using UV](select-installer.md), a different set of [environment variables](https://github.com/astral-sh/uv/tree/0.1.35#environment-variables) are available to configure its behavior. The previous example would look like this instead: ```toml config-example [tool.hatch.envs.default.env-vars]