pyprojkit 0.4.1__tar.gz → 0.4.2__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: pyprojkit
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Development workflow toolkit for Python projects: pyproject.toml sync, doit tasks, nox sessions
5
5
  Author: mm21
6
6
  Author-email: mm21 <mm21.dev@gmail.com>
@@ -29,7 +29,7 @@ license-files = ["LICENSE"]
29
29
  name = "pyprojkit"
30
30
  readme = "README.md"
31
31
  requires-python = ">=3.12,<4.0" # pyprojkit-managed
32
- version = "0.4.1"
32
+ version = "0.4.2"
33
33
 
34
34
  [project.optional-dependencies]
35
35
  all = [
@@ -19,6 +19,10 @@ Managed content:
19
19
  `<skills_dir>/pyprojkit-python/SKILL.md`, overwritten on every sync and removed when
20
20
  dropped from the configuration
21
21
 
22
+ On every non-check sync, the lock file is refreshed via the configured workflow tool
23
+ (`uv lock` or `poetry lock`), so manual edits to `pyproject.toml` are picked up too.
24
+ Skipped when no workflow tool is configured.
25
+
22
26
  Everything else (dependencies, build-system, urls, unmanaged fields and tables, etc.) is
23
27
  preserved. Output is normalized with toml-sort (as a library, using the same settings as
24
28
  the managed `[tool.tomlsort]` table), so a subsequent `toml-sort` run in the format task
@@ -30,6 +34,7 @@ bookkeeping table and "managed by pyprojkit" comments) are migrated in one sync.
30
34
 
31
35
  from __future__ import annotations
32
36
 
37
+ import contextlib
33
38
  import difflib
34
39
  import re
35
40
  from pathlib import Path
@@ -39,6 +44,7 @@ import tomlkit
39
44
  from tomlkit import TOMLDocument
40
45
  from tomlkit.items import AoT, Null, Table
41
46
 
47
+ from ._run import run
42
48
  from .config.base import ConfigError
43
49
  from .config.project import ProjectConfig, SkillConfig
44
50
  from .config.tools import TomlSortConfig
@@ -165,9 +171,21 @@ def sync(
165
171
  skill_path.parent.mkdir(parents=True, exist_ok=True)
166
172
  skill_path.write_text(desired)
167
173
 
174
+ if not check:
175
+ _lock(config, root_path)
176
+
168
177
  return in_sync if check else True
169
178
 
170
179
 
180
+ def _lock(config: ProjectConfig, root: Path):
181
+ """
182
+ Refresh the lock file using the configured workflow tool, if any.
183
+ """
184
+ if tool := config.tools.workflow_tool:
185
+ with contextlib.chdir(root):
186
+ run([tool, "lock"])
187
+
188
+
171
189
  def _print_diff(name: str, old: str, new: str):
172
190
  diff = difflib.unified_diff(
173
191
  old.splitlines(keepends=True),
File without changes
File without changes