Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recipe for chatgpt-shell #8479

Merged
merged 2 commits into from
Apr 24, 2023
Merged

Add recipe for chatgpt-shell #8479

merged 2 commits into from
Apr 24, 2023

Conversation

xenodium
Copy link
Contributor

@xenodium xenodium commented Apr 10, 2023

Brief summary of what the package does

ChatGPT and DALL-E Emacs shells + Org Babel support.

Also includes shell-maker, a way to create shells for any other service (local or cloud).

Direct link to the package repository

https://github.com/xenodium/chatgpt-shell

Your association with the package

Author

Relevant communications with the upstream package maintainer

None needed

Checklist

@progfolio
Copy link
Member

progfolio commented Apr 11, 2023

Related: #8452
I would ensure all comments/questions there are addressed.

@xenodium
Copy link
Contributor Author

@progfolio Not sure why that proposal was submitted. The package didn't pass all the usual checks then nor I was pinged about it (I'm the package owner/author).

I'll address anything pending from that thread.

@xenodium xenodium mentioned this pull request Apr 11, 2023
6 tasks
@xenodium
Copy link
Contributor Author

The package didn't pass all the usual checks then nor I was pinged about it (I'm the package owner/author).

Sorry. I missed a mention in xenodium/chatgpt-shell#4

In any case, happy to fix any outstanding issues. I think they are all resolved in the latest snapshot?

@xenodium
Copy link
Contributor Author

I would ensure all comments/questions there are addressed.

I think all from #8452 should be cleared now.

@riscy #8452 (comment)

Thanks for this. Have you had a chance to check out the other ChatGPT packages that have been added to MELPA? It's worth describing how this package differs, since there have been a few of these lately.

  • Only package so far that implements these services as a comint shell, so Emacs users get shell familiarity and are able to add typical customizations.
  • Only package so far that implements these services as org babel languages (similar benefits), see ob-chatgpt-shell.el ob-dall-e-shell.el.
  • Supports both ChatGPT and DALL-E.
  • Not sure if it matters, but package seems to be getting somewhat popular (300 github stars in 3 weeks).
  • Includes shell-maker a generic shell helper. Should help users adding more services other than ChatGPT or DALL-E, with little code:
