> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/autofix-and-remediation/connect-private-packages/poetry-private-packages.md).

# Poetry - Private Packages

For Aikido to update dependencies that include private packages, it needs access to your private registries so it can generate accurate lockfile updates. For Poetry, you can provide a **Google Artifact Registry** configuration service key or provide **environment variables** in Aikido.

## Adding credentials with environment variables <a href="#adding-credentials-with-environment-variables" id="adding-credentials-with-environment-variables"></a>

When the credentials to connect to the private registry are static, you can provide them in environment variables. The environment variables should be created in the following format:

* `POETRY_HTTP_BASIC_[SOURCE_NAME]_USERNAME`
* `POETRY_HTTP_BASIC_[SOURCE_NAME]_PASSWORD`

Where the `[SOURCE_NAME]` is the name of the data source which you specified in your `pyproject.toml` file in uppercase. For example, set `POETRY_HTTP_BASIC_ARTIFACT_USERNAME` and `POETRY_HTTP_BASIC_ARTIFACT_PASSWORD` for the following project file:

```
[[tool.poetry.source]]
name = "artifact"
url = "https://repo-1234567890.d.codeartifact.eu-west-1.amazonaws.com/pypi/poetry/simple/"
```

You can configure the Poetry environment variables in Aikido by following the steps below:

1. Go to your account's settings page for AutoFix in Aikido, [here](https://app.aikido.dev/settings/integrations/autofix).
2. Click on "Connect Registry", the configuration modal will now be shown

<figure><img src="/files/4QQzBRmYrK4gOIWgNrKZ" alt=""><figcaption></figcaption></figure>

3. Select Poetry and you can now add the `POETRY_HTTP_BASIC_[SOURCE_NAME]_USERNAME` and `POETRY_HTTP_BASIC_[SOURCE_NAME]_PASSWORD` environment variables:

<figure><img src="/files/m6MefxDVgs74qU2vEQaY" alt=""><figcaption></figcaption></figure>

4. Click Connect Registry to save the environment variables.

If you are using AWS CodeArtifact in combination with Poetry, the password needs to be generated on-the-fly, see this [page](/autofix-and-remediation/connect-private-packages/aws-codeartifact-private-packages.md) on how to configure Poetry with AWS CodeArtifact.

When creating a PR via Autofix, Aikido will include these environment variables when running Poetry commands.

## Adding credentials for GCP Artifact Registry <a href="#adding-credentials-for-gcp-artifact-registry" id="adding-credentials-for-gcp-artifact-registry"></a>

For GCP Artifact registry, credentials can not be generated statically. In this case you can follow the steps below.

### 1. Create a Service Account in GCP <a href="#id-1-create-a-service-account" id="id-1-create-a-service-account"></a>

First, create a service account in your Google Cloud project:

1. Go to the Google Cloud Console.
2. Navigate to **IAM & Admin** > **Service Accounts**.
3. Click **Create Service Account**.
4. Fill in a **Service account name** such as `Aikido Artifact Registry Reader` and click **Create And Continue**.
5. Grant the service account with the **Artifact Registry Reader** role.

   ![Assigning the "Artifact Registry Reader" role to a service account in a Google Cloud project.](/files/bZB68rhYCp3x3a8oUlFA)
6. Click **Continue** and **Done**.

### 2. Create a Key for the Service Account in GCP <a href="#id-2-create-a-key-for-the-service-account" id="id-2-create-a-key-for-the-service-account"></a>

1. On the **Service Accounts** page, find the service account you just created.
2. Click on the three dots on the right and select **Manage Keys**.
3. Click **Add Key** > **Create New Key**.
4. Choose **JSON** and click **Create**.
5. Save the JSON key file to a secure location.

### 3. Configuration in Aikido <a href="#id-3-configuration-in-aikido" id="id-3-configuration-in-aikido"></a>

Once the prerequisites are fulfilled, you can configure aikido to authenticate with your private registry when updating the dependencies by following the steps below:

1. Go to your account's settings page for the autofixer in Aikido, [here](https://app.aikido.dev/issues/fix/settings).
2. Click on "Connect Registry", the configuration modal will now be shown

<figure><img src="/files/4QQzBRmYrK4gOIWgNrKZ" alt=""><figcaption></figcaption></figure>

3. Select Poetry and find the `GCP service account key` section at the bottom of the modal:

<figure><img src="/files/NXnNfSlM2Td3Mhat5KOA" alt=""><figcaption></figcaption></figure>

4. Paste your saved **JSON Key** content in the **Private registry service account key** field
5. Click **Connect Registry** to save the configuration.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.aikido.dev/autofix-and-remediation/connect-private-packages/poetry-private-packages.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
