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

Apply consistent coding and documenting styling #273

Open
liyin2015 opened this issue Nov 21, 2024 · 11 comments · May be fixed by #295
Open

Apply consistent coding and documenting styling #273

liyin2015 opened this issue Nov 21, 2024 · 11 comments · May be fixed by #295
Labels
[adalflow] suggest improvement Improve existing functionality (non-integration] in /adalflow help wanted Need helps with input, discussion, review, and PR submission. P1 2nd priority

Comments

@liyin2015
Copy link
Member

Outline & Motivation

Without enforcing the same formatting, developers end up committing code/files that only changes formatting, making it hard to review.

Pitch

We might need a Makefile and add either the formatting here and modify the root pyproject.toml, as described in the contributor guide that commit hook is applied here.

Additional context

No response

@fm1320
Copy link
Collaborator

fm1320 commented Nov 21, 2024

Doesn't just running the pre-commit hooks locally (black and ruff) ensure this consistency ?

@liyin2015
Copy link
Member Author

Doesn't just running the pre-commit hooks locally (black and ruff) ensure this consistency ?

If that is the case, how did your pr results so many different files?

@liyin2015 liyin2015 added the [adalflow] suggest improvement Improve existing functionality (non-integration] in /adalflow label Nov 21, 2024
@fm1320
Copy link
Collaborator

fm1320 commented Nov 21, 2024

I ran the pre-commit hooks on all files before committing so the changes are white spaces and formatting that the linter enforced - I only modified one file in my PR

@liyin2015
Copy link
Member Author

liyin2015 commented Nov 21, 2024

there is no black and ruff config in the pyproject.toml. Maybe your configuration and the others somehow end up being different. Ill add a simple version and you can rebase on this, and try to use the format and test if those files can be set back

@liyin2015
Copy link
Member Author

@liyin2015 liyin2015 added the help wanted Need helps with input, discussion, review, and PR submission. label Nov 21, 2024
@liyin2015
Copy link
Member Author

Feel free to review, merge and test it on your side

You can use make setup and make format, make lint etc

@fm1320
Copy link
Collaborator

fm1320 commented Nov 21, 2024

Yes I assumed that the fact that they were part of the .pre-commit-config.yaml means they are enforced. I will have a look

@fm1320
Copy link
Collaborator

fm1320 commented Nov 22, 2024

I ran the pre-commit hooks suggested on all files, made the changes 3196631. Maybe this can be merged and then the styling will be consistent ? @liyin2015

@liyin2015
Copy link
Member Author

  • Three files need further improvement so that we can enforce pre-commit check on formatting and linting. (1) Makefile (2) pyproject.toml on the relevant confi (3).pre-commit-config.yaml

@liyin2015 liyin2015 added the P1 2nd priority label Nov 22, 2024
@lu-ny
Copy link
Contributor

lu-ny commented Nov 28, 2024

Proposed Changes

  1. Update the formatting tools configuration:

    • Add explicit Black and Ruff configurations to root pyproject.toml
    • Configure both tools to use the same line length (88) and Python version
    • Set consistent exclude patterns for docs and non-Python files
  2. Improve the Makefile commands:

    • Make format and lint commands use the pyproject.toml config
    • Add Ruff format alongside Black for complete formatting coverage
  3. Update .pre-commit-config.yaml:

    • Point all hooks to use the pyproject.toml config
    • Add Ruff format hook
    • Maintain consistent exclude patterns

Implementation steps:

  1. Add proposed configurations
  2. Run make setup and make format on all files
  3. Verify with make lint

This should resolve the inconsistent formatting issues we're seeing across PRs. I can implement these changes if everyone agrees with this approach.

@fm1320
Copy link
Collaborator

fm1320 commented Dec 6, 2024

Proposed Changes

  1. Update the formatting tools configuration:

    • Add explicit Black and Ruff configurations to root pyproject.toml
    • Configure both tools to use the same line length (88) and Python version
    • Set consistent exclude patterns for docs and non-Python files
  2. Improve the Makefile commands:

    • Make format and lint commands use the pyproject.toml config
    • Add Ruff format alongside Black for complete formatting coverage
  3. Update .pre-commit-config.yaml:

    • Point all hooks to use the pyproject.toml config
    • Add Ruff format hook
    • Maintain consistent exclude patterns

Implementation steps:

  1. Add proposed configurations
  2. Run make setup and make format on all files
  3. Verify with make lint

This should resolve the inconsistent formatting issues we're seeing across PRs. I can implement these changes if everyone agrees with this approach.

Yea I think this works you can do a PR again if you wish. Thanks

@lu-ny lu-ny linked a pull request Dec 11, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[adalflow] suggest improvement Improve existing functionality (non-integration] in /adalflow help wanted Need helps with input, discussion, review, and PR submission. P1 2nd priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants