pre-commit-localupdate 0.5.0__tar.gz → 0.5.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 (19) hide show
  1. {pre_commit_localupdate-0.5.0 → pre_commit_localupdate-0.5.2}/PKG-INFO +1 -1
  2. pre_commit_localupdate-0.5.2/pre_commit_localupdate/__init__.py +1 -0
  3. {pre_commit_localupdate-0.5.0 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/packages/golang.py +5 -3
  4. {pre_commit_localupdate-0.5.0 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/packages/julia.py +5 -2
  5. {pre_commit_localupdate-0.5.0 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/packages/node.py +5 -2
  6. {pre_commit_localupdate-0.5.0 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/packages/package.py +8 -2
  7. {pre_commit_localupdate-0.5.0 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/packages/python.py +5 -2
  8. {pre_commit_localupdate-0.5.0 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/packages/rust.py +5 -2
  9. {pre_commit_localupdate-0.5.0 → pre_commit_localupdate-0.5.2}/pyproject.toml +1 -1
  10. pre_commit_localupdate-0.5.0/pre_commit_localupdate/__init__.py +0 -1
  11. {pre_commit_localupdate-0.5.0 → pre_commit_localupdate-0.5.2}/LICENSE +0 -0
  12. {pre_commit_localupdate-0.5.0 → pre_commit_localupdate-0.5.2}/README.md +0 -0
  13. {pre_commit_localupdate-0.5.0 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/__main__.py +0 -0
  14. {pre_commit_localupdate-0.5.0 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/cli.py +0 -0
  15. {pre_commit_localupdate-0.5.0 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/error.py +0 -0
  16. {pre_commit_localupdate-0.5.0 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/io.py +1 -1
  17. {pre_commit_localupdate-0.5.0 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/logs.py +0 -0
  18. {pre_commit_localupdate-0.5.0 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/packages/__init__.py +0 -0
  19. {pre_commit_localupdate-0.5.0 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/pre_commit_config.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pre-commit-localupdate
3
- Version: 0.5.0
3
+ Version: 0.5.2
4
4
  Summary: A CLI tool to automatically update additional dependencies within local hooks in pre-commit config files.
5
5
  Author: M. Farzalipour Tabriz
6
6
  Classifier: Development Status :: 3 - Alpha
@@ -0,0 +1 @@
1
+ __version__ = '0.5.2'
@@ -1,12 +1,14 @@
1
1
  # SPDX-FileCopyrightText: 2026 M. Farzalipour Tabriz, Max Planck Institute for Physics
2
2
  # SPDX-License-Identifier: LGPL-3.0-or-later
3
3
 
4
+ from __future__ import annotations
5
+
4
6
  import logging
5
7
  import re
6
8
 
7
9
  import requests
8
10
 
9
- from .package import PackageBase
11
+ from .package import PackageBase, QUERY_AGENT_STRING
10
12
 
11
13
  # Go Proxy API endpoints
12
14
  GO_PKG_LATEST_VERSION_API_URL = "https://proxy.golang.org/{package_path}/@latest"
@@ -79,8 +81,8 @@ class GoPackage(PackageBase):
79
81
  logging.debug("Fetching latest version for %s", package_path)
80
82
  try:
81
83
  url = GO_PKG_LATEST_VERSION_API_URL.format(package_path=package_path)
82
-
83
- response = requests.get(url, timeout=connection_timeout)
84
+ headers = {"User-Agent": QUERY_AGENT_STRING}
85
+ response = requests.get(url, headers=headers, timeout=connection_timeout)
84
86
  response.raise_for_status()
85
87
 
86
88
  data = response.json()
@@ -1,6 +1,8 @@
1
1
  # SPDX-FileCopyrightText: 2026 M. Farzalipour Tabriz, Max Planck Institute for Physics
2
2
  # SPDX-License-Identifier: LGPL-3.0-or-later
3
3
 
4
+ from __future__ import annotations
5
+
4
6
  import logging
5
7
  import re
6
8
  import tomllib
@@ -9,7 +11,7 @@ from dataclasses import dataclass
9
11
  import requests
10
12
  from packaging.version import InvalidVersion, Version
11
13
 
12
- from .package import PackageBase
14
+ from .package import PackageBase, QUERY_AGENT_STRING
13
15
 
14
16
  # Julia General Registry Source
15
17
  JULIA_PKG_API_URL = "https://raw.githubusercontent.com/JuliaRegistries/General/refs/heads/master/{package_name_first_letter}/{package_name}/Versions.toml"
@@ -81,7 +83,8 @@ class JuliaPackage(PackageBase):
81
83
  url = JULIA_PKG_API_URL.format(
82
84
  package_name=self.name, package_name_first_letter=self.name[0]
83
85
  )
84
- response = requests.get(url, timeout=connection_timeout)
86
+ headers = {"User-Agent": QUERY_AGENT_STRING}
87
+ response = requests.get(url, headers=headers, timeout=connection_timeout)
85
88
  response.raise_for_status()
86
89
 
87
90
  data = tomllib.loads(response.text)
@@ -1,12 +1,14 @@
1
1
  # SPDX-FileCopyrightText: 2026 M. Farzalipour Tabriz, Max Planck Institute for Physics
2
2
  # SPDX-License-Identifier: LGPL-3.0-or-later
3
3
 
4
+ from __future__ import annotations
5
+
4
6
  import logging
5
7
  import re
6
8
 
7
9
  import requests
8
10
 
9
- from .package import PackageBase
11
+ from .package import PackageBase, QUERY_AGENT_STRING
10
12
 
11
13
  NPM_API_URL = "https://registry.npmjs.org/{package_name}"
12
14
 
@@ -59,7 +61,8 @@ class NodePackage(PackageBase):
59
61
  """
60
62
  try:
61
63
  url = NPM_API_URL.format(package_name=self.name)
62
- response = requests.get(url, timeout=connection_timeout)
64
+ headers = {"User-Agent": QUERY_AGENT_STRING}
65
+ response = requests.get(url, headers=headers, timeout=connection_timeout)
63
66
  response.raise_for_status()
64
67
  data = response.json()
65
68
 
@@ -1,9 +1,15 @@
1
1
  # SPDX-FileCopyrightText: 2026 M. Farzalipour Tabriz, Max Planck Institute for Physics
2
2
  # SPDX-License-Identifier: LGPL-3.0-or-later
3
3
 
4
+ from __future__ import annotations
5
+
4
6
  from abc import ABC, abstractmethod
5
7
  from dataclasses import dataclass
6
8
 
9
+ from pre_commit_localupdate import __version__
10
+
11
+ QUERY_AGENT_STRING = f"pre-commit-localupdate/{__version__} (https://pypi.org/project/pre-commit-localupdate/)"
12
+
7
13
 
8
14
  @dataclass
9
15
  class PackageBase(ABC):
@@ -24,12 +30,12 @@ class PackageBase(ABC):
24
30
  @abstractmethod
25
31
  def from_specification(
26
32
  cls,
27
- spec_string: str,
33
+ spec: str,
28
34
  ) -> "PackageBase" | None:
29
35
  """Parse a package specification string into a Package object.
30
36
 
31
37
  Args:
32
- spec_string (str): The package specification string (without quotations).
38
+ spec (str): The package specification string (without quotations).
33
39
 
34
40
  Returns:
35
41
  "PackageBase" | None: A Package instance if parsing succeeds, otherwise None.
@@ -1,12 +1,14 @@
1
1
  # SPDX-FileCopyrightText: 2026 M. Farzalipour Tabriz, Max Planck Institute for Physics
2
2
  # SPDX-License-Identifier: LGPL-3.0-or-later
3
3
 
4
+ from __future__ import annotations
5
+
4
6
  import logging
5
7
 
6
8
  import requests
7
9
  from packaging.requirements import InvalidRequirement, Requirement
8
10
 
9
- from .package import PackageBase
11
+ from .package import PackageBase, QUERY_AGENT_STRING
10
12
 
11
13
  PYPI_API_URL = "https://pypi.org/pypi/{package_name}/json"
12
14
 
@@ -54,7 +56,8 @@ class PyPackage(PackageBase):
54
56
  logging.debug("Fetching latest version for %s", self.name)
55
57
  try:
56
58
  url = PYPI_API_URL.format(package_name=self.name)
57
- response = requests.get(url, timeout=connection_timeout)
59
+ headers = {"User-Agent": QUERY_AGENT_STRING}
60
+ response = requests.get(url, headers=headers, timeout=connection_timeout)
58
61
  response.raise_for_status()
59
62
  data = response.json()
60
63
  latest_version = data.get("info", {}).get("version")
@@ -1,13 +1,15 @@
1
1
  # SPDX-FileCopyrightText: 2026 M. Farzalipour Tabriz, Max Planck Institute for Physics
2
2
  # SPDX-License-Identifier: LGPL-3.0-or-later
3
3
 
4
+ from __future__ import annotations
5
+
4
6
  import logging
5
7
  import re
6
8
  from dataclasses import dataclass
7
9
 
8
10
  import requests
9
11
 
10
- from .package import PackageBase
12
+ from .package import PackageBase, QUERY_AGENT_STRING
11
13
 
12
14
  CRATES_API_URL = "https://crates.io/api/v1/crates/{package_name}"
13
15
 
@@ -62,7 +64,8 @@ class RustPackage(PackageBase):
62
64
  logging.debug("Fetching latest version for %s", self.name)
63
65
  try:
64
66
  url = CRATES_API_URL.format(package_name=self.name)
65
- response = requests.get(url, timeout=connection_timeout)
67
+ headers = {"User-Agent": QUERY_AGENT_STRING}
68
+ response = requests.get(url, headers=headers, timeout=connection_timeout)
66
69
  response.raise_for_status()
67
70
  data = response.json()
68
71
  latest_version = data.get("crate", {}).get("max_version")
@@ -29,7 +29,7 @@ dynamic = []
29
29
  name = "pre-commit-localupdate"
30
30
  readme = "README.md"
31
31
  requires-python = "<3.15,>=3.11"
32
- version = "0.5.0"
32
+ version = "0.5.2"
33
33
 
34
34
  [project.scripts]
35
35
  pre-commit-localupdate = "pre_commit_localupdate.__main__:main"
@@ -1 +0,0 @@
1
- __version__ = '0.5.0'
@@ -106,9 +106,9 @@ def save_config_file(
106
106
  dir=file_path.parent,
107
107
  delete=False,
108
108
  ) as temp_file:
109
+ temp_file_path = temp_file.name
109
110
  temp_file.write(final_content)
110
111
  os.fsync(temp_file.fileno())
111
- temp_file_path = temp_file.name
112
112
 
113
113
  os.replace(temp_file_path, file_path)
114
114
  logging.info("Successfully updated %s", file_path)