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

Use ruff and a code formatter #145

Open
janluke opened this issue Nov 28, 2022 · 3 comments
Open

Use ruff and a code formatter #145

janluke opened this issue Nov 28, 2022 · 3 comments
Labels

Comments

@janluke
Copy link
Owner

janluke commented Nov 28, 2022

black is the obvious choice but I tend to dislike it, especially for CLI code, which tends to take too much vertical space when formatted with black.

The tools should be integrated with tox and github actions.

@janluke janluke added the chore label Nov 28, 2022
@kdeldycke
Copy link
Contributor

FWIW, and for inspiration, here is my workflow to auto-format Python code with a mix of isort, pycln, docformatter, autopep8 and black: https://github.com/kdeldycke/workflows/blob/09513de7b01bae8f0c105a37ed72394500e1f7aa/.github/workflows/autofix.yaml#L94-L149

@janluke janluke changed the title Use isort and a code formatter Use ruff and a code formatter Feb 10, 2024
@ulgens
Copy link
Contributor

ulgens commented Aug 3, 2024

Hey,

I can handle this one. I have this sample configuration with ruff, pre-commit and Github Actions:

The beauty of this setup is fully automated and requires minimal effort to change rules / settings. I'm planning to adapt that in this repo too, if that sounds okay.

@janluke
Copy link
Owner Author

janluke commented Aug 23, 2024

You're very welcome to contribute if you want but keep in mind the following:

  • I think pre-commit is redundant with tox: it mostly creates venvs where to run tools; if a developer wants to run linters automatically on each commit, she/he can just call tox in the git hook script; if we want to make that even easier, we can add a Makefile command that does this for the developer (e.g. echo "tox -e lint" >> <hook_path>)
  • I'm all for a code formatter, but I've been hesitant on adopting black in this repo, because black makes the typical cloup/click code take a lot of vertical space.

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

No branches or pull requests

3 participants