AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Update run.sh

Open itsmarble opened this issue 1 year ago • 3 comments

Background

I noticed that our current implementation does not efficiently handle the execution of Python scripts when both Python 2 and Python 3 are installed on the user's system. This pull request addresses this issue by modifying the shell script to be compatible with both "python" and "python3" commands.

Changes

  • Created a new function find_python_command() to check for the availability of "python" or "python3" and return the appropriate command.
  • Replaced the static "python" command with the dynamic command obtained from the find_python_command() function throughout the script.
  • Adjusted the script to work with both "python" and "python3" commands, ensuring compatibility with various user environments.

Documentation

The changes are documented through in-code comments in the shell script itself. Fix for #2992 && #2974

Test Plan

I have tested the modified shell script on systems with only Python 2 installed, only Python 3 installed, and both Python versions installed. In each case, the script correctly identified the available Python version and executed the required commands using the appropriate "python" or "python3" command.

PR Quality Checklist

  • [x] My pull request is atomic and focuses on a single change.
  • [ ] 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.
  • [x] I have not snuck in any "extra" small tweaks changes [twin: #3783]

itsmarble avatar May 03 '23 18:05 itsmarble

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

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 4, 2023 5:57pm

vercel[bot] avatar May 03 '23 18:05 vercel[bot]

Codecov Report

Patch coverage has no change and project coverage change: -0.02 :warning:

Comparison is base (fad24b3) 60.96% compared to head (25894a1) 60.95%.

:exclamation: Current head 25894a1 differs from pull request most recent head f167818. Consider uploading reports for the commit f167818 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3752      +/-   ##
==========================================
- Coverage   60.96%   60.95%   -0.02%     
==========================================
  Files          72       71       -1     
  Lines        3302     3296       -6     
  Branches      542      539       -3     
==========================================
- Hits         2013     2009       -4     
+ Misses       1151     1149       -2     
  Partials      138      138              

see 6 files with indirect coverage changes

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar May 03 '23 18:05 codecov[bot]

Great, thank you! I was working on it too.

smtdev avatar May 04 '23 09:05 smtdev