patchling 0.9.1__tar.gz → 0.9.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.
Files changed (38) hide show
  1. {patchling-0.9.1 → patchling-0.9.2}/PKG-INFO +3 -1
  2. {patchling-0.9.1 → patchling-0.9.2}/README.md +2 -0
  3. {patchling-0.9.1 → patchling-0.9.2}/patchling/__init__.py +1 -1
  4. {patchling-0.9.1 → patchling-0.9.2}/patchling/core.py +3 -0
  5. {patchling-0.9.1 → patchling-0.9.2}/patchling/gptpatch.py +3 -0
  6. {patchling-0.9.1 → patchling-0.9.2}/patchling.egg-info/PKG-INFO +3 -1
  7. {patchling-0.9.1 → patchling-0.9.2}/patchling.egg-info/SOURCES.txt +1 -0
  8. patchling-0.9.2/tests/test_cli_version.py +24 -0
  9. {patchling-0.9.1 → patchling-0.9.2}/tests/test_packaging.py +8 -6
  10. {patchling-0.9.1 → patchling-0.9.2}/LICENSE.txt +0 -0
  11. {patchling-0.9.1 → patchling-0.9.2}/patchling/applydiff.py +0 -0
  12. {patchling-0.9.1 → patchling-0.9.2}/patchling/env.py +0 -0
  13. {patchling-0.9.1 → patchling-0.9.2}/patchling/py.typed +0 -0
  14. {patchling-0.9.1 → patchling-0.9.2}/patchling/relevance.py +0 -0
  15. {patchling-0.9.1 → patchling-0.9.2}/patchling.egg-info/dependency_links.txt +0 -0
  16. {patchling-0.9.1 → patchling-0.9.2}/patchling.egg-info/entry_points.txt +0 -0
  17. {patchling-0.9.1 → patchling-0.9.2}/patchling.egg-info/requires.txt +0 -0
  18. {patchling-0.9.1 → patchling-0.9.2}/patchling.egg-info/top_level.txt +0 -0
  19. {patchling-0.9.1 → patchling-0.9.2}/pyproject.toml +0 -0
  20. {patchling-0.9.1 → patchling-0.9.2}/setup.cfg +0 -0
  21. {patchling-0.9.1 → patchling-0.9.2}/setup.py +0 -0
  22. {patchling-0.9.1 → patchling-0.9.2}/tests/test_applydiff.py +0 -0
  23. {patchling-0.9.1 → patchling-0.9.2}/tests/test_applydiff_edgecases.py +0 -0
  24. {patchling-0.9.1 → patchling-0.9.2}/tests/test_argparse_interleaving.py +0 -0
  25. {patchling-0.9.1 → patchling-0.9.2}/tests/test_diff_parse.py +0 -0
  26. {patchling-0.9.1 → patchling-0.9.2}/tests/test_extract_diff_blocks.py +0 -0
  27. {patchling-0.9.1 → patchling-0.9.2}/tests/test_failing_case.py +0 -0
  28. {patchling-0.9.1 → patchling-0.9.2}/tests/test_live_llm.py +0 -0
  29. {patchling-0.9.1 → patchling-0.9.2}/tests/test_multidiff.py +0 -0
  30. {patchling-0.9.1 → patchling-0.9.2}/tests/test_parse_diff_per_file.py +0 -0
  31. {patchling-0.9.1 → patchling-0.9.2}/tests/test_public_api.py +0 -0
  32. {patchling-0.9.1 → patchling-0.9.2}/tests/test_relevance.py +0 -0
  33. {patchling-0.9.1 → patchling-0.9.2}/tests/test_relevance_bench.py +0 -0
  34. {patchling-0.9.1 → patchling-0.9.2}/tests/test_relevance_live.py +0 -0
  35. {patchling-0.9.1 → patchling-0.9.2}/tests/test_smartapply.py +0 -0
  36. {patchling-0.9.1 → patchling-0.9.2}/tests/test_smartapply_bugs.py +0 -0
  37. {patchling-0.9.1 → patchling-0.9.2}/tests/test_strip_bad_ouput.py +0 -0
  38. {patchling-0.9.1 → patchling-0.9.2}/tests/test_swallow_reasoning.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: patchling
3
- Version: 0.9.1
3
+ Version: 0.9.2
4
4
  Summary: Natural-language code transformation as a library: generate unified diffs with LLMs and apply them resiliently with smartapply. Formerly gptdiff.
5
5
  Author: 255labs
6
6
  License: MIT
