This repository was archived by the owner on Sep 8, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 53
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
Use libraries to force Pythonic style #20
Copy link
Copy link
Closed
Labels
Description
Libraries that I recommend
- flake8: https://pypi.org/project/flake8
- black: https://pypi.org/project/black
- isort: https://pypi.org/project/isort
Configuration for VSCode that I recommend
{
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.formatting.provider": "black",
"python.linting.flake8Args": [
"--max-line-length=88",
"--extend-ignore=E203"
],
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"python.sortImports.args": [
"--multi-line=3",
"--trailing-comma",
"--force-grid-wrap=0",
"--use-parentheses",
"--line-width=88",
]
}GitHub Action for check that I recommend
name: Pythonic
on: [push, pull_request]
jobs:
Pythonic:
name: Pythonic Checks / OS ${{ matrix.os }} / Node ${{ matrix.python-version }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.7, 3.8, 3.9]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry 2.1.0
uses: abatilo/actions-poetry@v2.1.0
with:
poetry-version: 1.1.2
- name: Run Pythonic checks
run: |
poetry install
poetry run flake8 . --count --show-source --statistics --max-line-length=88 --extend-ignore=E203
poetry run black . --check
poetry run isort . --profile=black