AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Basic Code Quality

Open ryanpeach opened this issue 1 year ago • 20 comments

Can we please improve code quality a little:

  1. black formatting
  2. flake8 & isort pull request checks.
  3. An __init__.py in the scripts folder. Absolute imports.
  4. Rename main.py to __main__.py or add if __name__ == "__main__": after the function definitions.
  5. Maybe a little folder organization in the scripts folder.
  6. Maybe run github copilot labs code commenting on the repo

ryanpeach avatar Apr 04 '23 02:04 ryanpeach

I can help restructure the code.

subramanya1997 avatar Apr 04 '23 03:04 subramanya1997

@subramanya1997 Be my guest but I just put in 3 basic PR's so lets try not to code duplicate.

One note I don't think we can safely run black or autopep8 on this repo since there are so many contributions. Best we can do is fix manually with flake8.

ryanpeach avatar Apr 04 '23 03:04 ryanpeach

https://github.com/Torantulino/Auto-GPT/pull/33

ryanpeach avatar Apr 04 '23 05:04 ryanpeach

i had some work to add black, flake8, isort and pre-commit hooks as well 💀 maybe we should coordinate work on an issue-tracker? cc @Torantulino

@ryanpeach

yousefissa avatar Apr 04 '23 05:04 yousefissa

Issue tracker is very essential.

subramanya1997 avatar Apr 04 '23 05:04 subramanya1997

@ryanpeach but if everyone is using the same formatting tool and it's required for every commit, where is the problem ? I agree the only issue is that the current PRs will have issues.

I would say it's better to do it now than never, as the code base grows it will be even harder to add pep8 or black

waynehamadi avatar Apr 04 '23 06:04 waynehamadi

I already finished something, I'm waiting for feedback.

AndresCdo avatar Apr 04 '23 09:04 AndresCdo

Please recommend an issue tracker for us to use. :)

#141 Makes this Issue sound very concerning.

Torantulino avatar Apr 04 '23 10:04 Torantulino

Re: #141

I think if you want to do black or autopep8 you need to do it all at once in one PR as the codeowner and make an announcement. If anyone opens a pr for it and then you merge anything else it's just gonna be a mess. I agree it's probably best to do it, but you need to do it yourself and yes, earlier is better.

I'd choose black and not autopep8.

In your workflow, don't do a commit, just do black --check. Make the user format their own files.

ryanpeach avatar Apr 04 '23 12:04 ryanpeach

Re issue tracker, probably Trello or just GitHub Issues.

Do we need a separate issue tracker or do we just need to deduplicate issues, tag issues by importance, and make issues before making PR's.

ryanpeach avatar Apr 04 '23 12:04 ryanpeach

It will get more difficult each day. But it is unavoidable soon or later. Btw, why no one suggests YAPF instead of black? It is more opinionated afaik; so it is better to make sure every contributor use same formatting.

ufukty avatar Apr 04 '23 12:04 ufukty

https://github.com/Torantulino/Auto-GPT/pull/153

ryanpeach avatar Apr 04 '23 15:04 ryanpeach

Oh we should also add debug logging, and a pre-commit file to this issue.

ryanpeach avatar Apr 04 '23 15:04 ryanpeach

@Torantulino can you give this issue a tag for long term tracking and discussion?

ryanpeach avatar Apr 04 '23 15:04 ryanpeach

Maybe in the next wave of PRs we could pull this in last? It would make life a lot better

dschonholtz avatar Apr 04 '23 22:04 dschonholtz

https://github.com/Torantulino/Auto-GPT/pull/444

ryanpeach avatar Apr 08 '23 02:04 ryanpeach

@Torantulino we should organise it asap. It's gonna take too much to resolve all issues/PRs. Let us know how we can help.

subramanya1997 avatar Apr 08 '23 02:04 subramanya1997

https://github.com/Torantulino/Auto-GPT/pull/350#issuecomment-1500765044

ryanpeach avatar Apr 08 '23 02:04 ryanpeach

Changing CONTRIBUTING.md to have contributors use pre-commit hooks (adding pre-commit-hooks.yaml, running update, install, etc.) would do a lot of future-proofing for this project.

For docs, interrogate.py is also available as a pre-commit hook.

Pre-commit is easy to use and thanks to this site it's also easy to learn how to use.

With the growing amount of attention on this project it needs the added protection! Since the number of warnings pre-commit hooks would require fixes for will only grow until the past ones are dealt with, I would propose that such a feature and the corresponding added docs and other fixes get prioritized. It will only get worse with time.

seporterfield avatar Apr 09 '23 20:04 seporterfield

I think all of the items from the OP have been fixed, no?

Pwuts avatar Apr 16 '23 17:04 Pwuts

@Pwuts yes I think so.

subramanya1997 avatar Apr 16 '23 18:04 subramanya1997

Closing as completed. If not, feel free to reopen and clarify.

Pwuts avatar Apr 17 '23 22:04 Pwuts