imbi-plugin-github 2.60.0__tar.gz → 2.62.0__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 (33) hide show
  1. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/PKG-INFO +2 -2
  2. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/pyproject.toml +2 -2
  3. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/src/imbi/plugins/github/public.py +11 -11
  4. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/tests/test_public.py +22 -9
  5. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/.gitignore +0 -0
  6. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/README.md +0 -0
  7. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/moon.yml +0 -0
  8. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/src/imbi/plugins/github/README.md +0 -0
  9. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/src/imbi/plugins/github/__init__.py +0 -0
  10. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/src/imbi/plugins/github/_app_auth.py +0 -0
  11. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/src/imbi/plugins/github/_hosts.py +0 -0
  12. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/src/imbi/plugins/github/_repos.py +0 -0
  13. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/src/imbi/plugins/github/commits.py +0 -0
  14. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/src/imbi/plugins/github/deployment.py +0 -0
  15. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/src/imbi/plugins/github/doctor.py +0 -0
  16. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/src/imbi/plugins/github/identity.py +0 -0
  17. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/src/imbi/plugins/github/lifecycle.py +0 -0
  18. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/src/imbi/plugins/github/plugin.py +0 -0
  19. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/src/imbi/plugins/github/pull_requests.py +0 -0
  20. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/src/imbi/plugins/github/py.typed +0 -0
  21. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/src/imbi/plugins/github/secret_provider.py +0 -0
  22. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/tests/__init__.py +0 -0
  23. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/tests/test_app_auth_scopes.py +0 -0
  24. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/tests/test_commits.py +0 -0
  25. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/tests/test_deployment.py +0 -0
  26. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/tests/test_doctor.py +0 -0
  27. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/tests/test_hosts.py +0 -0
  28. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/tests/test_identity.py +0 -0
  29. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/tests/test_lifecycle.py +0 -0
  30. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/tests/test_pull_requests.py +0 -0
  31. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/tests/test_repos.py +0 -0
  32. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/tests/test_secret_provider.py +0 -0
  33. {imbi_plugin_github-2.60.0 → imbi_plugin_github-2.62.0}/tests/test_secret_provider_live.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: imbi-plugin-github
3
- Version: 2.60.0
3
+ Version: 2.62.0
4
4
  Summary: GitHub identity plugin for Imbi (github.com / GHEC / GHES)
5
5
  Author-email: "Gavin M. Roy" <gavinr@aweber.com>
6
6
  License-Expression: BSD-3-Clause
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Programming Language :: Python :: 3.14
13
13
  Requires-Python: >=3.14
14
14
  Requires-Dist: httpx>=0.27
15
- Requires-Dist: imbi-common[databases]==2.60.0
15
+ Requires-Dist: imbi-common[databases]==2.62.0
16
16
  Requires-Dist: pydantic>=2
17
17
  Requires-Dist: pyjwt[crypto]>=2.8
18
18
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "imbi-plugin-github"
3
- version = "2.60.0"
3
+ version = "2.62.0"
4
4
  description = "GitHub identity plugin for Imbi (github.com / GHEC / GHES)"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.14"
@@ -18,7 +18,7 @@ classifiers = [
18
18
  ]
19
19
  dependencies = [
20
20
  "httpx>=0.27",
21
- "imbi-common[databases]==2.60.0",
21
+ "imbi-common[databases]==2.62.0",
22
22
  "pydantic>=2",
23
23
  "pyjwt[crypto]>=2.8",
24
24
  ]
@@ -22,10 +22,12 @@ class PublicRepository:
22
22
  """The :class:`~imbi.common.plugins.base.RepositoryReader` of a public
23
23
  ``github.com`` repository. It ignores ``ctx`` and ``credentials``."""
24
24
 
25
- # ponytail: 60 unauthenticated requests an hour per API pod IP; use
26
- # an org token if many public marketplaces sync often.
25
+ # ponytail: 60 unauthenticated API requests an hour per API pod IP
26
+ # for the refs; use an org token if many public marketplaces sync
27
+ # often.
27
28
  def __init__(self, owner: str, repo: str) -> None:
28
29
  self.base = f'https://api.github.com/repos/{owner}/{repo}'
30
+ self.raw = f'https://raw.githubusercontent.com/{owner}/{repo}'
29
31
 
30
32
  @classmethod
31
33
  def for_url(cls, url: str) -> PublicRepository | None:
@@ -37,21 +39,21 @@ class PublicRepository:
37
39
  return None
38
40
  return cls(*path.split('/'))
39
41
 
40
- async def _get(
41
- self, path: str, accept: str = 'application/vnd.github+json'
42
- ) -> httpx.Response:
42
+ async def _get(self, url: str) -> httpx.Response:
43
43
  # A renamed or moved repository answers 301 to /repositories/{id}.
44
44
  async with httpx.AsyncClient(
45
45
  timeout=30, follow_redirects=True
46
46
  ) as client:
