Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion labagent/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""labagent: launch and tear down hands-on labs (RAG, LLM, Databricks) and AWS training sandboxes."""

__version__ = "0.2.0"
__version__ = "0.2.1"
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ labagent = [
"terraform/*/.terraform.lock.hcl",
"terraform/*/tests/*.tftest.hcl",
"packs/*/sources/*.jsonl",
"packs/*/sources/*.json",
"packs/*/app/*",
"packs/*/app/static/*",
]
Expand Down
31 changes: 31 additions & 0 deletions tests/test_packaging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Every data file the code reads at runtime must be shipped in the wheel. Source-tree tests cannot see this: a missing
package-data pattern only breaks users who install from PyPI (this happened in 0.2.0: datasets.json was left out)."""
import fnmatch
import re
from pathlib import Path

ROOT = Path(__file__).parent.parent
PKG = ROOT / "labagent"
SKIP_PARTS = {"__pycache__", ".terraform"}


def patterns():
text = (ROOT / "pyproject.toml").read_text()
block = re.search(r"\[tool\.setuptools\.package-data\]\s*labagent = \[(.*?)\]", text, re.S).group(1)
return re.findall(r'"([^"]+)"', block)


def test_every_runtime_data_file_is_covered_by_package_data():
pats = patterns()
missing = []
for f in PKG.rglob("*"):
if not f.is_file() or f.suffix in (".py", ".pyc") or SKIP_PARTS & set(f.parts) or f.name == "ui.json":
continue
rel = f.relative_to(PKG).as_posix()
if not any(fnmatch.fnmatch(rel, p) for p in pats):
missing.append(rel)
assert not missing, f"not shipped in the wheel: {missing}"


def test_the_dataset_registry_pin_is_shipped():
assert any(fnmatch.fnmatch("packs/rag/sources/datasets.json", p) for p in patterns())
Loading