diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 28396f6..7024ef3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,15 +7,15 @@ repos: - id: trailing-whitespace - id: end-of-file-fixer - repo: https://github.com/psf/black - rev: "24.2.0" + rev: "24.4.2" hooks: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.2.1 + rev: v0.4.3 hooks: - id: ruff - repo: https://github.com/RobertCraigie/pyright-python - rev: v1.1.350 + rev: v1.1.361 hooks: - id: pyright name: pyright (system) diff --git a/CHANGELOG.md b/CHANGELOG.md index 013f6cf..fc6b14c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Indentation of `execute_after` logs is too deep #15 + +### Changed + +- `execute_after` does not display detailled logs of stuff run #16 + ## [0.2.0] - 2024-02-16 ### Added diff --git a/README.md b/README.md index 145550a..8f451d2 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ This plugin intentionally has few dependencies, using the Python standard librar hatch-openzim adheres to openZIM's [Contribution Guidelines](https://github.com/openzim/overview/wiki/Contributing). -hatch-openzim has implemented openZIM's [Python bootstrap, conventions and policies](https://github.com/openzim/_python-bootstrap/docs/Policy.md) **v1.0.0**. +hatch-openzim has implemented openZIM's [Python bootstrap, conventions and policies](https://github.com/openzim/_python-bootstrap/blob/main/docs/Policy.md) **v1.0.1**. ## Quick start diff --git a/pyproject.toml b/pyproject.toml index 3983b46..11e1247 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,44 +7,36 @@ name = "hatch-openzim" requires-python = ">=3.8,<3.13" description = "openZIM hatch plugin to set metadata automatically and download files at build time" readme = "README.md" -classifiers = [ # needs hatch-openzim 0.2.0 to make it dynamic with additional-classifiers - "Framework :: Hatch", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", -] dependencies = [ "hatchling==1.21.1", "packaging==23.2", "toml==0.10.2", # to be removed once only 3.11 and above is supported ] -dynamic = ["authors", "keywords", "license", "version", "urls"] +dynamic = ["authors", "keywords", "license", "version", "urls", "classifiers"] [tool.hatch.metadata.hooks.openzim-metadata] additional-keywords = ["hatch","plugin","download","file"] -preserve-classifiers = true # to be removed once 0.2.0 is used +additional-classifiers = [ + "Framework :: Hatch", +] [project.optional-dependencies] scripts = [ "invoke==2.2.0", ] lint = [ - "black==24.2.0", - "ruff==0.2.1", + "black==24.4.2", + "ruff==0.4.3", ] check = [ - "pyright==1.1.350", + "pyright==1.1.361", ] test = [ - "pytest==8.0.0", - "coverage==7.4.1", + "pytest==8.2.0", + "coverage==7.5.1", ] dev = [ - "pre-commit==3.6.1", + "pre-commit==3.7.0", "debugpy==1.8.1", "hatch-openzim[scripts]", "hatch-openzim[lint]", diff --git a/src/hatch_openzim/files_install.py b/src/hatch_openzim/files_install.py index d4b1f24..8058df4 100644 --- a/src/hatch_openzim/files_install.py +++ b/src/hatch_openzim/files_install.py @@ -109,17 +109,19 @@ def _process_execute_after(base_target_dir: Path, actions: List[str]): """execute actions after file(s) installation""" for action in actions: - logger.info(f" Executing '{action}'") - process = subprocess.run( + logger.info(f" Executing '{action}'") + process = subprocess.run( # noqa: PLW1510 action, shell=True, # noqa: S602 # nosec: B602 cwd=base_target_dir, text=True, - check=True, - capture_output=True, + stderr=subprocess.STDOUT, + stdout=subprocess.PIPE, ) if process.stdout: - logger.info(f" stdout:\n{process.stdout}") + logger.info(f" stdout/stderr:\n{process.stdout}") + if process.returncode: + raise Exception("execute_after command failed, see logs above for details.") def _process_get_file_action( diff --git a/tasks.py b/tasks.py index 90854e8..a95c71a 100644 --- a/tasks.py +++ b/tasks.py @@ -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( diff --git a/tests/test_files_install.py b/tests/test_files_install.py index fb08dde..5863cea 100644 --- a/tests/test_files_install.py +++ b/tests/test_files_install.py @@ -1,5 +1,4 @@ import os -import subprocess import tempfile from pathlib import Path from typing import List @@ -212,7 +211,7 @@ def test_execute_after_failure(): os.chdir(temp_dir) with pytest.raises( - subprocess.CalledProcessError, + Exception, match="execute_after command failed, see logs above for details." ): files_install.process( str(