pre-commit-localupdate 0.5.1__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.1 → 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.1 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/packages/golang.py +3 -3
  4. {pre_commit_localupdate-0.5.1 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/packages/julia.py +3 -2
  5. {pre_commit_localupdate-0.5.1 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/packages/node.py +3 -2
  6. {pre_commit_localupdate-0.5.1 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/packages/package.py +6 -2
  7. {pre_commit_localupdate-0.5.1 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/packages/python.py +3 -2
  8. {pre_commit_localupdate-0.5.1 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/packages/rust.py +3 -2
  9. {pre_commit_localupdate-0.5.1 → pre_commit_localupdate-0.5.2}/pyproject.toml +1 -1
  10. pre_commit_localupdate-0.5.1/pre_commit_localupdate/__init__.py +0 -1
  11. {pre_commit_localupdate-0.5.1 → pre_commit_localupdate-0.5.2}/LICENSE +0 -0
  12. {pre_commit_localupdate-0.5.1 → pre_commit_localupdate-0.5.2}/README.md +0 -0
  13. {pre_commit_localupdate-0.5.1 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/__main__.py +0 -0
  14. {pre_commit_localupdate-0.5.1 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/cli.py +0 -0
  15. {pre_commit_localupdate-0.5.1 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/error.py +0 -0
  16. {pre_commit_localupdate-0.5.1 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/io.py +0 -0
  17. {pre_commit_localupdate-0.5.1 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/logs.py +0 -0
  18. {pre_commit_localupdate-0.5.1 → pre_commit_localupdate-0.5.2}/pre_commit_localupdate/packages/__init__.py +0 -0
  19. {pre_commit_localupdate-0.5.1 → 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.1
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'
@@ -8,7 +8,7 @@ import re
8
8
 
9
9
  import requests
10
10
 
11
- from .package import PackageBase
11
+ from .package import PackageBase, QUERY_AGENT_STRING
12
12
 
13
13
  # Go Proxy API endpoints
14
14
  GO_PKG_LATEST_VERSION_API_URL = "https://proxy.golang.org/{package_path}/@latest"
@@ -81,8 +81,8 @@ class GoPackage(PackageBase):
81
81
  logging.debug("Fetching latest version for %s", package_path)
82
82
  try:
83
83
  url = GO_PKG_LATEST_VERSION_API_URL.format(package_path=package_path)
84
-
85
- response = requests.get(url, timeout=connection_timeout)
84
+ headers = {"User-Agent": QUERY_AGENT_STRING}
85
+ response = requests.get(url, headers=headers, timeout=connection_timeout)
86
86
  response.raise_for_status()
87
87
 
88
88
  data = response.json()
@@ -11,7 +11,7 @@ from dataclasses import dataclass
11
11
  import requests
12
12
  from packaging.version import InvalidVersion, Version
13
13
 
14
- from .package import PackageBase
14
+ from .package import PackageBase, QUERY_AGENT_STRING
15
15
 
16
16
  # Julia General Registry Source
17
17
  JULIA_PKG_API_URL = "https://raw.githubusercontent.com/JuliaRegistries/General/refs/heads/master/{package_name_first_letter}/{package_name}/Versions.toml"
@@ -83,7 +83,8 @@ class JuliaPackage(PackageBase):
83
83
  url = JULIA_PKG_API_URL.format(
84
84
  package_name=self.name, package_name_first_letter=self.name[0]
85
85
  )
86
- response = requests.get(url, timeout=connection_timeout)
86
+ headers = {"User-Agent": QUERY_AGENT_STRING}
87
+ response = requests.get(url, headers=headers, timeout=connection_timeout)
87
88
  response.raise_for_status()
88
89
 
89
90
  data = tomllib.loads(response.text)
@@ -8,7 +8,7 @@ import re
8
8
 
9
9
  import requests
10
10
 
11
- from .package import PackageBase
11
+ from .package import PackageBase, QUERY_AGENT_STRING
12
12
 
13
13
  NPM_API_URL = "https://registry.npmjs.org/{package_name}"
14
14
 
@@ -61,7 +61,8 @@ class NodePackage(PackageBase):
61
61
  """
62
62
  try:
63
63
  url = NPM_API_URL.format(package_name=self.name)
64
- response = requests.get(url, timeout=connection_timeout)
64
+ headers = {"User-Agent": QUERY_AGENT_STRING}
65
+ response = requests.get(url, headers=headers, timeout=connection_timeout)
65
66
  response.raise_for_status()
66
67
  data = response.json()
67
68
 
@@ -6,6 +6,10 @@ from __future__ import annotations
6
6
  from abc import ABC, abstractmethod
7
7
  from dataclasses import dataclass
8
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
+
9
13
 
10
14
  @dataclass
11
15
  class PackageBase(ABC):
@@ -26,12 +30,12 @@ class PackageBase(ABC):
26
30
  @abstractmethod
27
31
  def from_specification(
28
32
  cls,
29
- spec_string: str,
33
+ spec: str,
30
34
  ) -> "PackageBase" | None:
31
35
  """Parse a package specification string into a Package object.
32
36
 
33
37
  Args:
34
- spec_string (str): The package specification string (without quotations).
38
+ spec (str): The package specification string (without quotations).
35
39
 
36
40
  Returns:
37
41
  "PackageBase" | None: A Package instance if parsing succeeds, otherwise None.
@@ -8,7 +8,7 @@ import logging
8
8
  import requests
9
9
  from packaging.requirements import InvalidRequirement, Requirement
10
10
 
11
- from .package import PackageBase
11
+ from .package import PackageBase, QUERY_AGENT_STRING
12
12
 
13
13
  PYPI_API_URL = "https://pypi.org/pypi/{package_name}/json"
14
14
 
@@ -56,7 +56,8 @@ class PyPackage(PackageBase):
56
56
  logging.debug("Fetching latest version for %s", self.name)
57
57
  try:
58
58
  url = PYPI_API_URL.format(package_name=self.name)
59
- response = requests.get(url, timeout=connection_timeout)
59
+ headers = {"User-Agent": QUERY_AGENT_STRING}
60
+ response = requests.get(url, headers=headers, timeout=connection_timeout)
60
61
  response.raise_for_status()
61
62
  data = response.json()
62
63
  latest_version = data.get("info", {}).get("version")
@@ -9,7 +9,7 @@ from dataclasses import dataclass
9
9
 
10
10
  import requests
11
11
 
12
- from .package import PackageBase
12
+ from .package import PackageBase, QUERY_AGENT_STRING
13
13
 
14
14
  CRATES_API_URL = "https://crates.io/api/v1/crates/{package_name}"
15
15
 
@@ -64,7 +64,8 @@ class RustPackage(PackageBase):
64
64
  logging.debug("Fetching latest version for %s", self.name)
65
65
  try:
66
66
  url = CRATES_API_URL.format(package_name=self.name)
67
- response = requests.get(url, timeout=connection_timeout)
67
+ headers = {"User-Agent": QUERY_AGENT_STRING}
68
+ response = requests.get(url, headers=headers, timeout=connection_timeout)
68
69
  response.raise_for_status()
69
70
  data = response.json()
70
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.1"
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.1'