GitHub Copilot Extensionお試し

GitHub Copilot ExtensionsがPublic Betaを募集しているようだったので申請していたら、Invitationが届いたので触ってみる。
上のポストを見て、その日に申請していたのでwaitlistは数日程度。思ったより早かった。
ちなみに、GitHub Copilot Extensions
はIDE向けのGitHub Copilot拡張機能(extension)のことではなく、GitHub Copilotのチャットを拡張できる機能のこと。
Introducing GitHub Copilot Extensions: Unlocking unlimited possibilities with our ecosystem of partners - The GitHub Blog
公式としてもややこしい名前だとは思っている模様。
Using extensions to integrate external tools with Copilot Chat - GitHub Docs
GitHub Copilot Extensions are not the same as the GitHub Copilot extension, which you install in an external application to access Copilot within that application.

Copilot Extensionsはここからインストールする模様。
Extensionの公開は申請制らしく、まだ数は少ない。
SentryとかLaunchDarklyとかNew Relicとか、サービス使ってないと使えなさそうなのが多い。Teams Toolkitとかもあるんだな...。
とりあえずDockerが一番身近っぽいのでそれを使ってみる。

拡張機能のページの下の方にInstallボタンがある。有償版を提供することもできるらしい。
支払い情報を確認し、インストール先を選ぶ。リポジトリごとにインストール可否を設定できるらしい。

インストール完了後、Copilot Chatで @
を入力すると @docker
が増えている。
最初に問い合わせた際、Authorizeを求められる。

Copilot Chat内では@
メンションは一つしか指定できないので、@docker
と@workspace
を付けてworkspace全体に対する会話はできない。さらに、
@docker
に対して #file:path
を付けて質問しても、ファイルの内容を読んでくれない。
#editor
も使えない。
Please tell me about the potentially problematic statements in this file
#selection
は読んでくれそう?
(ただ、回答内容にあるbottle@0.12.8
は参照させてるファイルに書かれているわけではなく、別のファイルに依存関係として宣言しているものなので、なんでそれが読めてるのか謎。なんか怪しくなってきた。)
ファイルの内容について問い合わせをしたいときは、CopilotChatの問い合わせ内容に含めるか、ファイル内容を選択した上でファイル内でチャットする必要がありそう。まぁ、やるとしたら後者かな。
ただ、複数ファイルとか指定できないので、細かい部分ごとの会話になりそう。

Dockerっぽい質問について考える。
FROM python:3.5
MAINTAINER Yusuke Nemoto <stooner.hoe@gmail.com>
ENV DEBIAN_FRONTEND noninteractive
- 使用しているpythonのバージョンが古い
- Deprecatedな
MAINTAINER
を使用している - Deprecatedな
ENV
の書き方をしているENV DEBIAN_FRONTEND=noninteractive
と書くべき
通常のCopilot Chat
#selection Are there any points to be improved?
GitHub Copilot:
はい、いくつかの改善点があります。
1. Pythonバージョンの更新:
* python:3.5は古いバージョンです。セキュリティやパフォーマンスの観点から、最新の安定バージョンに更新することをお勧めします。
2. MAINTAINER命令の非推奨:
* MAINTAINER命令は非推奨です。代わりにLABELを使用してください。
LABEL maintainer="Yusuke Nemoto <stooner.hoe@gmail.com>"
3. DEBIAN_FRONTENDの設定:
* ENV DEBIAN_FRONTEND noninteractiveは、対話的なインストールを避けるために使用されますが、これを設定する場合は、後続のRUN命令の中でのみ設定する方が良いです。例えば、apt-getコマンドの前に設定します。
改善後の例:
FROM python:3.9-slim
LABEL maintainer="Yusuke Nemoto <stooner.hoe@gmail.com>"
RUN apt-get update && apt-get install -y --no-install-recommends \
...
Docker Extension
@docker Are there any points to be improved in the following code?
FROM python:3.5
MAINTAINER Yusuke Nemoto stooner.hoe@gmail.com
ENV DEBIAN_FRONTEND noninteractive
docker:
@kaakaa, yes, there are a few things to consider and potentially improve in this Dockerfile:
1. Old Python Version: The Python version you're using is 3.5, which is not maintained anymore. It's recommended to use a newer version of Python that still receives updates and patches. Consider upgrading to a supported version such as Python 3.9 or 3.10.
2. Deprecated MAINTAINER: The MAINTAINER instruction is deprecated. Instead, you should use the LABEL instruction which is more flexible, for example, LABEL maintainer="Yusuke Nemoto <stooner.hoe@gmail.com>".
3. ENV instruction: The ENV instruction sets the environment variable DEBIAN_FRONTEND to noninteractive. This is not recommended for Docker images, as it can cause unexpected behavior in child images and containers based on the image. Use ARG DEBIAN_FRONTEND=noninteractive instead during the building phase.
Here's an improved version of your Dockerfile snippet:
FROM python:3.10
LABEL maintainer="Yusuke Nemoto <stooner.hoe@gmail.com>"
ARG DEBIAN_FRONTEND=noninteractive
Remember to revert DEBIAN_FRONTEND back to its default value newt at the end of Dockerfile.
お題が簡単なので、あまり差はなく。
- Copilot Chatの方は、
#selection
で与えたところ以外も読んでいる (apt-get
を把握してる) - Docker Extensionの方、公式ドキュメントをreferenceしてくれると期待したけど、特にそういうことはない
- Docker Extensionに
#file
や#selection
を使って内容を与えられないのはやはり不便
もう少し深いところの例を使わないとDocker Extensionの良さは見えてこなそう。簡単な部分だけならCopilot Chatだけで十分そう。