Skip to content

dynamically generated PIP_EXTRA_INDEX_URL before installing. #838

@gerbendekkervolue

Description

@gerbendekkervolue

We host some packages on a private package repo in GCP. To auth to this I would typically run:

ACCESS_TOKEN=$(gcloud auth print-access-token)
export PIP_EXTRA_INDEX_URL=https://oauth2accesstoken:[email protected]/my_company/simple/

Now, I would like to configure hatch through pyproject.toml to run this and keep this PIP_EXTRA_INDEX_URL in two cases:

  1. before installing the hatch default env
  2. when running selected hatch scripts (using pip-compile to lock dependencies and export them to a requirements.txt file).

It is in a way similar to this, https://hatch.pypa.io/latest/how-to/environment/package-indices/, apart from the access token to be generated on the fly.

Is this possible to achieve?

When just putting the two lines above in a pre-install-commands block, it seems the environment variables are not persisting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions