framework-py 0.1.0.dev17__py3-none-any.whl → 0.1.0.dev19__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/__init__.py CHANGED
@@ -63,6 +63,7 @@ from framework.create import (
63
63
  project_create_from_layers,
64
64
  )
65
65
  from framework.data import data_add, data_read, data_save
66
+ from framework.data_registry import pull_data_registry, push_data_registry
66
67
  from framework.display import TableDisplay, show_table
67
68
  from framework.errors import (
68
69
  CacheWarning,
@@ -128,7 +129,6 @@ from framework.scaffold import project_info, scaffold, status
128
129
  from framework.scratch import scratch_capture, scratch_clean
129
130
  from framework.security import AuditResult, git_security_audit
130
131
  from framework.settings import settings, settings_read, settings_write
131
- from framework.setup_sync import pull_setup, push_setup
132
132
  from framework.skill_pull import pull_skills, push_skills
133
133
  from framework.skill_sync import skills_sync
134
134
  from framework.spec.check import spec_check
@@ -142,6 +142,7 @@ from framework.storage import (
142
142
  publish_notebook,
143
143
  storage_test,
144
144
  )
145
+ from framework.sync_all import pull_all, push_all
145
146
  from framework.upgrade import UpgradeResult, upgrade
146
147
 
147
148
  try:
@@ -249,9 +250,11 @@ __all__ = [
249
250
  "publish_dir",
250
251
  "publish_list",
251
252
  "publish_notebook",
252
- "pull_setup",
253
+ "pull_all",
254
+ "pull_data_registry",
253
255
  "pull_skills",
254
- "push_setup",
256
+ "push_all",
257
+ "push_data_registry",
255
258
  "push_skills",
256
259
  "quarto_generate_all",
257
260
  "quarto_regenerate",
@@ -411,6 +411,23 @@
411
411
  "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
412
412
  }
413
413
  },
414
+ "data": {
415
+ "type": "object",
416
+ "additionalProperties": {
417
+ "anyOf": [
418
+ {
419
+ "$ref": "#/definitions/data_entry"
420
+ },
421
+ {
422
+ "type": "null"
423
+ }
424
+ ]
425
+ },
426
+ "description": "The data catalog: dot-notation name -> entry. Each entry is replaced whole when a later layer sets it; project creation writes the names nested under data in the settings.",
427
+ "propertyNames": {
428
+ "pattern": "^[A-Za-z0-9_][A-Za-z0-9_-]*([.][A-Za-z0-9_][A-Za-z0-9_-]*)*$"
429
+ }
430
+ },
414
431
  "data_hooks": {
415
432
  "type": "object",
416
433
  "additionalProperties": {
@@ -732,6 +749,69 @@
732
749
  "required": [
733
750
  "driver"
734
751
  ]
752
+ },
753
+ "data_entry": {
754
+ "type": "object",
755
+ "properties": {
756
+ "path": {
757
+ "type": "string",
758
+ "minLength": 1,
759
+ "pattern": "^(?!/)(?!.*(^|/)\\.\\.(/|$))[^\\\\]+$"
760
+ },
761
+ "type": {
762
+ "type": "string",
763
+ "enum": [
764
+ "csv",
765
+ "tsv",
766
+ "rds",
767
+ "excel",
768
+ "xlsx",
769
+ "xls",
770
+ "parquet",
771
+ "stata",
772
+ "dta",
773
+ "spss",
774
+ "sav",
775
+ "zsav",
776
+ "spss_por",
777
+ "por",
778
+ "sas",
779
+ "sas7bdat",
780
+ "sas7bcat",
781
+ "sas_xpt",
782
+ "xpt"
783
+ ]
784
+ },
785
+ "delimiter": {
786
+ "type": "string",
787
+ "enum": [
788
+ "comma",
789
+ "tab",
790
+ "semicolon",
791
+ "space"
792
+ ]
793
+ },
794
+ "locked": {
795
+ "type": "boolean"
796
+ },
797
+ "private": {
798
+ "type": "boolean"
799
+ },
800
+ "description": {
801
+ "type": "string"
802
+ },
803
+ "stata_names": {
804
+ "type": "object",
805
+ "additionalProperties": {
806
+ "type": "string"
807
+ },
808
+ "description": "Column name in the file -> Stata variable name (fw_use)"
809
+ }
810
+ },
811
+ "additionalProperties": false,
812
+ "required": [
813
+ "path"
814
+ ]
735
815
  }
736
816
  }
737
817
  }
@@ -385,6 +385,69 @@
385
385
  "driver"
386
386
  ]
387
387
  },
388
+ "data_entry": {
389
+ "type": "object",
390
+ "properties": {
391
+ "path": {
392
+ "type": "string",
393
+ "minLength": 1,
394
+ "pattern": "^(?!/)(?!.*(^|/)\\.\\.(/|$))[^\\\\]+$"
395
+ },
396
+ "type": {
397
+ "type": "string",
398
+ "enum": [
399
+ "csv",
400
+ "tsv",
401
+ "rds",
402
+ "excel",
403
+ "xlsx",
404
+ "xls",
405
+ "parquet",
406
+ "stata",
407
+ "dta",
408
+ "spss",
409
+ "sav",
410
+ "zsav",
411
+ "spss_por",
412
+ "por",
413
+ "sas",
414
+ "sas7bdat",
415
+ "sas7bcat",
416
+ "sas_xpt",
417
+ "xpt"
418
+ ]
419
+ },
420
+ "delimiter": {
421
+ "type": "string",
422
+ "enum": [
423
+ "comma",
424
+ "tab",
425
+ "semicolon",
426
+ "space"
427
+ ]
428
+ },
429
+ "locked": {
430
+ "type": "boolean"
431
+ },
432
+ "private": {
433
+ "type": "boolean"
434
+ },
435
+ "description": {
436
+ "type": "string"
437
+ },
438
+ "stata_names": {
439
+ "type": "object",
440
+ "additionalProperties": {
441
+ "type": "string"
442
+ },
443
+ "description": "Column name in the file -> Stata variable name (fw_use)"
444
+ }
445
+ },
446
+ "additionalProperties": false,
447
+ "required": [
448
+ "path"
449
+ ]
450
+ },
388
451
  "layer": {
389
452
  "title": "Framework project spec layer",
390
453
  "description": "One unmerged layer of a project spec. Every field is optional, and a null map entry removes that key when spec_resolve() merges layers.",
@@ -796,6 +859,23 @@
796
859
  "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
797
860
  }
798
861
  },
862
+ "data": {
863
+ "type": "object",
864
+ "additionalProperties": {
865
+ "anyOf": [
866
+ {
867
+ "$ref": "#/definitions/data_entry"
868
+ },
869
+ {
870
+ "type": "null"
871
+ }
872
+ ]
873
+ },
874
+ "description": "The data catalog: dot-notation name -> entry. Each entry is replaced whole when a later layer sets it; project creation writes the names nested under data in the settings.",
875
+ "propertyNames": {
876
+ "pattern": "^[A-Za-z0-9_][A-Za-z0-9_-]*([.][A-Za-z0-9_][A-Za-z0-9_-]*)*$"
877
+ }
878
+ },
799
879
  "data_hooks": {
800
880
  "type": "object",
801
881
  "additionalProperties": {
@@ -369,6 +369,16 @@
369
369
  "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
370
370
  }
371
371
  },
372
+ "data": {
373
+ "type": "object",
374
+ "additionalProperties": {
375
+ "$ref": "#/definitions/data_entry"
376
+ },
377
+ "description": "The data catalog: dot-notation name -> entry. Each entry is replaced whole when a later layer sets it; project creation writes the names nested under data in the settings.",
378
+ "propertyNames": {
379
+ "pattern": "^[A-Za-z0-9_][A-Za-z0-9_-]*([.][A-Za-z0-9_][A-Za-z0-9_-]*)*$"
380
+ }
381
+ },
372
382
  "data_hooks": {
373
383
  "type": "object",
374
384
  "additionalProperties": {
@@ -720,6 +730,69 @@
720
730
  "required": [
721
731
  "driver"
722
732
  ]
733
+ },
734
+ "data_entry": {
735
+ "type": "object",
736
+ "properties": {
737
+ "path": {
738
+ "type": "string",
739
+ "minLength": 1,
740
+ "pattern": "^(?!/)(?!.*(^|/)\\.\\.(/|$))[^\\\\]+$"
741
+ },
742
+ "type": {
743
+ "type": "string",
744
+ "enum": [
745
+ "csv",
746
+ "tsv",
747
+ "rds",
748
+ "excel",
749
+ "xlsx",
750
+ "xls",
751
+ "parquet",
752
+ "stata",
753
+ "dta",
754
+ "spss",
755
+ "sav",
756
+ "zsav",
757
+ "spss_por",
758
+ "por",
759
+ "sas",
760
+ "sas7bdat",
761
+ "sas7bcat",
762
+ "sas_xpt",
763
+ "xpt"
764
+ ]
765
+ },
766
+ "delimiter": {
767
+ "type": "string",
768
+ "enum": [
769
+ "comma",
770
+ "tab",
771
+ "semicolon",
772
+ "space"
773
+ ]
774
+ },
775
+ "locked": {
776
+ "type": "boolean"
777
+ },
778
+ "private": {
779
+ "type": "boolean"
780
+ },
781
+ "description": {
782
+ "type": "string"
783
+ },
784
+ "stata_names": {
785
+ "type": "object",
786
+ "additionalProperties": {
787
+ "type": "string"
788
+ },
789
+ "description": "Column name in the file -> Stata variable name (fw_use)"
790
+ }
791
+ },
792
+ "additionalProperties": false,
793
+ "required": [
794
+ "path"
795
+ ]
723
796
  }
724
797
  }
725
798
  }
@@ -0,0 +1,54 @@
1
+ {
2
+ "id": "easystats-r",
3
+ "name": "easystats",
4
+ "description": "The easystats packages: parameters, performance, effectsize, modelbased, correlation, bayestestR, and report to describe and check models, datawizard for data, and see for their plots.",
5
+ "language": [
6
+ "r"
7
+ ],
8
+ "layer": {
9
+ "packages": {
10
+ "default_packages": {
11
+ "insight": {
12
+ "source": "cran",
13
+ "auto_attach": false
14
+ },
15
+ "datawizard": {
16
+ "source": "cran",
17
+ "auto_attach": false
18
+ },
19
+ "parameters": {
20
+ "source": "cran",
21
+ "auto_attach": false
22
+ },
23
+ "performance": {
24
+ "source": "cran",
25
+ "auto_attach": false
26
+ },
27
+ "effectsize": {
28
+ "source": "cran",
29
+ "auto_attach": false
30
+ },
31
+ "modelbased": {
32
+ "source": "cran",
33
+ "auto_attach": false
34
+ },
35
+ "correlation": {
36
+ "source": "cran",
37
+ "auto_attach": false
38
+ },
39
+ "bayestestR": {
40
+ "source": "cran",
41
+ "auto_attach": false
42
+ },
43
+ "report": {
44
+ "source": "cran",
45
+ "auto_attach": false
46
+ },
47
+ "see": {
48
+ "source": "cran",
49
+ "auto_attach": false
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
framework/cloud.py CHANGED
@@ -61,7 +61,12 @@ _TIMEOUT = 30.0
61
61
 
62
62
 
63
63
  class CloudError(FrameworkError):
64
- """A Framework Cloud request failed."""
64
+ """A Framework Cloud request failed.
65
+
66
+ ``status`` is the HTTP status of the reply, or None when there was no reply.
67
+ """
68
+
69
+ status: int | None = None
65
70
 
66
71
 
67
72
  def _version() -> str:
@@ -372,13 +377,17 @@ def _error(response: httpx.Response, what: str) -> CloudError:
372
377
  ]
373
378
  if details:
374
379
  message = "\n".join([str(message), *details])
380
+ error: CloudError
375
381
  if response.status_code in (404, 405):
376
- return _MissingEndpointError(str(message))
377
- if response.status_code == 409:
378
- return CloudConflictError(str(message), body)
379
- if response.status_code >= 500:
380
- return CloudOfflineError(str(message))
381
- return CloudError(str(message))
382
+ error = _MissingEndpointError(str(message))
383
+ elif response.status_code == 409:
384
+ error = CloudConflictError(str(message), body)
385
+ elif response.status_code >= 500:
386
+ error = CloudOfflineError(str(message))
387
+ else:
388
+ error = CloudError(str(message))
389
+ error.status = response.status_code
390
+ return error
382
391
 
383
392
 
384
393
  def api(
framework/connections.py CHANGED
@@ -639,6 +639,11 @@ def db_execute_file(
639
639
  cursor = opened.cursor()
640
640
  try:
641
641
  cursor.execute(statement.sql)
642
+ if opened.driver == "sqlserver":
643
+ # A batch returns one result per statement, and pyodbc raises a
644
+ # later statement's error only when its result is read.
645
+ while cursor.nextset():
646
+ pass
642
647
  except Exception as error:
643
648
  raise FrameworkError(
644
649
  f"Statement {number} of {len(statements)} in {source.name} (line "
framework/create.py CHANGED
@@ -26,7 +26,7 @@ from framework.ai import write_ai_files
26
26
  from framework.config_home import config_dir, global_settings, project_register
27
27
  from framework.errors import FrameworkError
28
28
  from framework.quarto import quarto_generate_all
29
- from framework.spec.check import ASSISTANTS, spec_check
29
+ from framework.spec.check import ASSISTANTS, catalog_nest, spec_check
30
30
  from framework.spec.merge import SpecError
31
31
  from framework.spec.resolve import (
32
32
  TYPES,
@@ -172,11 +172,11 @@ def _write_settings(root: Path, spec: Mapping[str, Any]) -> None:
172
172
  main["connections"] = "settings/connections.yml"
173
173
  _yaml.write(root / "settings/connections.yml", {"connections": sections["connections"]})
174
174
  main["data"] = "settings/data.yml"
175
- _yaml.write(root / "settings/data.yml", {"data": {}})
175
+ _yaml.write(root / "settings/data.yml", {"data": catalog_nest(spec.get("data"))})
176
176
  else:
177
177
  for section in ("author", "quarto", "git", "ai", "scaffold"):
178
178
  main[section] = sections[section]
179
- main["data"] = {}
179
+ main["data"] = catalog_nest(spec.get("data"))
180
180
  main["connections"] = sections["connections"]
181
181
 
182
182
  if spec.get("publish") is not None: