> 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. 「レジストリに接続」をクリックすると、設定モーダルが表示されます

<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. ［レジストリに接続］をクリックして環境変数を保存します。

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. 「レジストリに接続」をクリックすると、設定モーダルが表示されます

<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.
