fax icon indicating copy to clipboard operation
fax copied to clipboard

Is there a set of minimal formatting guidelines we follow?

Open manuel-delverme opened this issue 5 years ago • 6 comments

manuel-delverme avatar Jun 05 '20 09:06 manuel-delverme

Not really but I wouldn't be a bad thing to have! Do you have a recommendation for what we should adopt?

gehring avatar Jun 05 '20 20:06 gehring

https://www.python.org/dev/peps/pep-0008/ is the standard and well known, i usually avoid the 80 characters limitation because monitors are bigger nowadays but that just a detail.

manuel-delverme avatar Jun 08 '20 15:06 manuel-delverme

Adding @NeilGirdhar for advice here

pierrelux avatar Jul 29 '20 19:07 pierrelux

I agree with @manuel-delverme. I also follow PEP8 except for the 80 character limit. I'm using 100 characters now. Now that I try to use type annotations, I find 80 characters to cause excessive line-wrapping. It looks like you're using 100 characters as your line length already.

One suggestion is to use isort. (Run pip install isort, and then isort .) This keeps your imports clean. You can configure isort to however you like your imports. It appears that you like force_single_line to be true. So, I suggest something in your pyproject.toml like:

[tool.isort]
line_length = 100
force_single_line = True

When pylint is updated (hopefully in the next month), then I would run that too. You can steal my configuration for it (pylint has its own pylintrc) from my tjax project.

Until then, you can use flake8 to lint your code. Just add something like

[flake8]
max-line-length = 100
ignore = I100, W503, E731, E741, N802, N806
exclude = __init__.py,__pycache__,README.md

to a setup.cfg file.

NeilGirdhar avatar Jul 29 '20 19:07 NeilGirdhar

@gehring can you run isort/pylint for you refactor #26 ?

pierrelux avatar Jul 29 '20 20:07 pierrelux

I'm planning on setting up proper CI. Part of this will be moving to poetry and cleaning up the code such that it follows some easy to check standard (e.g., flake8, isort). Let's keep this change for a follow up PR. I would like to wrap up #26.

gehring avatar Jul 29 '20 20:07 gehring