framework-py 0.1.0.dev32__py3-none-any.whl → 0.1.0.dev33__py3-none-any.whl

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.
framework/catalog.py CHANGED
@@ -57,7 +57,8 @@ class DataInfo:
57
57
  private: Whether the file is in a private folder: one whose name
58
58
  contains private, confidential, or sensitive, at any depth below
59
59
  the project root.
60
- description: Shown when the data is read.
60
+ description: Optional description of the dataset, printed by ``data_read()``
61
+ when ``scaffold.print_description_on_read`` is ``true``.
61
62
  name: The catalog name, when the file was found by name.
62
63
  extra: Any other fields of the catalog entry.
63
64
  columns: With ``data_info(..., columns=True)``: one row per column, with its
framework/data.py CHANGED
@@ -363,6 +363,12 @@ def data_read(
363
363
  later read. A changed locked file raises ``IntegrityError``. A changed
364
364
  unlocked file issues a ``DataChangedWarning``.
365
365
 
366
+ With ``print_description_on_read: true`` under ``scaffold:`` in
367
+ ``settings/scaffold.yml`` (or ``settings.yml``), ``data_read()`` prints a
368
+ catalog entry's ``description`` on each read as
369
+ ``Note: <name>: <description>``. Printing is off by default.
370
+ ``data_list()`` always shows descriptions.
371
+
366
372
  Args:
367
373
  path: A catalog name such as ``"inputs.raw.survey"``, or a file path. A relative
368
374
  path is looked for from the project root, then from the current folder.
@@ -429,13 +435,29 @@ def data_read(
429
435
  _check_integrity(path, info)
430
436
 
431
437
  data = read_file(info, delim, keep_attributes, r_args, kwargs)
432
- if info.description:
438
+ if info.description and _print_description_on_read():
433
439
  inform(f"Note: {path}: {info.description}")
434
440
  if info.private or is_private_data(info.path, _root_or_none()):
435
441
  note_private_read(path)
436
442
  return data
437
443
 
438
444
 
445
+ def _print_description_on_read() -> bool:
446
+ """Whether data_read() prints a catalog entry's description, as R does.
447
+
448
+ Off unless the project sets ``print_description_on_read: true`` under
449
+ ``scaffold:`` (settings/scaffold.yml), ``options:``, or the top level.
450
+ """
451
+ try:
452
+ config = settings_read()
453
+ except FrameworkError:
454
+ return False
455
+ for section in (config.get("scaffold"), config.get("options"), config):
456
+ if isinstance(section, dict) and section.get("print_description_on_read") is not None:
457
+ return section["print_description_on_read"] is True
458
+ return False
459
+
460
+
439
461
  def _catalog_entry(name: str) -> DataInfo | None:
440
462
  """The catalog entry ``name`` already has, or None."""
441
463
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: framework-py
3
- Version: 0.1.0.dev32
3
+ Version: 0.1.0.dev33
4
4
  Summary: Structured data science projects: a data catalog, integrity tracking, caching, outputs, and AI guardrails
5
5
  Project-URL: Homepage, https://framework.pub
6
6
  Project-URL: Source, https://github.com/frameworktools/framework-py
@@ -26,13 +26,13 @@ framework/adopt.py,sha256=oOfpfwo8ehTMDthctihGHi11sEg8StQ3R_85Bq-oq8Y,33441
26
26
  framework/ai.py,sha256=QTPbzGSGneRngZd9l7D7nJIUCraG7CWgz-v7BLbLiRg,8840
27
27
  framework/bootstrap.py,sha256=1UaLpzui-wJ4D6-b8-YN2-e4eMPtavVKsmnj6scoWWQ,10606
28
28
  framework/cache.py,sha256=z8Zaem5Q7dsAghuX9CgK_j0vhX5dDlRw7fl9f-CF3eA,17440
29
- framework/catalog.py,sha256=sl4V1judSCVoa2LYLXeQdDhWdsONTC_5s2_fpyPylto,13202
29
+ framework/catalog.py,sha256=UNyMj7g_iTBcQnFq_uwRAL4tlNh1NUDunrTtX4BfOBg,13306
30
30
  framework/cloud.py,sha256=juhTsfhiinvxwnpScEJoIDjw_Ytdk6njCk26WhLmqFk,68171
31
31
  framework/config_home.py,sha256=iSb0VuENgNOSnsZ_v53xFqjRiGgrB7OzZbHbyDOqKzs,8265
32
32
  framework/connections.py,sha256=99JqrNAi2zBpNYyxLV6SYj-NAJjh56pYh9jaMSYOHCU,32742
33
33
  framework/console.py,sha256=zQ0LuFDcxe1W1kuc5E1bJ03h8d3cvwFoqDT8dAJQyN0,1267
34
34
  framework/create.py,sha256=KSODHvnRFrSha79LH-0e4o1y_3e1ZjbTrjCDzQbhbYk,54728
35
- framework/data.py,sha256=HpiRl5qTk1o9G-XXNDgsWhNOgXlyYegv8-8KDz-HyPA,40853
35
+ framework/data.py,sha256=jWWkUeLey_FxOafsFrwKhoJoVXb9NguNcjhsd_laDL0,41817
36
36
  framework/data_registry.py,sha256=QrFki_-zd7gF4afOesYPAn7xZEvnhYolhxtz_0bsaSA,22477
37
37
  framework/db.py,sha256=UYEUCvk4vGytBkmdNTUxRpYPtoFSDHwTpgpfWFw31aE,8522
38
38
  framework/display.py,sha256=0FuKUt67uf5h1WjD4bwzoruc2XAN4y_j3mz_f5FskhE,5334
@@ -142,7 +142,7 @@ framework/templates/stubs/notebook-default.qmd,sha256=8Js1S2BcHYeQWmJS-kt31gBvIj
142
142
  framework/templates/stubs/notebook-minimal.qmd,sha256=2U2k8judffhrh_6m6r6OAbQBCYEtViAjeKRBqBYCJTM,178
143
143
  framework/templates/stubs/notebook-revealjs.qmd,sha256=_ztT_gHoudpB5DIjlbvtB5zQ8163DeV8xbWcT-HgJrI,409
144
144
  framework/templates/stubs/script-default.py,sha256=vbWqgW0_rHot17mQC3tYb92g_9L-cbTOeL3y99BRrSk,216
145
- framework_py-0.1.0.dev32.dist-info/METADATA,sha256=CpgnkL5A1C0o0M_ttMUnoUp9mONllnbc3Hjq33-mbns,5143
146
- framework_py-0.1.0.dev32.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
147
- framework_py-0.1.0.dev32.dist-info/licenses/LICENSE,sha256=giOOgSwALkZimC7uhLZQK8Untez641bLW1-2-Cjvmq0,1072
148
- framework_py-0.1.0.dev32.dist-info/RECORD,,
145
+ framework_py-0.1.0.dev33.dist-info/METADATA,sha256=J01N9AhgUz0_AmLz6Yn_MHWTlvb5wBQ7U-yE5aiDdo4,5143
146
+ framework_py-0.1.0.dev33.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
147
+ framework_py-0.1.0.dev33.dist-info/licenses/LICENSE,sha256=giOOgSwALkZimC7uhLZQK8Untez641bLW1-2-Cjvmq0,1072
148
+ framework_py-0.1.0.dev33.dist-info/RECORD,,