Update checkout and setup-python actions version in workflow and improve ruff config

This commit is contained in:
Vincent Emonet 2023-07-09 11:43:58 +02:00
parent f0943dada1
commit 19fb149112
4 changed files with 17 additions and 18 deletions

View file

@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v1

View file

@ -15,9 +15,9 @@ jobs:
python-version: ['3.8', '3.9', '3.10'] python-version: ['3.8', '3.9', '3.10']
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2 uses: actions/setup-python@v4
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
@ -45,9 +45,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v2 uses: actions/setup-python@v4
with: with:
python-version: '3.8' python-version: '3.8'
- name: Install dependencies - name: Install dependencies

View file

@ -21,17 +21,15 @@ jobs:
python-version: ['3.8', '3.9', '3.10'] python-version: ['3.8', '3.9', '3.10']
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2 uses: actions/setup-python@v4
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip pip install ".[test]"
pip install pytest flake8
pip install .
- name: Check code style with flake8 (lint) - name: Check code style with flake8 (lint)
run: | run: |
@ -49,7 +47,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Docker build - name: Docker build
run: docker build -f docker/Dockerfile -t libretranslate . run: docker build -f docker/Dockerfile -t libretranslate .

View file

@ -55,7 +55,6 @@ dependencies = [
"prometheus-client ==0.15.0", "prometheus-client ==0.15.0",
"polib ==1.1.1", "polib ==1.1.1",
] ]
# package_data={'': ['static/*', 'static/**/*', 'templates/*', 'locales/**/meta.json', 'locales/**/**/*.mo']},
[project.scripts] [project.scripts]
libretranslate = "libretranslate.main:main" libretranslate = "libretranslate.main:main"
@ -65,8 +64,9 @@ ltmanage = "libretranslate.manage:manage"
[project.optional-dependencies] [project.optional-dependencies]
test = [ test = [
"pytest >=7.2.0", "pytest >=7.2.0",
"pytest-runner",
"pytest-cov", "pytest-cov",
"flake8",
# "pytest-runner",
# "mypy >=1.4.1", # "mypy >=1.4.1",
"types-requests", "types-requests",
] ]
@ -94,7 +94,7 @@ lint = [
# "ruff --fix", # "ruff --fix",
] ]
fmt = [ fmt = [
"ruff --fix", "ruff libretranslate scripts --fix",
# "mypy", # "mypy",
] ]
test = [ test = [
@ -159,10 +159,11 @@ select = [
ignore = [ ignore = [
# "E741", # "E741",
# "B008", # do not perform function calls in argument defaults (required for FastAPI afaik) # "B008", # do not perform function calls in argument defaults (required for FastAPI afaik)
# "E501", # line too long "E501", # line too long
# "C901", # too complex # "C901", # too complex
# "S101", # Use of `assert` detected "S101", # Use of `assert` detected
# "T201", "T203", # remove print and pprint "T201", "T203", # remove print and pprint
"E402", # Module level import not at top of file
] ]
[tool.ruff.per-file-ignores] [tool.ruff.per-file-ignores]
@ -170,7 +171,7 @@ ignore = [
[tool.ruff.mccabe] [tool.ruff.mccabe]
max-complexity = 10 max-complexity = 12
# [flake8] ignore = E741 # [flake8] ignore = E741