Upgrading pre-commit 3 to 4
Breaking3.8.0 → 4.7.0Breaking1Deprecated1New8Changed6Fixed16
BreakingUpgrade verdict
1 breaking change.
In plain terms
- The python_venv language option no longer exists, so configs using it must switch to python.
- Old stage names now produce warnings telling you the new names to use.
Must act 2 items need code or config changes
Python requirement changed in 4.7.0: >=3.9 → >=3.11.
What you must change
Breaking1
Removes
language: python_venv; use language: python instead.language: python_venvlanguage: pythonDeprecations to plan for
Deprecated1
Adds warnings for deprecated
stages values (commit -> pre-commit, push -> pre-push, merge-commit -> pre-merge-commit).stagescommitpre-commitpushpre-pushmerge-commitpre-merge-commitAPI changes
Generated by DepDelta from published Python source. Not mixed with prose notes.
- added:
class DeprecatedDefaultStagesWarning(NamedTuple) - added:
class DeprecatedStagesWarning(NamedTuple) - added:
class LanguageMigration(NamedTuple) - added:
class LanguageMigrationRequired(LanguageMigration) - added:
field DeprecatedDefaultStagesWarning.key: str - added:
field DeprecatedStagesWarning.key: str - added:
field LanguageMigration.check_fn: Callable[[object], None] - added:
field LanguageMigration.key: str - added:
function warn_for_stages_on_repo_init(repo: str, directory: str) -> None - added:
method DeprecatedDefaultStagesWarning.apply_default(dct: dict[str, Any]) -> None - added:
method DeprecatedDefaultStagesWarning.check(dct: dict[str, Any]) -> None - added:
method DeprecatedDefaultStagesWarning.remove_default(dct: dict[str, Any]) -> None - added:
method DeprecatedStagesWarning.apply_default(dct: dict[str, Any]) -> None - added:
method DeprecatedStagesWarning.check(dct: dict[str, Any]) -> None - added:
method DeprecatedStagesWarning.remove_default(dct: dict[str, Any]) -> None - added:
method LanguageMigration.apply_default(dct: dict[str, Any]) -> None - added:
method LanguageMigration.check(dct: dict[str, Any]) -> None - added:
method LanguageMigration.remove_default(dct: dict[str, Any]) -> None - added:
method LanguageMigrationRequired.check(dct: dict[str, Any]) -> None - added:
variable MINIMAL_MANIFEST_SCHEMA
- added:
function add_parsers(parser: argparse.ArgumentParser) -> None - added:
function cd(subdir: str, cmd: tuple[str, ...]) -> int - added:
function ignore_exit_code(cmd: tuple[str, ...]) -> int - added:
function impl(args: argparse.Namespace) -> int - added:
function main(argv: Sequence[str] | None=…) -> int - added:
function n1(cmd: tuple[str, ...]) -> int
- changed:
function hook_impl(store: Store, *, config: str, color: bool, hook_type: str, hook_dir: str, skip_on_missing_config: bool, args: Sequence[str]) -> int → function hook_impl(store: Store, *, config: str, color: bool, hook_type: str, hook_dir: str | None, skip_on_missing_config: bool, args: Sequence[str]) -> int
- changed:
function filter_by_include_exclude(names: Iterable[str], include: str, exclude: str) -> Generator[str, None, None] → function filter_by_include_exclude(names: Iterable[str], include: str, exclude: str) -> Generator[str] - changed:
method Classifier.by_types(names: Iterable[str], types: Iterable[str], types_or: Iterable[str], exclude_types: Iterable[str]) -> Generator[str, None, None] → method Classifier.by_types(names: Iterable[str], types: Iterable[str], types_or: Iterable[str], exclude_types: Iterable[str]) -> Generator[str] - changed:
method Classifier.filenames_for_hook(hook: Hook) -> Generator[str, None, None] → method Classifier.filenames_for_hook(hook: Hook) -> Generator[str]
- changed:
function envcontext(patch: PatchesT, _env: MutableMapping[str, str] | None=…) -> Generator[None, None, None] → function envcontext(patch: PatchesT, _env: MutableMapping[str, str] | None=…) -> Generator[None]
- changed:
function error_handler() -> Generator[None, None, None] → function error_handler() -> Generator[None]
- changed:
function lock(path: str, blocked_cb: Callable[[], None]) -> Generator[None, None, None] → function lock(path: str, blocked_cb: Callable[[], None]) -> Generator[None]
- changed:
function no_env(prefix: Prefix, version: str) -> Generator[None, None, None] → function no_env(prefix: Prefix, version: str) -> Generator[None]
- changed:
function in_env(prefix: Prefix, version: str) -> Generator[None, None, None] → function in_env(prefix: Prefix, version: str) -> Generator[None]
- changed:
function in_env(prefix: Prefix, version: str) -> Generator[None, None, None] → function in_env(prefix: Prefix, version: str) -> Generator[None]
- changed:
function in_env(prefix: Prefix, version: str) -> Generator[None, None, None] → function in_env(prefix: Prefix, version: str) -> Generator[None]
- changed:
function in_env(prefix: Prefix, version: str) -> Generator[None, None, None] → function in_env(prefix: Prefix, version: str) -> Generator[None]
- changed:
function in_env(prefix: Prefix, version: str) -> Generator[None, None, None] → function in_env(prefix: Prefix, version: str) -> Generator[None]
- changed:
function in_env(prefix: Prefix, version: str) -> Generator[None, None, None] → function in_env(prefix: Prefix, version: str) -> Generator[None]
- added:
function get_env_patch(target_dir: str, version: str) -> PatchesT - added:
function in_env(prefix: Prefix, version: str) -> Generator[None] - added:
function install_environment(prefix: Prefix, version: str, additional_dependencies: Sequence[str]) -> None - added:
function run_hook(prefix: Prefix, entry: str, args: Sequence[str], file_args: Sequence[str], *, is_local: bool, require_serial: bool, color: bool) -> tuple[int, bytes] - added:
variable ENVIRONMENT_DIR - added:
variable get_default_version - added:
variable health_check
- changed:
function in_env(prefix: Prefix, version: str) -> Generator[None, None, None] → function in_env(prefix: Prefix, version: str) -> Generator[None]
- changed:
function in_env(prefix: Prefix, version: str) -> Generator[None, None, None] → function in_env(prefix: Prefix, version: str) -> Generator[None]
- changed:
function in_env(prefix: Prefix, version: str) -> Generator[None, None, None] → function in_env(prefix: Prefix, version: str) -> Generator[None]
- changed:
function in_env(prefix: Prefix, version: str) -> Generator[None, None, None] → function in_env(prefix: Prefix, version: str) -> Generator[None]
- removed:
variable RSCRIPT_OPTS - changed:
function in_env(prefix: Prefix, version: str) -> Generator[None, None, None] → function in_env(prefix: Prefix, version: str) -> Generator[None]
- changed:
function in_env(prefix: Prefix, version: str) -> Generator[None, None, None] → function in_env(prefix: Prefix, version: str) -> Generator[None]
- changed:
function in_env(prefix: Prefix, version: str) -> Generator[None, None, None] → function in_env(prefix: Prefix, version: str) -> Generator[None]
- removed:
function run_hook(prefix: Prefix, entry: str, args: Sequence[str], file_args: Sequence[str], *, is_local: bool, require_serial: bool, color: bool) -> tuple[int, bytes] - removed:
variable ENVIRONMENT_DIR - removed:
variable get_default_version - removed:
variable health_check - removed:
variable in_env - removed:
variable install_environment
- changed:
function in_env(prefix: Prefix, version: str) -> Generator[None, None, None] → function in_env(prefix: Prefix, version: str) -> Generator[None]
- removed:
variable ENVIRONMENT_DIR - removed:
variable get_default_version - removed:
variable health_check - removed:
variable in_env - removed:
variable install_environment - removed:
variable run_hook
- added:
variable ENVIRONMENT_DIR - added:
variable get_default_version - added:
variable health_check - added:
variable in_env - added:
variable install_environment - added:
variable run_hook
- added:
function run_hook(prefix: Prefix, entry: str, args: Sequence[str], file_args: Sequence[str], *, is_local: bool, require_serial: bool, color: bool) -> tuple[int, bytes] - added:
variable ENVIRONMENT_DIR - added:
variable get_default_version - added:
variable health_check - added:
variable in_env - added:
variable install_environment
- changed:
function logging_handler(use_color: bool) -> Generator[None, None, None] → function logging_handler(use_color: bool) -> Generator[None]
- changed:
function staged_files_only(patch_dir: str) -> Generator[None, None, None] → function staged_files_only(patch_dir: str) -> Generator[None]
- removed:
method Store.delete_configs(configs: list[str]) -> None - removed:
method Store.delete_repo(db_repo_name: str, ref: str, path: str) -> None - removed:
method Store.select_all_configs() -> list[str] - removed:
method Store.select_all_repos() -> list[tuple[str, str, str]] - changed:
method Store.connect(db_path: str | None=…) -> Generator[sqlite3.Connection, None, None] → method Store.connect(db_path: str | None=…) -> Generator[sqlite3.Connection] - changed:
method Store.exclusive_lock() -> Generator[None, None, None] → method Store.exclusive_lock() -> Generator[None]
- changed:
function clean_path_on_failure(path: str) -> Generator[None, None, None] → function clean_path_on_failure(path: str) -> Generator[None]
- added:
variable yaml_compose
- added:
class MappingKey(NamedTuple) - added:
class MappingValue(NamedTuple) - added:
class SequenceItem(NamedTuple) - added:
field MappingKey.k: str - added:
field MappingValue.k: str - added:
function match(n: Node, matcher: tuple[_Matcher, ...]) -> Generator[ScalarNode] - added:
method MappingKey.match(n: Node) -> Generator[Node] - added:
method MappingValue.match(n: Node) -> Generator[Node] - added:
method SequenceItem.match(n: Node) -> Generator[Node]