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

[Feature]: Adopting ruff for Unified Code Formatting and Linting #1073

Closed
Undertone0809 opened this issue Dec 9, 2023 · 2 comments
Closed
Labels
enhancement New feature or request

Comments

@Undertone0809
Copy link
Contributor

Undertone0809 commented Dec 9, 2023

The Feature

Hi there,

To ensure our project's code quality and consistency, I propose that we consider adopting ruff as our primary tool for code formatting and linting. ruff is a cutting-edge tool that amalgamates the capabilities of black, isort, and flake8, facilitating the automation of code style standardization to enhance readability and maintainability.

ref: enhancing-python-code-quality-a-comprehensive-guide-to-linting-with-ruff

I have explored configuring ruff and found that we can seamlessly integrate it by adding some basic settings to our pyproject.toml. This approach ensures uniform code styling without the need for manual adjustments across multiple tools. For reference, here's a template: Python Package Template.

image

Within our development workflow, we can format our code using the following command:

poetry run ruff format --config pyproject.toml litellm

This command will format the code within the hooks and tests directories, ensuring consistency before commits.

Moreover, I recommend integrating ruff into our pre-commit hooks. This automatic check will prevent code style inconsistencies from being merged into our codebase.

Finally, to guarantee consistent code styling throughout our project, I suggest employing GitHub Actions to automate code format checking. This ensures that any commits not adhering to our styling standards are flagged for correction before merging into the main branch.

image

By adopting ruff, I believe we can further elevate our code quality and foster a smoother collaborative experience for our team. I look forward to hearing your thoughts and am happy to answer any questions regarding this proposal.

There projects use code format tool as references.

Developers can not pass the github actions check if there is no formatting. To ensure consistency in code style.

image

Motivation, pitchzh

To ensure our project's code quality and consistency.

@Undertone0809 Undertone0809 added the enhancement New feature or request label Dec 9, 2023
@Undertone0809
Copy link
Contributor Author

@krrishdholakia Hope to receive your feedback 👋

@ishaan-jaff
Copy link
Contributor

FYI we use isort + flake8 linting throughout the litellm code base now

@Undertone0809 I'm closing this issue since we've address the concern of adding linting / code formatting

Feel free to open a new issue for moving to ruff

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

Successfully merging a pull request may close this issue.

2 participants