path-sync 0.3.4__tar.gz → 0.3.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: path-sync
3
- Version: 0.3.4
3
+ Version: 0.3.5
4
4
  Summary: Sync files from a source repo to multiple destination repos
5
5
  Author-email: EspenAlbert <espen.albert1@gmail.com>
6
6
  License-Expression: MIT
@@ -13,11 +13,16 @@ Requires-Dist: gitpython>=3.1.0
13
13
  Requires-Dist: pydantic>=2.0
14
14
  Requires-Dist: pyyaml>=6.0
15
15
  Requires-Dist: typer>=0.16.0
16
- Requires-Dist: zero-3rdparty>=0.101.1
16
+ Requires-Dist: zero-3rdparty>=0.102.0
17
17
  Description-Content-Type: text/markdown
18
18
 
19
19
  # path-sync
20
20
 
21
+ [![PyPI](https://img.shields.io/pypi/v/path-sync)](https://pypi.org/project/path-sync/)
22
+ [![GitHub](https://img.shields.io/github/license/EspenAlbert/path-sync)](https://github.com/EspenAlbert/path-sync)
23
+ [![codecov](https://codecov.io/gh/EspenAlbert/path-sync/graph/badge.svg)](https://codecov.io/gh/EspenAlbert/path-sync)
24
+ [![Docs](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](https://espenalbert.github.io/path-sync/)
25
+
21
26
  Sync files from a source repo to multiple destination repos.
22
27
 
23
28
  ## Overview
@@ -1,5 +1,10 @@
1
1
  # path-sync
2
2
 
3
+ [![PyPI](https://img.shields.io/pypi/v/path-sync)](https://pypi.org/project/path-sync/)
4
+ [![GitHub](https://img.shields.io/github/license/EspenAlbert/path-sync)](https://github.com/EspenAlbert/path-sync)
5
+ [![codecov](https://codecov.io/gh/EspenAlbert/path-sync/graph/badge.svg)](https://codecov.io/gh/EspenAlbert/path-sync)
6
+ [![Docs](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](https://espenalbert.github.io/path-sync/)
7
+
3
8
  Sync files from a source repo to multiple destination repos.
4
9
 
5
10
  ## Overview
@@ -3,7 +3,7 @@
3
3
  from path_sync import copy
4
4
  from path_sync import config
5
5
 
6
- VERSION = "0.3.4"
6
+ VERSION = "0.3.5"
7
7
  __all__ = [
8
8
  "copy",
9
9
  "config",
@@ -237,10 +237,10 @@ def _sync_destination(
237
237
 
238
238
  # --no-checkout means "I'm already on the right branch"
239
239
  # Prompt decline means "skip git operations for this run"
240
- if opts.no_checkout:
241
- skip_git_ops = False
242
- elif opts.dry_run:
240
+ if opts.dry_run:
243
241
  skip_git_ops = True
242
+ elif opts.no_checkout:
243
+ skip_git_ops = False
244
244
  elif _prompt(f"Switch {dest.name} to {copy_branch}?", opts.no_prompt):
245
245
  git_ops.prepare_copy_branch(
246
246
  repo=dest_repo,
@@ -31,6 +31,7 @@ def validate_no_unauthorized_changes(
31
31
  """Find files with unauthorized changes in DO_NOT_EDIT sections.
32
32
 
33
33
  Returns 'path:section_id' for section changes or 'path' for full-file.
34
+ Missing sections (user opted out) are warned but not treated as errors.
34
35
  """
35
36
  repo = git_ops.get_repo(repo_root)
36
37
  base_ref = f"origin/{default_branch}"
@@ -55,8 +56,10 @@ def validate_no_unauthorized_changes(
55
56
 
56
57
  if baseline_has_sections:
57
58
  file_skip = skip.get(rel_path, set())
58
- changed_ids = sections.compare_sections(baseline_content, current_content, path, file_skip)
59
- unauthorized.extend(f"{rel_path}:{sid}" for sid in changed_ids)
59
+ changes = sections.changed_sections(baseline_content, current_content, path, file_skip)
60
+ for sid in changes.missing:
61
+ logger.warning(f"Section '{sid}' removed from {rel_path}, consider updating src.yaml")
62
+ unauthorized.extend(f"{rel_path}:{sid}" for sid in changes.modified)
60
63
  elif current_has_sections:
61
64
  unauthorized.append(rel_path)
62
65
  else:
@@ -4,10 +4,11 @@ from pathlib import Path
4
4
 
5
5
  from zero_3rdparty.sections import (
6
6
  Section,
7
+ SectionChanges,
7
8
  get_comment_config,
8
9
  )
9
10
  from zero_3rdparty.sections import (
10
- compare_sections as _compare_sections,
11
+ changed_sections as _changed_sections,
11
12
  )
12
13
  from zero_3rdparty.sections import (
13
14
  extract_sections as _extract_sections,
@@ -27,7 +28,8 @@ from zero_3rdparty.sections import (
27
28
 
28
29
  __all__ = [
29
30
  "Section",
30
- "compare_sections",
31
+ "SectionChanges",
32
+ "changed_sections",
31
33
  "extract_sections",
32
34
  "has_sections",
33
35
  "parse_sections",
@@ -59,14 +61,23 @@ def replace_sections(
59
61
  src_sections: dict[str, str],
60
62
  path: Path,
61
63
  skip_sections: list[str] | None = None,
64
+ *,
65
+ keep_deleted_sections: bool = False,
62
66
  ) -> str:
63
- return _replace_sections(dest_content, src_sections, TOOL_NAME, get_comment_config(path), skip_sections)
67
+ return _replace_sections(
68
+ dest_content,
69
+ src_sections,
70
+ TOOL_NAME,
71
+ get_comment_config(path),
72
+ skip_sections,
73
+ keep_deleted_sections=keep_deleted_sections,
74
+ )
64
75
 
65
76
 
66
- def compare_sections(
77
+ def changed_sections(
67
78
  baseline_content: str,
68
79
  current_content: str,
69
80
  path: Path,
70
81
  skip: set[str] | None = None,
71
- ) -> list[str]:
72
- return _compare_sections(baseline_content, current_content, TOOL_NAME, get_comment_config(path), skip, str(path))
82
+ ) -> SectionChanges:
83
+ return _changed_sections(baseline_content, current_content, TOOL_NAME, get_comment_config(path), skip, str(path))
@@ -1,9 +1,8 @@
1
1
  # path-sync copy -n python-template
2
2
 
3
- # === OK_EDIT: path-sync header ===
4
3
  [project]
5
4
  name = "path-sync"
6
- version = "0.3.4"
5
+ version = "0.3.5"
7
6
  description = "Sync files from a source repo to multiple destination repos"
8
7
  requires-python = ">=3.13"
9
8
  license = "MIT"
@@ -29,7 +28,7 @@ dependencies = [
29
28
  "pyyaml>=6.0",
30
29
  "typer>=0.16.0",
31
30
  "gitpython>=3.1.0",
32
- "zero-3rdparty>=0.101.1",
31
+ "zero-3rdparty>=0.102.0",
33
32
  ]
34
33
 
35
34
  [project.scripts]
@@ -75,6 +74,7 @@ extend-select = ["Q", "RUF100", "C90", "UP", "I", "T"]
75
74
  [tool.pytest.ini_options]
76
75
  addopts = "-s -vv --log-cli-level=INFO"
77
76
  python_files = ["*_test.py", "test_*.py"]
77
+ asyncio_mode = "auto"
78
78
  # === OK_EDIT: path-sync pytest ===
79
79
 
80
80
  # === DO_NOT_EDIT: path-sync coverage ===
@@ -88,7 +88,9 @@ exclude_lines = ["no cov", "if __name__ == .__main__.:"]
88
88
  dev = [
89
89
  "pyright>=1.1",
90
90
  "pytest>=9.0",
91
+ "pytest-asyncio>=0.24",
91
92
  "pytest-cov>=7.0",
93
+ "pytest-regressions>=2.6",
92
94
  "ruff>=0.14",
93
95
  ]
94
96
  # === OK_EDIT: path-sync dev ===
@@ -98,3 +100,7 @@ docs = [
98
100
  "mkdocs-material>=9.5",
99
101
  ]
100
102
  # === OK_EDIT: path-sync docs ===
103
+
104
+ # === DO_NOT_EDIT: path-sync release ===
105
+ release = ["pkg-ext"]
106
+ # === OK_EDIT: path-sync release ===
File without changes
File without changes
File without changes
File without changes