Upgrade dependencies and Python version

This commit is contained in:
benoit74 2024-02-29 17:20:32 +01:00
parent 7dbc9d79a8
commit 40f22b2398
No known key found for this signature in database
GPG key ID: B89606434FC7B530
4 changed files with 28 additions and 27 deletions

View file

@ -7,15 +7,15 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/psf/black
rev: "23.12.1"
rev: "24.2.0"
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
rev: v0.3.0
hooks:
- id: ruff
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.348
rev: v1.1.352
hooks:
- id: pyright
name: pyright (system)

View file

@ -1,4 +1,4 @@
FROM python:3.11-slim-bookworm
FROM python:3.12-slim-bookworm
LABEL org.opencontainers.image.source https://github.com/openzim/warc2zim
RUN apt-get update -y \
@ -12,7 +12,7 @@ RUN apt-get update -y \
WORKDIR /output
# Copy pyproject.toml and its dependencies
COPY pyproject.toml README.md hatch_build.py /src/
COPY pyproject.toml openzim.toml README.md /src/
COPY src/warc2zim/__about__.py /src/src/warc2zim/__about__.py
# Install Python dependencies

View file

@ -1,5 +1,5 @@
[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-openzim==0.2.0"]
build-backend = "hatchling.build"
[project]
@ -9,23 +9,22 @@ authors = [
{ name = "Webrecorder Software", email = "info@webrecorder.net" },
]
keywords = ["kiwix", "zim", "offline", "warc"]
requires-python = ">=3.11,<3.12"
requires-python = ">=3.12,<3.13"
description = "Convert WARC to ZIM"
readme = "README.md"
license = {text = "GPL-3.0-or-later"}
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
]
dependencies = [
"warcio==1.7.4",
"requests==2.31.0",
"beautifulsoup4==4.9.3",
"zimscraperlib==3.2.0",
"Babel==2.12.1",
"jinja2==3.1.2",
"setuptools==68.2.2",
"zimscraperlib==3.3.1",
"Babel==2.14.0",
"jinja2==3.1.3",
"chardet==5.2.0",
# to support possible brotli content in warcs
"brotlipy==0.7.0",
@ -39,19 +38,19 @@ scripts = [
"invoke==2.2.0",
]
lint = [
"black==23.12.1",
"ruff==0.1.3",
"black==24.2.0",
"ruff==0.3.0",
]
check = [
"pyright==1.1.348",
"pyright==1.1.352",
]
test = [
"pytest==7.4.4",
"coverage==7.4.0",
"pytest==8.0.2",
"coverage==7.4.3",
]
dev = [
"pre-commit==3.6.0",
"debugpy==1.8.0",
"pre-commit==3.6.2",
"debugpy==1.8.1",
"warc2zim[scripts]",
"warc2zim[lint]",
"warc2zim[test]",
@ -116,12 +115,14 @@ all = "inv checkall --args '{args}'"
[tool.black]
line-length = 88
target-version = ['py311']
target-version = ['py312']
[tool.ruff]
target-version = "py311"
target-version = "py312"
line-length = 88
src = ["src"]
[tool.ruff.lint]
select = [
"A", # flake8-builtins
# "ANN", # flake8-annotations
@ -198,17 +199,17 @@ unfixable = [
"F401",
]
[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = ["warc2zim"]
[tool.ruff.flake8-bugbear]
[tool.ruff.lint.flake8-bugbear]
# add exceptions to B008 for fastapi.
extend-immutable-calls = ["fastapi.Depends", "fastapi.Query"]
[tool.ruff.flake8-tidy-imports]
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
# Tests can use magic values, assertions, and relative imports
"tests/**/*" = ["PLR2004", "S101", "TID252"]
@ -240,6 +241,6 @@ exclude_lines = [
include = ["src", "tests", "tasks.py"]
exclude = [".env/**", ".venv/**"]
extraPaths = ["src"]
pythonVersion = "3.11"
pythonVersion = "3.12"
typeCheckingMode = "basic"
disableBytesTypePromotions = true

View file

@ -92,7 +92,7 @@ def fix_black(ctx: Context, args: str = "."):
def fix_ruff(ctx: Context, args: str = "."):
"""fix all ruff rules"""
args = args or "." # needed for hatch script
ctx.run(f"ruff --fix {args}", pty=use_pty)
ctx.run(f"ruff check --fix {args}", pty=use_pty)
@task(