Skip to content

Commit

Permalink
Adapt to Python bootstrap changes
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit74 committed Jul 24, 2023
1 parent 0a4082d commit f86c72b
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 95 deletions.
29 changes: 17 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
FROM python:3.11-bullseye
LABEL org.opencontainers.image.source https://github.com/openzim/kolibri2zim
FROM python:3.11-bookworm
LABEL org.opencontainers.image.source https://github.com/openzim/kolibri

# Install necessary packages
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends locales-all unzip ffmpeg \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& python -m pip install -U pip hatch
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
locales-all \
unzip \
ffmpeg \
&& rm -rf /var/lib/apt/lists/* \
&& python -m pip install --no-cache-dir -U \
pip

#COPY requirements.txt /src/
#RUN pip3 install --no-cache-dir -r /src/requirements.txt
COPY kolibri2zim /src/kolibri2zim
COPY pyproject.toml *.md get_js_deps.sh install.sh MANIFEST.in LICENSE *.py /src/
RUN cd /src/ && hatch build -t sdist && ./install.sh
# Copy code + associated artifacts
COPY src /src/src
COPY pyproject.toml *.md get_js_deps.sh MANIFEST.in LICENSE *.py /src/

# Install + cleanup
RUN pip install --no-cache-dir /src \
&& rm -rf /src

# default output directory
RUN mkdir -p /output
Expand Down
160 changes: 77 additions & 83 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ test = [
"coverage==7.2.7",
]
dev = [
"debugpy",
"pre-commit==3.3.3",
"debugpy==1.6.7",
"kolibri2zim[scripts]",
"kolibri2zim[lint]",
"kolibri2zim[test]",
"kolibri2zim[check]",
"hatchling",
"hatchling==1.18.0",
]

[project.urls]
Expand Down Expand Up @@ -99,84 +100,81 @@ target-version = ['py311']
[tool.ruff]
target-version = "py311"
line-length = 88
src = ["kolibri2zim"]
src = ["src"]
select = [
# "A", # flake8-builtins
# "ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
# "ASYNC", # flake8-async
# "B", # flake8-bugbear
# "BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"C90", # mccabe
# "COM", # flake8-commas
# "D", # pydocstyle
# "DJ", # flake8-django
"DTZ", # flake8-datetimez
"E", # pycodestyle (default)
"EM", # flake8-errmsg
# "ERA", # eradicate
# "EXE", # flake8-executable
"F", # Pyflakes (default)
# "FA", # flake8-future-annotations
"FBT", # flake8-boolean-trap
# "FLY", # flynt
# "G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
# "INP", # flake8-no-pep420
# "INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"N", # pep8-naming
# "NPY", # NumPy-specific rules
# "PD", # pandas-vet
# "PGH", # pygrep-hooks
# "PIE", # flake8-pie
# "PL", # Pylint
"PLC", # Pylint: Convention
"PLE", # Pylint: Error
"PLR", # Pylint: Refactor
"PLW", # Pylint: Warning
# "PT", # flake8-pytest-style
# "PTH", # flake8-use-pathlib
# "PYI", # flake8-pyi
"Q", # flake8-quotes
# "RET", # flake8-return
# "RSE", # flake8-raise
"RUF", # Ruff-specific rules
"S", # flake8-bandit
# "SIM", # flake8-simplify
# "SLF", # flake8-self
"T10", # flake8-debugger
"T20", # flake8-print
# "TCH", # flake8-type-checking
# "TD", # flake8-todos
"TID", # flake8-tidy-imports
# "TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle
"YTT", # flake8-2020
"A", # flake8-builtins
# "ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
# "ASYNC", # flake8-async
"B", # flake8-bugbear
# "BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"C90", # mccabe
# "COM", # flake8-commas
# "D", # pydocstyle
# "DJ", # flake8-django
"DTZ", # flake8-datetimez
"E", # pycodestyle (default)
"EM", # flake8-errmsg
# "ERA", # eradicate
# "EXE", # flake8-executable
"F", # Pyflakes (default)
# "FA", # flake8-future-annotations
"FBT", # flake8-boolean-trap
# "FLY", # flynt
# "G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
# "INP", # flake8-no-pep420
# "INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"N", # pep8-naming
# "NPY", # NumPy-specific rules
# "PD", # pandas-vet
# "PGH", # pygrep-hooks
# "PIE", # flake8-pie
# "PL", # Pylint
"PLC", # Pylint: Convention
"PLE", # Pylint: Error
"PLR", # Pylint: Refactor
"PLW", # Pylint: Warning
# "PT", # flake8-pytest-style
# "PTH", # flake8-use-pathlib
# "PYI", # flake8-pyi
"Q", # flake8-quotes
# "RET", # flake8-return
# "RSE", # flake8-raise
"RUF", # Ruff-specific rules
"S", # flake8-bandit
# "SIM", # flake8-simplify
# "SLF", # flake8-self
"T10", # flake8-debugger
"T20", # flake8-print
# "TCH", # flake8-type-checking
# "TD", # flake8-todos
"TID", # flake8-tidy-imports
# "TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle
"YTT", # flake8-2020
]
ignore = [
# Allow non-abstract empty methods in abstract base classes
"B027",
"EM",
# Allow boolean positional values in function calls, like `dict.get(... True)`
"FBT003",
# Ignore checks for possible passwords
"S105",
"S106",
"S107",
# Ignore complexity
"C901",
"PLR0911",
"PLR0912",
"PLR0913",
"PLR0915",
# Allow non-abstract empty methods in abstract base classes
"B027",
# Remove flake8-errmsg since we consider they bloat the code and provide limited value
"EM",
# Allow boolean positional values in function calls, like `dict.get(... True)`
"FBT003",
# Ignore checks for possible passwords
"S105", "S106", "S107",
# Ignore warnings on subprocess.run / popen
"S603",
# Ignore complexity
"C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915",
]
unfixable = [
# Don't touch unused imports
"F401",
# Don't touch unused imports
"F401",
]

[tool.ruff.isort]
Expand Down Expand Up @@ -214,16 +212,12 @@ exclude_lines = [
]

[tool.pyright]
pythonVersion = "3.11"
pythonPlatform = "All"
typeCheckingMode = "basic"

include = ["src", "tests", "tasks.py"]
exclude = ["**/node_modules",
"**/__pycache__",
"src/kolibri2zim/templates",
]

executionEnvironments= [
{ root= "src" }
]
extraPaths = ["src"]
pythonVersion = "3.11"
pythonPlatform = "All"
typeCheckingMode="basic"

0 comments on commit f86c72b

Please sign in to comment.