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: trailing-whitespace
- id: end-of-file-fixer - id: end-of-file-fixer
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: "23.12.1" rev: "24.2.0"
hooks: hooks:
- id: black - id: black
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3 rev: v0.3.0
hooks: hooks:
- id: ruff - id: ruff
- repo: https://github.com/RobertCraigie/pyright-python - repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.348 rev: v1.1.352
hooks: hooks:
- id: pyright - id: pyright
name: pyright (system) 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 LABEL org.opencontainers.image.source https://github.com/openzim/warc2zim
RUN apt-get update -y \ RUN apt-get update -y \
@ -12,7 +12,7 @@ RUN apt-get update -y \
WORKDIR /output WORKDIR /output
# Copy pyproject.toml and its dependencies # 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 COPY src/warc2zim/__about__.py /src/src/warc2zim/__about__.py
# Install Python dependencies # Install Python dependencies

View file

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

View file

@ -92,7 +92,7 @@ def fix_black(ctx: Context, args: str = "."):
def fix_ruff(ctx: Context, args: str = "."): def fix_ruff(ctx: Context, args: str = "."):
"""fix all ruff rules""" """fix all ruff rules"""
args = args or "." # needed for hatch script 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( @task(