Closed6

GitHub Copilot Extensionお試し

kaakaakaakaa

GitHub Copilot ExtensionsがPublic Betaを募集しているようだったので申請していたら、Invitationが届いたので触ってみる。
https://x.com/GHchangelog/status/1823410921378623678

上のポストを見て、その日に申請していたので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.

kaakaakaakaa

https://github.com/marketplace?type=apps&copilot_app=true
Copilot Extensionsはここからインストールする模様。


Extensionの公開は申請制らしく、まだ数は少ない。
SentryとかLaunchDarklyとかNew Relicとか、サービス使ってないと使えなさそうなのが多い。Teams Toolkitとかもあるんだな...。

とりあえずDockerが一番身近っぽいのでそれを使ってみる。

kaakaakaakaa

拡張機能のページの下の方にInstallボタンがある。有償版を提供することもできるらしい。

支払い情報を確認し、インストール先を選ぶ。リポジトリごとにインストール可否を設定できるらしい。

kaakaakaakaa

インストール完了後、Copilot Chatで @ を入力すると @docker が増えている。

最初に問い合わせた際、Authorizeを求められる。

kaakaakaakaa

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の問い合わせ内容に含めるか、ファイル内容を選択した上でファイル内でチャットする必要がありそう。まぁ、やるとしたら後者かな。
ただ、複数ファイルとか指定できないので、細かい部分ごとの会話になりそう。

kaakaakaakaa

Dockerっぽい質問について考える。

FROM python:3.5

MAINTAINER Yusuke Nemoto <stooner.hoe@gmail.com>

ENV DEBIAN_FRONTEND noninteractive
  1. 使用しているpythonのバージョンが古い
  2. DeprecatedなMAINTAINERを使用している
  3. 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だけで十分そう。

このスクラップは2024/09/24にクローズされました