funcd-bundle 0.3.1__tar.gz → 0.3.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.
@@ -8,3 +8,5 @@ __pycache__/
8
8
  .DS_Store
9
9
  # the PyPI build (wheel + sdist), built at publish time
10
10
  dist/
11
+ # scripts/agent/d's cached dev-shell environment
12
+ .cache/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: funcd-bundle
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Bundle a Python funcd function and its locked dependencies for the funcd runtime
5
5
  Project-URL: Homepage, https://github.com/pyvvo/funcd-python
6
6
  Project-URL: Repository, https://github.com/pyvvo/funcd-python
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "funcd-bundle"
3
3
  # Not bumped per release: the vX.Y.Z git tag is the version, stamped into the build at publish time.
4
- version = "0.3.1"
4
+ version = "0.3.2"
5
5
  description = "Bundle a Python funcd function and its locked dependencies for the funcd runtime"
6
6
  authors = [{ name = "The funcd Authors" }]
7
7
  readme = "README.md"
@@ -329,8 +329,14 @@ def _copy_handler(project: Path, fn: Function, out: Path) -> list[Path]:
329
329
 
330
330
  shutil.copytree(source, out, dirs_exist_ok=True, ignore=ignore)
331
331
  sources = [p for p in source.rglob("*.py") if not SKIPPED.intersection(p.relative_to(source).parts)]
332
- # inside the bundle the handler sits at the root, so a `main` must name it there (funcdctl dev reads it)
333
- text = MAIN_LINE.sub(f"main: {fn.handler.name}", fn.manifest.read_text())
332
+ # inside the bundle the handler sits at the root, so `main` must name it there (funcdctl dev reads it); a
333
+ # manifest without one gets one, else the bundle's generic manifest would default to handler.py
334
+ main = f"main: {fn.handler.name}"
335
+ text, found = MAIN_LINE.subn(main, fn.manifest.read_text())
336
+ if not found:
337
+ if text and not text.endswith("\n"):
338
+ text += "\n"
339
+ text += main + "\n"
334
340
  (out / GENERIC_MANIFEST).write_text(text)
335
341
  return sources
336
342
 
@@ -255,6 +255,26 @@ def test_default_handler_follows_funcdctl(tmp_path: Path) -> None:
255
255
  )
256
256
 
257
257
 
258
+ def test_issue_154_stem_manifest_without_main_names_bundled_handler(tmp_path: Path) -> None:
259
+ manifest = "runtime: python314\nhandler: handle\n"
260
+ project = tmp_path / "project"
261
+ _write(
262
+ project,
263
+ {
264
+ "pyproject.toml": '[project]\nname = "extract"\nversion = "0.1.0"\nrequires-python = ">=3.12"\n',
265
+ "extract.funcdctl.yaml": manifest,
266
+ "extract.py": "def handle(ctx, event): ...\n",
267
+ },
268
+ )
269
+ _uv("lock", "--offline", "--python", "3.14", cwd=project)
270
+ out = bundle(project, "extract", host_platform(), tmp_path / "extract", hermetic=False, check=False)
271
+
272
+ assert discover(out)["extract"].handler == out / "extract.py", (
273
+ "the bundle's generic manifest resolves to the bundled handler, not handler.py"
274
+ )
275
+ assert (out / "funcdctl.yaml").read_text() == manifest + "main: extract.py\n"
276
+
277
+
258
278
  def test_missing_handler_is_named(tmp_path: Path) -> None:
259
279
  _write(tmp_path, {"funcdctl.yaml": "runtime: python314\nmain: src/nope.py\n"})
260
280
  with pytest.raises(BundleError, match="nope.py"):
File without changes
File without changes