> 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/autofixto/connect-private-packages/poetry-private-packages.md).

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

Aikido がプライベートパッケージを含む依存関係を更新するには、正確なロックファイルの更新を生成できるよう、プライベートレジストリへのアクセスが必要です。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="https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-9266e8da54be5ee4e49440d10a643bfa587a37ac%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

3. Poetry を選択し、次に `POETRY_HTTP_BASIC_[SOURCE_NAME]_USERNAME` と `POETRY_HTTP_BASIC_[SOURCE_NAME]_PASSWORD` 環境変数を追加できます:

<figure><img src="https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-1471a48db11d8569084d6a0b46ec19e742a199c4%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

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

AWS CodeArtifact を Poetry と組み合わせて使用している場合、パスワードはその都度生成する必要があります。こちらを参照してください [ページ](/docs/docs-ja/autofixto/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」ロールを割り当てる。](https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-470613549ee0a8658f15c041e95ba41c95f1daa0%2Fucarecdn-8d6db05a-1848-4c9e-8d0a-5bd824229aa9.jpeg?alt=media)
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. クリック **鍵を追加** > **新しい鍵を作成**.
4. 選択 **JSON** を開き、 **作成**.
5. JSON キーファイルを安全な場所に保存します。

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

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

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

<figure><img src="https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-9266e8da54be5ee4e49440d10a643bfa587a37ac%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-0250b5fe981db93bf11f24e1dfce83d955ca01c5%2Fimage.png?alt=media" 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/autofixto/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.
