add readme and .style.yapf for formatting

This commit is contained in:
Viktor Barzin 2025-05-07 20:58:22 +00:00
parent d24b667e73
commit 028eef63a8
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863
2 changed files with 47 additions and 0 deletions

21
crawler/.style.yapf Normal file
View file

@ -0,0 +1,21 @@
[style]
based_on_style = facebook
# Formatting options
column_limit = 88
indent_width = 4
use_tabs = false
continuation_indent_width = 4
# Spacing
spaces_around_power_operator = true
spaces_before_comment = 2
# Splitting rules
split_before_logical_operator = true
split_before_bitwise_operator = true
split_before_arithmetic_operator = true
split_before_expression_after_opening_paren = true
split_before_first_argument = false
split_complex_comprehension = true
allow_split_before_dict_value = true

26
crawler/README.md Normal file
View file

@ -0,0 +1,26 @@
# Setup
```bash
pip install -r requirements.txt
```
# Formatting
```bash
yapf --style .style.yapf --recursive .
```
For VSCode - install yapf extension.
Enable formatting using yap and the style file in this repo (there may be an easier way; I put this in my user settings json):
```
{
"[python]": {
"editor.formatOnSaveMode": "file",
"editor.formatOnSave": true,
"editor.defaultFormatter": "eeyore.yapf",
"editor.formatOnType": false
},
"yapf.args": ["--style", "/home/wizard/code/realestate-crawler/crawler/.style.yapf"]
}
```