gehring / fax

MIT License
78 stars 9 forks source link

Is there a set of minimal formatting guidelines we follow? #23

Open manuel-delverme opened 4 years ago

gehring commented 4 years ago

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

manuel-delverme commented 4 years ago

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.

pierrelux commented 4 years ago

Adding @NeilGirdhar for advice here

NeilGirdhar commented 4 years ago

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.

pierrelux commented 4 years ago

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

gehring commented 4 years ago

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.