Closed BjornFJohansson closed 3 months ago
Hi @BjornFJohansson, sounds good to me. This was not yet implement in dev_bjorn
, right?
Yes I run this before every commit. This means that the code is formatted automatically. Not nicer everywhere, but should be consistent.
Hi @BjornFJohansson I wonder if there are better ways to do this that don't involve asking the users to install pre-commit. We could add black
and flake8
as dev dependencies, and set up a git hook that runs on commit. This SO comment explains how this can be set up.
The advantage of something like this is that we can create a separate file with the rules we want black and flake8 to implement that are also interpreted by the IDE as you write. The IDE would show you the syntax suggestions in real time, and also allow you to format on save, what do you think? I have done this before with a repo.
Also, we could add a github action to check syntax if tests pass?
Sounds like a good idea. Do you have this running already?
I can give it a go eventually, I will assign myself to the issue.
In the meantime, can you include the instructions on how to install pre-commit and use it in the readme?
Will do
69b7ec7083 on the dev_bjorn branch has the instructions.
for installing it is simply
pip install pre-commit
Hi @BjornFJohansson I have some suggestions on how to incorporate this in poetry, so that it comes as you do poetry install
. In pyproject.toml:
[tool.poetry.group.dev.dependencies]
autopep8 = "^2.1.0"
black = "^24.4.1"
flake8-bugbear = [
{version = ">=24.4.21", python = ">=3.8.1"},
]
pre-commit = [
{version = ">3.6", python = ">=3.9"},
{version = "<3.6", python = "<3.9"},
]
Let me know where should I target with my PR, and I will add this. Also, you mentioned that https://github.com/BjornFJohansson/pydna/commit/69b7ec7083621303f3317f6f0601e255656a7fcb containted the instructions, but I can't see a README with those instructions anymore. Maybe this commit got lost?
Hi, Ill have a look and get back to you asap.
I use pre-commit https://pre-commit.com with this settings file: .pre-commit-config.yaml
This autoformats the code before each commit. The pyproject.toml contains:
This means that the line lenght will be 119 which I think is used by the django project.
@manulera , do you agree with this ocr do you have another suggestion?