@@ -77,6 +77,8 @@ Building for the browser? Start with [patchling for JS](https://github.com/255BI
77
77
  pip install patchling
78
78
  ```
79
79
 
80
+ Verify the installed CLI version with `patchling --version` or `patchling-apply --version`.
81
+
80
82
  ### 2. Set your API key
81
83
 
82
84
  Works with any OpenAI-compatible endpoint. Get a key at [nano-gpt.com/api](https://nano-gpt.com/api), or point `GPTDIFF_LLM_BASE_URL` at your own provider.
@@ -48,6 +48,8 @@ Building for the browser? Start with [patchling for JS](https://github.com/255BI
48
48
  pip install patchling
49
49
  ```
50
50
 
51
+ Verify the installed CLI version with `patchling --version` or `patchling-apply --version`.
52
+
51
53
  ### 2. Set your API key
52
54
 
53
55
  Works with any OpenAI-compatible endpoint. Get a key at [nano-gpt.com/api](https://nano-gpt.com/api), or point `GPTDIFF_LLM_BASE_URL` at your own provider.
@@ -29,7 +29,7 @@ from .relevance import (
29
29
  filter_relevant,
30
30
  )
31
31
 
32
- __version__ = "0.9.1"
32
+ __version__ = "0.9.2"
33
33
 
34
34
  __all__ = [
35
35
  "__version__",
@@ -852,7 +852,10 @@ def smartapply(
852
852
  return result
853
853
 
854
854
  def parse_arguments():
855
+ from . import __version__
856
+
855
857
  parser = argparse.ArgumentParser(description='Generate and optionally apply git diffs using GPT-4.')
858
+ parser.add_argument('--version', action='version', version=f'%(prog)s {__version__}')
856
859
  parser.add_argument('prompt', type=str, help='Prompt that runs on the codebase.')
857
860
  parser.add_argument('--apply', action='store_true', help='Attempt to apply the generated git diff. Uses smartapply if applying the patch fails.')
858
861
  parser.add_argument('--prepend', type=str, default=None, help='Path to content prepended to system prompt')
@@ -16,9 +16,12 @@ from pathlib import Path
16
16
  from patchling.core import apply_diff, smart_apply_patch, color_code_diff
17
17
 
18
18
  def parse_arguments():
19
+ from . import __version__
20
+
19
21
  parser = argparse.ArgumentParser(
20
22
  description="Apply a unified diff to the file system using GPTDiff's patch logic."
21
23
  )
24
+ parser.add_argument('--version', action='version', version=f'%(prog)s {__version__}')
22
25
  group = parser.add_mutually_exclusive_group(required=True)
23
26
  group.add_argument(
24
27
  "--diff",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: patchling
3
- Version: 0.9.1
3
+ Version: 0.9.2
4
4
  Summary: Natural-language code transformation as a library: generate unified diffs with LLMs and apply them resiliently with smartapply. Formerly gptdiff.
5
5
  Author: 255labs
6
6
  License: MIT
@@ -77,6 +77,8 @@ Building for the browser? Start with [patchling for JS](https://github.com/255BI
77
77
  pip install patchling
78
78
  ```
79
79
 
80
+ Verify the installed CLI version with `patchling --version` or `patchling-apply --version`.
81
+
80
82
  ### 2. Set your API key
81
83
 
82
84
  Works with any OpenAI-compatible endpoint. Get a key at [nano-gpt.com/api](https://nano-gpt.com/api), or point `GPTDIFF_LLM_BASE_URL` at your own provider.
@@ -18,6 +18,7 @@ patchling.egg-info/top_level.txt
18
18
  tests/test_applydiff.py
19
19
  tests/test_applydiff_edgecases.py
20
20
  tests/test_argparse_interleaving.py
21
+ tests/test_cli_version.py
21
22
  tests/test_diff_parse.py
22
23
  tests/test_extract_diff_blocks.py
23
24
  tests/test_failing_case.py
@@ -0,0 +1,24 @@
1
+ """Installed entry points report their version without required arguments."""
2
+
3
+ from pathlib import Path
4
+ import subprocess
5
+ import sys
6
+
7
+ import pytest
8
+
9
+ import patchling
10
+
11
+
12
+ @pytest.mark.parametrize("command", ["patchling", "patchling-apply", "gptdiff", "gptpatch"])
13
+ def test_installed_cli_version(command, tmp_path):
14
+ executable = Path(sys.executable).with_name(command)
15
+ result = subprocess.run(
16
+ [str(executable), "--version"],
17
+ cwd=tmp_path,
18
+ capture_output=True,
19
+ text=True,
20
+ timeout=10,
21
+ )
22
+ assert result.returncode == 0, result.stderr
23
+ assert result.stdout.strip() == f"{command} {patchling.__version__}"
24
+ assert result.stderr == ""
@@ -1,5 +1,6 @@
1
- """Version 0.8.1 is single-sourced from patchling.__version__."""
1
+ """Package and release metadata share patchling.__version__."""
2
2
 
3
+ from configparser import ConfigParser
3
4
  from importlib.metadata import version
4
5
  from pathlib import Path
5
6
 
@@ -9,21 +10,22 @@ import patchling
9
10
  ROOT = Path(__file__).resolve().parents[1]
10
11
 
11
12
 
12
- def test_version_constant_is_0_8_1():
13
- assert patchling.__version__ == "0.8.1"
14
- assert version("patchling") == "0.8.1"
13
+ def test_installed_version_matches_package():
14
+ assert version("patchling") == patchling.__version__
15
15
 
16
16
 
17
17
  def test_pyproject_does_not_hardcode_a_second_version():
18
18
  text = (ROOT / "pyproject.toml").read_text()
19
19
  assert 'dynamic = ["version"]' in text
20
- assert 'version = "0.8.1"' not in text
20
+ assert f'version = "{patchling.__version__}"' not in text
21
21
  assert 'attr = "patchling.__version__"' in text
22
22
 
23
23
 
24
24
  def test_bumpversion_tracks_the_package_constant():
25
25
  cfg = (ROOT / ".bumpversion.cfg").read_text()
26
- assert "current_version = 0.8.1" in cfg
26
+ parser = ConfigParser(interpolation=None)
27
+ parser.read_string(cfg)
28
+ assert parser["bumpversion"]["current_version"] == patchling.__version__
27
29
  assert "patchling/__init__.py" in cfg
28
30
  assert "setup.py" not in cfg
29
31
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes