> 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/docs/docs-ja/autofix-to/connect-private-packages/poetry-private-packages.md).

# Poetry - プライベートパッケージ

Aikido がプライベートパッケージを含む依存関係を更新できるようにするには、正確な lockfile の更新を生成できるよう、プライベートレジストリへのアクセスが必要です。Poetry の場合は、 **Google Artifact Registry** 設定サービスキーを指定するか、 **環境変数** Aikido内で。

## 環境変数を使って認証情報を追加する <a href="#adding-credentials-with-environment-variables" id="adding-credentials-with-environment-variables"></a>

プライベートレジストリに接続するための認証情報が固定の場合は、環境変数として提供できます。環境変数は次の形式で作成してください:

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

ここで `[SOURCE_NAME]` は、あなたが `pyproject.toml` ファイルで指定したデータソース名を大文字にしたものです。たとえば、 `POETRY_HTTP_BASIC_ARTIFACT_USERNAME` および `POETRY_HTTP_BASIC_ARTIFACT_PASSWORD` を次のプロジェクトファイルに対して設定します:

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

以下の手順に従って、Aikido で Poetry の環境変数を設定できます:

1. Aikido の AutoFix のアカウント設定ページに移動し、 [こちら](https://app.aikido.dev/settings/integrations/autofix).
2. 「Connect Registry」をクリックすると、設定モーダルが表示されます

<figure><img src="/files/93d539d9c2979772d40a2c418b778a2cd588532f" alt=""><figcaption></figcaption></figure>

3. Poetry を選択すると、 `POETRY_HTTP_BASIC_[SOURCE_NAME]_USERNAME` および `POETRY_HTTP_BASIC_[SOURCE_NAME]_PASSWORD` 環境変数を追加できるようになります:

<figure><img src="/files/02d89493b51a8ecb88fc9d25c48910a987dc2a18" alt=""><figcaption></figcaption></figure>

4. 「Connect Registry」をクリックして環境変数を保存します。

AWS CodeArtifact を Poetry と組み合わせて使用している場合、パスワードは動的に生成する必要があります。こちらの [ページ](/docs/docs-ja/autofix-to/connect-private-packages/aws-codeartifact-private-packages.md) を参照して、AWS CodeArtifact で Poetry を設定する方法を確認してください。

Autofix 経由で PR を作成すると、Aikido は Poetry コマンドの実行時にこれらの環境変数を含めます。

## GCP Artifact Registry の認証情報を追加する <a href="#adding-credentials-for-gcp-artifact-registry" id="adding-credentials-for-gcp-artifact-registry"></a>

GCP Artifact Registry では、認証情報を静的に生成することはできません。この場合は、以下の手順に従ってください。

### 1. GCP でサービス アカウントを作成する <a href="#id-1-create-a-service-account" id="id-1-create-a-service-account"></a>

まず、Google Cloud プロジェクトにサービス アカウントを作成します:

1. Google Cloud Console に移動します。
2. 次へ移動: **IAM と管理** > **サービス アカウント**.
3. クリック **サービス アカウントを作成**.
4. 次のような **サービス アカウント名** を入力します。 `Aikido Artifact Registry Reader` に移動し、 **作成して続行**.
5. サービス アカウントに **Artifact Registry Reader** ロール。

   ![Google Cloud プロジェクト内のサービス アカウントに「Artifact Registry Reader」ロールを割り当てる。](/files/cfdfd0981b333c111ec10dbf0cb700385c9050fa)
6. クリック **続行** および **完了**.

### 2. GCP でサービス アカウントの鍵を作成する <a href="#id-2-create-a-key-for-the-service-account" id="id-2-create-a-key-for-the-service-account"></a>

1. 次の **サービス アカウント** ページで、先ほど作成したサービス アカウントを見つけます。
2. 右側の3つの点をクリックし、 **鍵を管理**.
3. クリック **鍵を追加** > **新しい鍵を作成**.
4. 選択 **JSON** に移動し、 **作成**.
5. JSON 鍵ファイルを安全な場所に保存します。

### 3. Aikido での設定 <a href="#id-3-configuration-in-aikido" id="id-3-configuration-in-aikido"></a>

前提条件が満たされたら、以下の手順に従って、依存関係を更新する際に Aikido がプライベートレジストリで認証できるよう設定できます:

1. Aikido の autofixer のアカウント設定ページに移動し、 [こちら](https://app.aikido.dev/issues/fix/settings).
2. 「Connect Registry」をクリックすると、設定モーダルが表示されます

<figure><img src="/files/93d539d9c2979772d40a2c418b778a2cd588532f" alt=""><figcaption></figcaption></figure>

3. Poetry を選択し、 `GCP サービスアカウントキー` セクションをモーダルの下部で見つけます:

<figure><img src="/files/980801df7d38ac5d69eac56fd32adc579dc58ad5" alt=""><figcaption></figcaption></figure>

4. 保存した **JSON 鍵** の内容を **プライベートレジストリのサービス アカウントキー** 欄に貼り付け、
5. クリック **レジストリを接続** 設定を保存します。


---

# 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/docs/docs-ja/autofix-to/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.