(require 'shell-maker)

(defvar greeter-shell--config
  (make-shell-maker-config
   :name "Greeter"
   :execute-command
   (lambda (command _history callback _error-callback)
     (funcall callback
              (format "Hello \"%s\"" command)
              nil))))

(defun greeter-shell ()
  "Start a Repeater shell."
  (interactive)
  (shell-maker-start greeter-shell--config))

Also note that your Package-Requires has to be all on one line, per package-lint:

Fixed. It's one line in latest.

As for all the other byte compilation issues, should be all addressed:

Compiling file chatgpt-shell/chatgpt-shell.el at Wed Apr 12 10:33:24 2023
Compiling file chatgpt-shell/dall-e-shell.el at Wed Apr 12 10:33:25 2023
Compiling file chatgpt-shell/ob-chatgpt-shell.el at Wed Apr 12 10:33:25 2023
Compiling file chatgpt-shell/ob-dall-e-shell.el at Wed Apr 12 10:33:25 2023

package-lint-current-buffer for chatgpt-shell.el dall-e-shell.el ob-chatgpt-shell.el ob-dall-e-shell.el

No issues found.

checkdoc for chatgpt-shell.el dall-e-shell.el ob-chatgpt-shell.el ob-dall-e-shell.el

Buffer comments and tags:  Ok
Documentation style:       Ok
Message/Query text style:  Ok
Unwanted Spaces:           Ok

@riscy
Copy link
Member

riscy commented Apr 16, 2023

Thank you for this -- your rationale above is good, and this looks like a solid effort.

Note the recipe is implicitly including the following source files:

  • GPL* -- chatgpt-shell.el: Interaction mode for ChatGPT
  • GPL* -- dall-e-shell.el: Interaction mode for DALL-E
  • GPL* -- ob-chatgpt-shell.el: Org babel functions for ChatGPT evaluation
  • GPL* -- ob-dall-e-shell.el: Org babel functions for DALL-E evaluation
  • GPL* -- shell-maker.el: Interaction mode for making comint shells

However, I think only chatgpt-shell and shell-maker are required for chatgpt-shell. You should either submit a separate recipe for shell-maker and depend on it using Package-Requires, or have it adhere to the prefix rules for chatgpt-shell (you'll see the corresponding package-lint nags below). Here's a quick first pass of those files:

chatgpt-shell.el with melpazoid:

- chatgpt-shell.el#L838: It's safer to sharp-quote function names; use `#'`
- chatgpt-shell.el#L79: It's safer to sharp-quote function names; use `#'`
- chatgpt-shell.el#L205: It's safer to sharp-quote function names; use `#'`
- chatgpt-shell.el#L207: It's safer to sharp-quote function names; use `#'`

shell-maker.el with package-lint 20230315.1052:

56 issues found:
7:0: error: Package-Requires outside the main file have no effect.
41:0: error: "shell-maker-display-function" doesn't start with package's prefix "chatgpt-shell".
46:0: error: "shell-maker-read-string-function" doesn't start with package's prefix "chatgpt-shell".
58:0: error: "shell-maker-logging" doesn't start with package's prefix "chatgpt-shell".
65:0: error: "shell-maker--input" doesn't start with package's prefix "chatgpt-shell".
67:0: error: "shell-maker--current-request-id" doesn't start with package's prefix "chatgpt-shell".
69:0: error: "shell-maker--show-invisible-markers" doesn't start with package's prefix "chatgpt-shell".
71:0: error: "shell-maker--prompt-internal" doesn't start with package's prefix "chatgpt-shell".
81:0: error: "shell-maker--busy" doesn't start with package's prefix "chatgpt-shell".
83:0: error: "shell-maker-config" doesn't start with package's prefix "chatgpt-shell".
85:0: error: "shell-maker--file" doesn't start with package's prefix "chatgpt-shell".
87:0: error: "shell-maker--request-process" doesn't start with package's prefix "chatgpt-shell".
89:0: error: Aliases should start with the package's prefix "chatgpt-shell".
91:0: error: "shell-maker-map" doesn't start with package's prefix "chatgpt-shell".
103:0: error: "shell-maker-start" doesn't start with package's prefix "chatgpt-shell".
107:0: error: "shell-maker-mode" doesn't start with package's prefix "chatgpt-shell".
129:0: error: "shell-maker--initialize" doesn't start with package's prefix "chatgpt-shell".
175:0: error: "shell-maker--write-reply" doesn't start with package's prefix "chatgpt-shell".
187:0: error: "shell-maker-return" doesn't start with package's prefix "chatgpt-shell".
194:0: error: "shell-maker-search-history" doesn't start with package's prefix "chatgpt-shell".
209:0: error: "shell-maker-last-output" doesn't start with package's prefix "chatgpt-shell".
223:0: error: "shell-maker--read-input-ring-history" doesn't start with package's prefix "chatgpt-shell".
233:0: error: "shell-maker--write-input-ring-history" doesn't start with package's prefix "chatgpt-shell".
238:0: error: "shell-maker--output-at-point" doesn't start with package's prefix "chatgpt-shell".
283:0: error: "shell-maker-narrow-to-prompt" doesn't start with package's prefix "chatgpt-shell".
296:0: error: "shell-maker--prompt-end-position" doesn't start with package's prefix "chatgpt-shell".
303:0: error: "shell-maker-mark-output" doesn't start with package's prefix "chatgpt-shell".
350:0: error: "shell-maker--prompt-begin-position" doesn't start with package's prefix "chatgpt-shell".
369:0: error: "shell-maker-save-output" doesn't start with package's prefix "chatgpt-shell".
392:0: error: "shell-maker-interrupt" doesn't start with package's prefix "chatgpt-shell".
413:0: error: "shell-maker--eval-input" doesn't start with package's prefix "chatgpt-shell".
482:0: error: "shell-maker--announce-response" doesn't start with package's prefix "chatgpt-shell".
487:0: error: "shell-maker-async-shell-command" doesn't start with package's prefix "chatgpt-shell".
558:0: error: "shell-maker--json-parse-string-filtering" doesn't start with package's prefix "chatgpt-shell".
574:0: error: "shell-maker--increment-request-id" doesn't start with package's prefix "chatgpt-shell".
580:0: error: "shell-maker--set-pm" doesn't start with package's prefix "chatgpt-shell".
586:0: error: "shell-maker--pm" doesn't start with package's prefix "chatgpt-shell".
591:0: error: "shell-maker--input-sender" doesn't start with package's prefix "chatgpt-shell".
596:0: error: "shell-maker--send-input" doesn't start with package's prefix "chatgpt-shell".
602:0: error: "shell-maker--get-old-input" doesn't start with package's prefix "chatgpt-shell".
611:0: error: "shell-maker--json-encode" doesn't start with package's prefix "chatgpt-shell".
617:0: error: "shell-maker--curl-version-supported" doesn't start with package's prefix "chatgpt-shell".
625:0: error: "shell-maker--json-parse-string" doesn't start with package's prefix "chatgpt-shell".
635:0: error: "shell-maker--write-partial-reply" doesn't start with package's prefix "chatgpt-shell".
641:0: error: "shell-maker--preparse-json" doesn't start with package's prefix "chatgpt-shell".
660:0: error: "shell-maker--command-and-response-at-point" doesn't start with package's prefix "chatgpt-shell".
672:0: error: "shell-maker--write-output-to-log-buffer" doesn't start with package's prefix "chatgpt-shell".
686:0: error: "shell-maker--process" doesn't start with package's prefix "chatgpt-shell".
690:0: error: "shell-maker-save-session-transcript" doesn't start with package's prefix "chatgpt-shell".
711:0: error: "shell-maker--extract-history" doesn't start with package's prefix "chatgpt-shell".
739:0: error: "shell-maker--output-filter" doesn't start with package's prefix "chatgpt-shell".
789:0: error: "shell-maker-buffer" doesn't start with package's prefix "chatgpt-shell".
793:0: error: "shell-maker-buffer-name" doesn't start with package's prefix "chatgpt-shell".
799:0: error: "shell-maker-process-name" doesn't start with package's prefix "chatgpt-shell".
803:0: error: "shell-maker-history-file-path" doesn't start with package's prefix "chatgpt-shell".
810:0: error: "shell-maker-prompt" doesn't start with package's prefix "chatgpt-shell".

shell-maker.el with melpazoid:

- shell-maker.el#L423: It's safer to sharp-quote function names; use `#'`

@xenodium
Copy link
Contributor Author

Thanks for the guidance!

You should either submit a separate recipe for shell-maker and depend on it using Package-Requires

If I'm understanding correctly, the recipe split should look something like the following (also in the latest commit in PR):

melpa/recipes/chatgpt-shell

(chatgpt-shell
 :fetcher github
 :repo "xenodium/chatgpt-shell"
 :files ("chatgpt-shell.el"))

melpa/recipes/shell-maker

(shell-maker
 :fetcher github
 :repo "xenodium/chatgpt-shell"
 :files ("shell-maker.el"))

chatgpt-shell/chatgpt-shell.el

;; Package-Requires: ((emacs "27.1") (shell-maker "0.17.1"))

@riscy
Copy link
Member

riscy commented Apr 19, 2023

I'll be able to take a closer look on the weekend, but yes those recipes look correct.

@xenodium
Copy link
Contributor Author

I'll be able to take a closer look on the weekend, but yes those recipes look correct.

Thank you.

I gave melpazoid a try though I wasn't too sure if it can handle two new recipes pointing to same repo but different files.

I was hopeful of the PR usage as both new recipes are now part of the PR

MELPA_PR_URL=https://github.com/melpa/melpa/pull/8479 make

python3 melpazoid/melpazoid.py

sha256:8fe540c3fd783e01928dbd51e157c3ddb4fac44cf64798b586825cc73ccc0f13

chatgpt-shell.el with byte-compile using Emacs 28.1:

chatgpt-shell.el:37:1: Error: Cannot open load file: No such file or directory, shell-maker

chatgpt-shell.el with package-lint 20230315.1052:

1 issue found:
8:38: error: Package shell-maker is not installable.

#'load-check on each file:

Loading chatgpt-shell.el
  chatgpt-shell.el:Error: Emacs 28.1:
  (file-missing "Cannot open load file" "No such file or directory" "shell-maker")

Package and license:

  • Prefer the default recipe or :defaults, if possible.
  • GNU General Public License v3.0 (via API)
  • GPL* -- chatgpt-shell.el: Interaction mode for ChatGPT

sha256:ba5ce5f5d8566bc2e936a56c56c31a8d4b540ae04c65015fdd1e3ec4ca9ca933

Package and license:

  • Prefer the default recipe or :defaults, if possible.
  • GNU General Public License v3.0 (via API)
  • GPL* -- shell-maker.el: Interaction mode for making comint shells

@riscy
Copy link
Member

riscy commented Apr 24, 2023

These look good. Thank you!

(Yes, melpazoid should be able to handle PRs with two or more recipes, although when the dependents aren't yet installable it will obviously struggle.)

@riscy riscy merged commit c7f36f6 into melpa:master Apr 24, 2023
1 check passed
@xenodium
Copy link
Contributor Author

Many thanks for your help @riscy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants