AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Formalize Bash, Batch Scripts, Add PowerShell Script

Open loopyd opened this issue 2 years ago • 4 comments

Background

I noticed that the base scripts where pretty basic, and springboard functionality directly into python without many sanity checks on arguments, declaring defaults, or really much of anything. Although argument parsing functionality is included in the autogpt/cli.py script itself via click, I felt it more 'robust' to create a compatible runboard that works cross-platform before python even gets called to validate things with the python environment. I find this approach to be more stable and compatible, so I decided to open up this PR to help stabilize the runscripts.

This PR is currently A DRAFT. If you wish to contribute to it, feel free! I will leave it open for a while to see how the community thinks about it.

Changes

  • Updated run.sh with full POSIX-compliant command line parser, usage screen and ANSI compatible colors via the use of tput.
  • Updated run.bat and formalize to embedded WIndows Server standards, with the same changes mentioned above.
  • Added run.ps1, a Powershell runscript that meets the same specifications mentioned
  • Extra functionality to run python inside of a virtualenv environment provides another convenient option, in these new scripts. Virtualenv support was not included, and now is via activate and deactivate commands that call upon the environment. The user also gets to specify the path of the virtual environment to use.
  • I also found some problems with some of the plugins suggested to be installed. So I installed them all, then froze requirements.txt into the base repository, this should simplify everything you need and saves the user download time later.
  • A minor fix was applied to .gitignore to ignore __pycache__ folders explicitly in subfolders
  • A fix was applied to docker-compose.yml so that the redis volume persists across docker runs, and saves correctly with the --appendonly Redis-Server option.

Draft Contribution Suggestions

  • Test it? Does it work, or display any errors on your machine?
  • Improve it? Do you have a suggestion to improve the run scripts, or make them even more stable?
  • Feedback? I'm happy to take this in before it goes into a live PR. Do you find this useful or beneficial to compatibility?

Documentation

I provide code comments in all of my script functions that explains what is happening. My code is very modular and easy to look at and maintain.

Test Plan

This was tested in the following environments:

  • WSL (windows subsystem for Linux) -- for the run.sh changes, on Ubuntu 22.04 LTS
  • Native Windows 11 / Windows 10 -- for the run.ps1 addition, on Powershell 7.3.4
  • Windows Server 2022 for embedded systems for the run.bat updates

PR Quality Checklist

  • [ ] My pull request is atomic and focuses on a single change.
  • [x] I have thoroughly tested my changes with multiple different prompts.
  • [x] I have considered potential risks and mitigations for my changes.
  • [x] I have documented my changes clearly and comprehensively.
  • [ ] I have not snuck in any "extra" small tweaks changes

loopyd avatar May 06 '23 13:05 loopyd

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) May 6, 2023 1:29pm

vercel[bot] avatar May 06 '23 13:05 vercel[bot]

This PR exceeds the recommended size of 200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size

github-actions[bot] avatar May 06 '23 13:05 github-actions[bot]

I also found some problems with some of the plugins suggested to be installed. So I installed them all, then froze requirements.txt into the base repository, this should simplify everything you need and saves the user download time later.

Can you expand on this? it may fit better in the plugins repo

ntindle avatar May 10 '23 05:05 ntindle

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

github-actions[bot] avatar May 10 '23 06:05 github-actions[bot]