47
47
  return await client.get(
48
- f'{self.base}{path}', headers={'Accept': accept}
48
+ url, headers={'Accept': 'application/vnd.github+json'}
49
49
  )
50
50
 
51
51
  async def resolve_committish(
52
52
  self, _ctx: object, _credentials: object, ref: str, /
53
53
  ) -> base.Ref:
54
- response = await self._get(f'/commits/{urllib.parse.quote(ref)}')
54
+ response = await self._get(
55
+ f'{self.base}/commits/{urllib.parse.quote(ref)}'
56
+ )
55
57
  response.raise_for_status()
56
58
  return base.Ref(name=ref, kind='branch', sha=response.json()['sha'])
57
59
 
@@ -64,7 +66,7 @@ class PublicRepository:
64
66
  ) -> list[base.Ref]:
65
67
  """Return the default branch only, whatever ``kind`` is."""
66
68
  del kind
67
- response = await self._get('')
69
+ response = await self._get(self.base)
68
70
  response.raise_for_status()
69
71
  branch = str(response.json()['default_branch'])
70
72
  ref = await self.resolve_committish(None, None, branch)
@@ -74,9 +76,7 @@ class PublicRepository:
74
76
  self, _ctx: object, _credentials: object, path: str, ref: str, /
75
77
  ) -> str | None:
76
78
  response = await self._get(
77
- f'/contents/{urllib.parse.quote(path)}?'
78
- f'{urllib.parse.urlencode({"ref": ref})}',
79
- 'application/vnd.github.raw+json',
79
+ f'{self.raw}/{urllib.parse.quote(ref)}/{urllib.parse.quote(path)}'
80
80
  )
81
81
  if response.status_code == 404:
82
82
  return None
@@ -9,6 +9,7 @@ from imbi.plugins.github import deployment, public
9
9
 
10
10
  SHA = 'a' * 40
11
11
  API = 'https://api.github.com/repos/anthropics/plugins'
12
+ RAW = 'https://raw.githubusercontent.com/anthropics/plugins'
12
13
 
13
14
 
14
15
  class PublicRepositoryTests(unittest.IsolatedAsyncioTestCase):
@@ -30,13 +31,10 @@ class PublicRepositoryTests(unittest.IsolatedAsyncioTestCase):
30
31
  async def test_reads_without_credentials(self) -> None:
31
32
  respx.get(API).respond(json={'default_branch': 'main'})
32
33
  commit = respx.get(f'{API}/commits/main').respond(json={'sha': SHA})
33
- respx.get(
34
- f'{API}/contents/.claude-plugin/marketplace.json',
35
- params={'ref': SHA},
34
+ file = respx.get(
35
+ f'{RAW}/{SHA}/.claude-plugin/marketplace.json'
36
36
  ).respond(text='{}')
37
- respx.get(f'{API}/contents/missing.json', params={'ref': SHA}).respond(
38
- 404
39
- )
37
+ respx.get(f'{RAW}/{SHA}/missing.json').respond(404)
40
38
  reader = public.PublicRepository('anthropics', 'plugins')
41
39
 
42
40
  refs = await reader.list_refs(None, {}, kind='default')
@@ -52,12 +50,13 @@ class PublicRepositoryTests(unittest.IsolatedAsyncioTestCase):
52
50
  '{}',
53
51
  )
54
52
  self.assertIsNone(await reader.get_file(None, {}, 'missing.json', SHA))
53
+ self.assertNotIn('authorization', file.calls.last.request.headers)
55
54
 
56
55
  @respx.mock
57
56
  async def test_get_file_encodes_the_ref(self) -> None:
58
- route = respx.get(
59
- f'{API}/contents/a.json', params={'ref': 'release&candidate'}
60
- ).respond(text='{}')
57
+ route = respx.get(f'{RAW}/release%26candidate/a.json').respond(
58
+ text='{}'
59
+ )
61
60
  reader = public.PublicRepository('anthropics', 'plugins')
62
61
  self.assertEqual(
63
62
  await reader.get_file(None, {}, 'a.json', 'release&candidate'),
@@ -65,6 +64,20 @@ class PublicRepositoryTests(unittest.IsolatedAsyncioTestCase):
65
64
  )
66
65
  self.assertTrue(route.called)
67
66
 
67
+ @respx.mock
68
+ async def test_get_file_encodes_the_path(self) -> None:
69
+ route = respx.get(f'{RAW}/{SHA}/my%20plugin/.mcp.json').respond(
70
+ text='{}'
71
+ )
72
+ reader = public.PublicRepository('anthropics', 'plugins')
73
+ self.assertEqual(
74
+ await reader.get_file(None, {}, 'my plugin/.mcp.json', SHA), '{}'
75
+ )
76
+ self.assertEqual(
77
+ route.calls.last.request.url.raw_path,
78
+ f'/anthropics/plugins/{SHA}/my%20plugin/.mcp.json'.encode(),
79
+ )
80
+
68
81
 
69
82
  class WebhookSignatureTests(unittest.TestCase):
70
83
  def test_signature_is_the_webhook_secret(self) -> None: