framework-py 0.1.0.dev6__py3-none-any.whl → 0.1.0.dev8__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.
Files changed (68) hide show
  1. framework/__init__.py +6 -0
  2. framework/__main__.py +9 -4
  3. framework/_assets/hooks/pre-commit +10 -0
  4. framework/_assets/schema/docs-reference.v1.json +1 -1
  5. framework/_assets/schema/layer.v1.json +35 -0
  6. framework/_assets/schema/layers.v1.json +35 -0
  7. framework/_assets/schema/spec.v1.json +31 -0
  8. framework/_assets/sets/packages/bayes-r.json +51 -0
  9. framework/_assets/sets/packages/causal-inference-r.json +34 -0
  10. framework/_assets/sets/packages/fastapi-python.json +34 -0
  11. framework/_assets/sets/packages/large-data-r.json +30 -0
  12. framework/_assets/sets/packages/plumber-r.json +30 -0
  13. framework/_assets/sets/packages/polars-python.json +26 -0
  14. framework/_assets/sets/packages/python-bayes.json +26 -0
  15. framework/_assets/sets/packages/python-data-analysis.json +34 -0
  16. framework/_assets/sets/packages/python-database.json +26 -0
  17. framework/_assets/sets/packages/python-ml.json +22 -0
  18. framework/_assets/sets/packages/python-spatial.json +22 -0
  19. framework/_assets/sets/packages/python-viz.json +22 -0
  20. framework/_assets/sets/packages/regression-r.json +42 -0
  21. framework/_assets/sets/packages/shiny-python.json +30 -0
  22. framework/_assets/sets/packages/shiny-r.json +34 -0
  23. framework/_assets/sets/packages/spatial-r.json +26 -0
  24. framework/_assets/sets/packages/survey-r.json +22 -0
  25. framework/_assets/sets/packages/survival-r.json +30 -0
  26. framework/_assets/sets/packages/tables-r.json +30 -0
  27. framework/_assets/sets/packages/text-r.json +22 -0
  28. framework/_assets/sets/packages/tidy-core.json +26 -0
  29. framework/_assets/sets/packages/tidy-database.json +38 -0
  30. framework/_assets/sets/packages/tidy-omop.json +58 -0
  31. framework/_assets/sets/packages/tidymodels.json +22 -0
  32. framework/_assets/sets/packages/tidyverse-extended.json +70 -0
  33. framework/_keychain.py +79 -0
  34. framework/_log.py +9 -1
  35. framework/_pages.py +98 -14
  36. framework/_paths.py +19 -0
  37. framework/adopt.py +3 -2
  38. framework/ai.py +22 -4
  39. framework/bootstrap.py +49 -9
  40. framework/cache.py +28 -7
  41. framework/catalog.py +30 -6
  42. framework/cloud.py +227 -65
  43. framework/config_home.py +25 -3
  44. framework/connections.py +94 -11
  45. framework/create.py +54 -10
  46. framework/data.py +105 -53
  47. framework/db.py +11 -1
  48. framework/dotenv.py +57 -6
  49. framework/hooks.py +58 -14
  50. framework/notebooks.py +56 -26
  51. framework/outputs.py +51 -15
  52. framework/packages.py +130 -8
  53. framework/publish_bundle.py +589 -0
  54. framework/scaffold.py +21 -3
  55. framework/security.py +47 -18
  56. framework/settings.py +91 -22
  57. framework/skill_sync.py +3 -3
  58. framework/spec/check.py +31 -1
  59. framework/spec/resolve.py +1 -0
  60. framework/storage.py +420 -37
  61. framework/templates/defaults.yml +1 -1
  62. framework/templates/gitignore/course +2 -5
  63. framework/templates/reader.html +12 -0
  64. {framework_py-0.1.0.dev6.dist-info → framework_py-0.1.0.dev8.dist-info}/METADATA +1 -1
  65. framework_py-0.1.0.dev8.dist-info/RECORD +119 -0
  66. framework_py-0.1.0.dev6.dist-info/RECORD +0 -91
  67. {framework_py-0.1.0.dev6.dist-info → framework_py-0.1.0.dev8.dist-info}/WHEEL +0 -0
  68. {framework_py-0.1.0.dev6.dist-info → framework_py-0.1.0.dev8.dist-info}/licenses/LICENSE +0 -0
framework/__init__.py CHANGED
@@ -54,6 +54,7 @@ from framework.connections import (
54
54
  from framework.console import CapturedOutput, capture_output
55
55
  from framework.create import (
56
56
  new,
57
+ new_project,
57
58
  project_add_directory,
58
59
  project_create,
59
60
  project_create_from_layers,
@@ -107,6 +108,8 @@ from framework.outputs import (
107
108
  from framework.packages import (
108
109
  PackagesStatus,
109
110
  package_add,
111
+ package_set_add,
112
+ package_sets_list,
110
113
  packages_install,
111
114
  packages_list,
112
115
  packages_restore,
@@ -206,8 +209,11 @@ __all__ = [
206
209
  "make_revealjs",
207
210
  "make_script",
208
211
  "new",
212
+ "new_project",
209
213
  "now",
210
214
  "package_add",
215
+ "package_set_add",
216
+ "package_sets_list",
211
217
  "packages_install",
212
218
  "packages_list",
213
219
  "packages_restore",
framework/__main__.py CHANGED
@@ -35,7 +35,7 @@ def _parser() -> argparse.ArgumentParser:
35
35
  create.add_argument(
36
36
  "--type",
37
37
  choices=["project", "project_sensitive", "course", "presentation", "bare"],
38
- help="project type, with --name (default: bare, or asked with --interactive)",
38
+ help="project type, with --name (default: project, or asked with --interactive)",
39
39
  )
40
40
  create.add_argument(
41
41
  "--workflow",
@@ -129,8 +129,11 @@ def main(argv: Sequence[str] | None = None) -> int:
129
129
 
130
130
  tools = {}
131
131
  for tool in args.tool:
132
- name, _, value = tool.partition("=")
133
- tools[name] = value.lower() not in ("false", "no", "0", "off")
132
+ name, given, value = tool.partition("=")
133
+ switch = value.lower()
134
+ if given and switch not in ("true", "yes", "1", "on", "false", "no", "0", "off"):
135
+ parser.error(f"--tool {tool}: use {name}, {name}=true, or {name}=false")
136
+ tools[name] = switch not in ("false", "no", "0", "off")
134
137
  path = new(
135
138
  args.name,
136
139
  args.path,
@@ -143,7 +146,9 @@ def main(argv: Sequence[str] | None = None) -> int:
143
146
  offline=args.offline,
144
147
  )
145
148
  except FrameworkError as error:
146
- print(f"Error: {error}", file=sys.stderr)
149
+ # The functions' advice names Python arguments; the command line has flags
150
+ message = str(error).replace("Pass yes=True.", "Pass --yes.")
151
+ print(f"Error: {message}", file=sys.stderr)
147
152
  return 1
148
153
  print(path)
149
154
  return 0
@@ -58,6 +58,16 @@ if [ "$status" -eq 127 ] && { [ -f pyproject.toml ] || [ -f uv.lock ] || [ -d .v
58
58
  run_python
59
59
  status=$?
60
60
  fi
61
+ # A project with no runtime markers (new_project() writes no .Rproj or
62
+ # renv.lock) still has a runtime: try R, then Python
63
+ if [ "$status" -eq 127 ] && [ -f settings.yml ]; then
64
+ run_r
65
+ status=$?
66
+ if [ "$status" -eq 127 ]; then
67
+ run_python
68
+ status=$?
69
+ fi
70
+ fi
61
71
 
62
72
  if [ "$status" -eq 127 ]; then
63
73
  echo "Framework hook: found neither R with framework 2.0 or later nor Python with framework-py." >&2
@@ -8,7 +8,7 @@
8
8
  "additionalProperties": false,
9
9
  "properties": {
10
10
  "schema": { "const": "docs-reference.v1" },
11
- "product": { "enum": ["r", "py", "cli"] },
11
+ "product": { "enum": ["r", "py", "cli", "stata"] },
12
12
  "version": { "type": "string", "minLength": 1, "description": "The release this reference was built from, such as 2.0.0 or 0.1.0.dev1." },
13
13
  "categories": {
14
14
  "type": "array",
@@ -350,6 +350,41 @@
350
350
  },
351
351
  "additionalProperties": false
352
352
  },
353
+ "publish": {
354
+ "type": "object",
355
+ "properties": {
356
+ "default": {
357
+ "type": "string",
358
+ "maxLength": 100
359
+ },
360
+ "destinations": {
361
+ "type": "object",
362
+ "additionalProperties": {
363
+ "anyOf": [
364
+ {
365
+ "type": "object",
366
+ "properties": {
367
+ "driver": {
368
+ "type": "string",
369
+ "enum": [
370
+ "cloud",
371
+ "github",
372
+ "folder",
373
+ "s3"
374
+ ]
375
+ }
376
+ },
377
+ "additionalProperties": true
378
+ },
379
+ {
380
+ "type": "null"
381
+ }
382
+ ]
383
+ }
384
+ }
385
+ },
386
+ "additionalProperties": false
387
+ },
353
388
  "security": {
354
389
  "type": "object",
355
390
  "properties": {
@@ -735,6 +735,41 @@
735
735
  },
736
736
  "additionalProperties": false
737
737
  },
738
+ "publish": {
739
+ "type": "object",
740
+ "properties": {
741
+ "default": {
742
+ "type": "string",
743
+ "maxLength": 100
744
+ },
745
+ "destinations": {
746
+ "type": "object",
747
+ "additionalProperties": {
748
+ "anyOf": [
749
+ {
750
+ "type": "object",
751
+ "properties": {
752
+ "driver": {
753
+ "type": "string",
754
+ "enum": [
755
+ "cloud",
756
+ "github",
757
+ "folder",
758
+ "s3"
759
+ ]
760
+ }
761
+ },
762
+ "additionalProperties": true
763
+ },
764
+ {
765
+ "type": "null"
766
+ }
767
+ ]
768
+ }
769
+ }
770
+ },
771
+ "additionalProperties": false
772
+ },
738
773
  "security": {
739
774
  "type": "object",
740
775
  "properties": {
@@ -316,6 +316,37 @@
316
316
  "storage_buckets"
317
317
  ]
318
318
  },
319
+ "publish": {
320
+ "type": "object",
321
+ "properties": {
322
+ "default": {
323
+ "type": "string",
324
+ "maxLength": 100
325
+ },
326
+ "destinations": {
327
+ "type": "object",
328
+ "additionalProperties": {
329
+ "type": "object",
330
+ "properties": {
331
+ "driver": {
332
+ "type": "string",
333
+ "enum": [
334
+ "cloud",
335
+ "github",
336
+ "folder",
337
+ "s3"
338
+ ]
339
+ }
340
+ },
341
+ "additionalProperties": true,
342
+ "required": [
343
+ "driver"
344
+ ]
345
+ }
346
+ }
347
+ },
348
+ "additionalProperties": false
349
+ },
319
350
  "security": {
320
351
  "type": "object",
321
352
  "properties": {
@@ -0,0 +1,51 @@
1
+ {
2
+ "id": "bayes-r",
3
+ "name": "Bayes in R",
4
+ "description": "CmdStanR and brms for Stan models, rstanarm for common regressions, and bayesplot, posterior, loo, tidybayes, priorsense, and projpred to check and read them. CmdStanR needs CmdStan: run cmdstanr::install_cmdstan() once.",
5
+ "language": [
6
+ "r"
7
+ ],
8
+ "layer": {
9
+ "packages": {
10
+ "default_packages": {
11
+ "cmdstanr": {
12
+ "source": "github",
13
+ "repo": "stan-dev/cmdstanr",
14
+ "auto_attach": false
15
+ },
16
+ "brms": {
17
+ "source": "cran",
18
+ "auto_attach": false
19
+ },
20
+ "rstanarm": {
21
+ "source": "cran",
22
+ "auto_attach": false
23
+ },
24
+ "bayesplot": {
25
+ "source": "cran",
26
+ "auto_attach": false
27
+ },
28
+ "posterior": {
29
+ "source": "cran",
30
+ "auto_attach": false
31
+ },
32
+ "loo": {
33
+ "source": "cran",
34
+ "auto_attach": false
35
+ },
36
+ "tidybayes": {
37
+ "source": "cran",
38
+ "auto_attach": false
39
+ },
40
+ "priorsense": {
41
+ "source": "cran",
42
+ "auto_attach": false
43
+ },
44
+ "projpred": {
45
+ "source": "cran",
46
+ "auto_attach": false
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "id": "causal-inference-r",
3
+ "name": "Causal inference",
4
+ "description": "MatchIt and WeightIt for matching and weighting, cobalt for balance, and marginaleffects with sandwich for effects and robust errors.",
5
+ "language": [
6
+ "r"
7
+ ],
8
+ "layer": {
9
+ "packages": {
10
+ "default_packages": {
11
+ "MatchIt": {
12
+ "source": "cran",
13
+ "auto_attach": false
14
+ },
15
+ "WeightIt": {
16
+ "source": "cran",
17
+ "auto_attach": false
18
+ },
19
+ "cobalt": {
20
+ "source": "cran",
21
+ "auto_attach": false
22
+ },
23
+ "marginaleffects": {
24
+ "source": "cran",
25
+ "auto_attach": false
26
+ },
27
+ "sandwich": {
28
+ "source": "cran",
29
+ "auto_attach": false
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "id": "fastapi-python",
3
+ "name": "FastAPI app",
4
+ "description": "FastAPI with uvicorn to serve it, pydantic for request models, and httpx and pytest for tests.",
5
+ "language": [
6
+ "python"
7
+ ],
8
+ "layer": {
9
+ "packages": {
10
+ "default_packages": {
11
+ "fastapi": {
12
+ "source": "pypi",
13
+ "auto_attach": false
14
+ },
15
+ "uvicorn": {
16
+ "source": "pypi",
17
+ "auto_attach": false
18
+ },
19
+ "pydantic": {
20
+ "source": "pypi",
21
+ "auto_attach": false
22
+ },
23
+ "httpx": {
24
+ "source": "pypi",
25
+ "auto_attach": false
26
+ },
27
+ "pytest": {
28
+ "source": "pypi",
29
+ "auto_attach": false
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "id": "large-data-r",
3
+ "name": "Large data in R",
4
+ "description": "arrow and DuckDB for data larger than memory, and data.table for fast data in memory.",
5
+ "language": [
6
+ "r"
7
+ ],
8
+ "layer": {
9
+ "packages": {
10
+ "default_packages": {
11
+ "arrow": {
12
+ "source": "cran",
13
+ "auto_attach": false
14
+ },
15
+ "duckdb": {
16
+ "source": "cran",
17
+ "auto_attach": false
18
+ },
19
+ "duckplyr": {
20
+ "source": "cran",
21
+ "auto_attach": false
22
+ },
23
+ "data.table": {
24
+ "source": "cran",
25
+ "auto_attach": false
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "id": "plumber-r",
3
+ "name": "Plumber API",
4
+ "description": "plumber for the API, jsonlite and httr2 for JSON and requests, and logger for logs.",
5
+ "language": [
6
+ "r"
7
+ ],
8
+ "layer": {
9
+ "packages": {
10
+ "default_packages": {
11
+ "plumber": {
12
+ "source": "cran",
13
+ "auto_attach": false
14
+ },
15
+ "jsonlite": {
16
+ "source": "cran",
17
+ "auto_attach": false
18
+ },
19
+ "httr2": {
20
+ "source": "cran",
21
+ "auto_attach": false
22
+ },
23
+ "logger": {
24
+ "source": "cran",
25
+ "auto_attach": false
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "id": "polars-python",
3
+ "name": "Polars and DuckDB",
4
+ "description": "polars and DuckDB for fast data frames and SQL, with pyarrow for Parquet.",
5
+ "language": [
6
+ "python"
7
+ ],
8
+ "layer": {
9
+ "packages": {
10
+ "default_packages": {
11
+ "polars": {
12
+ "source": "pypi",
13
+ "auto_attach": false
14
+ },
15
+ "duckdb": {
16
+ "source": "pypi",
17
+ "auto_attach": false
18
+ },
19
+ "pyarrow": {
20
+ "source": "pypi",
21
+ "auto_attach": false
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "id": "python-bayes",
3
+ "name": "Bayes in Python",
4
+ "description": "PyMC for models, Bambi for regressions, and ArviZ to check and read them.",
5
+ "language": [
6
+ "python"
7
+ ],
8
+ "layer": {
9
+ "packages": {
10
+ "default_packages": {
11
+ "pymc": {
12
+ "source": "pypi",
13
+ "auto_attach": false
14
+ },
15
+ "bambi": {
16
+ "source": "pypi",
17
+ "auto_attach": false
18
+ },
19
+ "arviz": {
20
+ "source": "pypi",
21
+ "auto_attach": false
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "id": "python-data-analysis",
3
+ "name": "Python data analysis",
4
+ "description": "pandas and NumPy for data, matplotlib and seaborn for figures, and statsmodels for models.",
5
+ "language": [
6
+ "python"
7
+ ],
8
+ "layer": {
9
+ "packages": {
10
+ "default_packages": {
11
+ "pandas": {
12
+ "source": "pypi",
13
+ "auto_attach": false
14
+ },
15
+ "numpy": {
16
+ "source": "pypi",
17
+ "auto_attach": false
18
+ },
19
+ "matplotlib": {
20
+ "source": "pypi",
21
+ "auto_attach": false
22
+ },
23
+ "seaborn": {
24
+ "source": "pypi",
25
+ "auto_attach": false
26
+ },
27
+ "statsmodels": {
28
+ "source": "pypi",
29
+ "auto_attach": false
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "id": "python-database",
3
+ "name": "Python databases",
4
+ "description": "SQLAlchemy for SQL, with DuckDB and psycopg for PostgreSQL.",
5
+ "language": [
6
+ "python"
7
+ ],
8
+ "layer": {
9
+ "packages": {
10
+ "default_packages": {
11
+ "sqlalchemy": {
12
+ "source": "pypi",
13
+ "auto_attach": false
14
+ },
15
+ "duckdb": {
16
+ "source": "pypi",
17
+ "auto_attach": false
18
+ },
19
+ "psycopg": {
20
+ "source": "pypi",
21
+ "auto_attach": false
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "id": "python-ml",
3
+ "name": "Machine learning in Python",
4
+ "description": "scikit-learn for models and pipelines, and XGBoost for boosted trees.",
5
+ "language": [
6
+ "python"
7
+ ],
8
+ "layer": {
9
+ "packages": {
10
+ "default_packages": {
11
+ "scikit-learn": {
12
+ "source": "pypi",
13
+ "auto_attach": false
14
+ },
15
+ "xgboost": {
16
+ "source": "pypi",
17
+ "auto_attach": false
18
+ }
19
+ }
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "id": "python-spatial",
3
+ "name": "Spatial data in Python",
4
+ "description": "GeoPandas and Shapely for vector data.",
5
+ "language": [
6
+ "python"
7
+ ],
8
+ "layer": {
9
+ "packages": {
10
+ "default_packages": {
11
+ "geopandas": {
12
+ "source": "pypi",
13
+ "auto_attach": false
14
+ },
15
+ "shapely": {
16
+ "source": "pypi",
17
+ "auto_attach": false
18
+ }
19
+ }
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "id": "python-viz",
3
+ "name": "Interactive figures in Python",
4
+ "description": "plotly and Altair for interactive charts.",
5
+ "language": [
6
+ "python"
7
+ ],
8
+ "layer": {
9
+ "packages": {
10
+ "default_packages": {
11
+ "plotly": {
12
+ "source": "pypi",
13
+ "auto_attach": false
14
+ },
15
+ "altair": {
16
+ "source": "pypi",
17
+ "auto_attach": false
18
+ }
19
+ }
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "id": "regression-r",
3
+ "name": "Regression and mixed models",
4
+ "description": "lme4 and glmmTMB for mixed models, with marginaleffects, emmeans, performance, and broom to read them.",
5
+ "language": [
6
+ "r"
7
+ ],
8
+ "layer": {
9
+ "packages": {
10
+ "default_packages": {
11
+ "lme4": {
12
+ "source": "cran",
13
+ "auto_attach": false
14
+ },
15
+ "glmmTMB": {
16
+ "source": "cran",
17
+ "auto_attach": false
18
+ },
19
+ "marginaleffects": {
20
+ "source": "cran",
21
+ "auto_attach": false
22
+ },
23
+ "emmeans": {
24
+ "source": "cran",
25
+ "auto_attach": false
26
+ },
27
+ "performance": {
28
+ "source": "cran",
29
+ "auto_attach": false
30
+ },
31
+ "broom": {
32
+ "source": "cran",
33
+ "auto_attach": false
34
+ },
35
+ "broom.mixed": {
36
+ "source": "cran",
37
+ "auto_attach": false
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "id": "shiny-python",
3
+ "name": "Shiny app in Python",
4
+ "description": "shiny for the app, shinywidgets and plotly for interactive charts, and pandas for data.",
5
+ "language": [
6
+ "python"
7
+ ],
8
+ "layer": {
9
+ "packages": {
10
+ "default_packages": {
11
+ "shiny": {
12
+ "source": "pypi",
13
+ "auto_attach": false
14
+ },
15
+ "shinywidgets": {
16
+ "source": "pypi",
17
+ "auto_attach": false
18
+ },
19
+ "plotly": {
20
+ "source": "pypi",
21
+ "auto_attach": false
22
+ },
23
+ "pandas": {
24
+ "source": "pypi",
25
+ "auto_attach": false
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }