laco 1.0.0__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.
Files changed (210) hide show
  1. laco-1.0.0/.devcontainer/devcontainer.json +11 -0
  2. laco-1.0.0/.envrc +14 -0
  3. laco-1.0.0/.github/dependabot.yml +6 -0
  4. laco-1.0.0/.github/workflows/qa.yml +92 -0
  5. laco-1.0.0/.github/workflows/release.yml +57 -0
  6. laco-1.0.0/.gitignore +135 -0
  7. laco-1.0.0/.pypirc +10 -0
  8. laco-1.0.0/LICENSE +21 -0
  9. laco-1.0.0/Makefile +44 -0
  10. laco-1.0.0/PKG-INFO +158 -0
  11. laco-1.0.0/README.md +132 -0
  12. laco-1.0.0/docs/api/cli.md +138 -0
  13. laco-1.0.0/docs/api/compat.md +106 -0
  14. laco-1.0.0/docs/api/index.md +36 -0
  15. laco-1.0.0/docs/api/instantiate.md +125 -0
  16. laco-1.0.0/docs/api/io.md +117 -0
  17. laco-1.0.0/docs/api/language.md +315 -0
  18. laco-1.0.0/docs/concepts/app-loop.md +95 -0
  19. laco-1.0.0/docs/concepts/config-as-python.md +80 -0
  20. laco-1.0.0/docs/concepts/index.md +14 -0
  21. laco-1.0.0/docs/concepts/interpolation.md +90 -0
  22. laco-1.0.0/docs/concepts/lazy-construction.md +102 -0
  23. laco-1.0.0/docs/concepts/lie-typing.md +68 -0
  24. laco-1.0.0/docs/concepts/tracing.md +90 -0
  25. laco-1.0.0/docs/concepts/typed-groups.md +98 -0
  26. laco-1.0.0/docs/examples/building-blocks.md +418 -0
  27. laco-1.0.0/docs/examples/foundations.md +461 -0
  28. laco-1.0.0/docs/examples/index.md +124 -0
  29. laco-1.0.0/docs/examples/pipelines.md +371 -0
  30. laco-1.0.0/docs/examples/typed-variants.md +360 -0
  31. laco-1.0.0/docs/getting-started.md +64 -0
  32. laco-1.0.0/docs/how-to/custom-resolvers.md +72 -0
  33. laco-1.0.0/docs/how-to/index.md +12 -0
  34. laco-1.0.0/docs/how-to/laco-app.md +206 -0
  35. laco-1.0.0/docs/how-to/lint-and-strict.md +71 -0
  36. laco-1.0.0/docs/how-to/migrate-from-argparse.md +128 -0
  37. laco-1.0.0/docs/how-to/override-configs.md +64 -0
  38. laco-1.0.0/docs/how-to/reproduce-experiment.md +70 -0
  39. laco-1.0.0/docs/how-to/safe-loading.md +58 -0
  40. laco-1.0.0/docs/index.md +48 -0
  41. laco-1.0.0/docs/laco-vs-hydra-zen.md +36 -0
  42. laco-1.0.0/docs/migration-0.x-to-1.0.md +122 -0
  43. laco-1.0.0/docs/tutorials.md +42 -0
  44. laco-1.0.0/flake.lock +168 -0
  45. laco-1.0.0/flake.nix +227 -0
  46. laco-1.0.0/notebooks/tutorials/00_why_laco.ipynb +747 -0
  47. laco-1.0.0/notebooks/tutorials/01_first_steps.ipynb +648 -0
  48. laco-1.0.0/notebooks/tutorials/02_lazy_call_and_partial.ipynb +653 -0
  49. laco-1.0.0/notebooks/tutorials/03_hyperparameters_and_interpolation.ipynb +816 -0
  50. laco-1.0.0/notebooks/tutorials/04_loading_saving_cli.ipynb +734 -0
  51. laco-1.0.0/notebooks/tutorials/05_nested_configs_and_containers.ipynb +922 -0
  52. laco-1.0.0/notebooks/tutorials/06_typed_groups_and_schemas.ipynb +999 -0
  53. laco-1.0.0/notebooks/tutorials/07_pipeline_configs.ipynb +1010 -0
  54. laco-1.0.0/notebooks/tutorials/08_tasks_and_app_loop.ipynb +730 -0
  55. laco-1.0.0/notebooks/tutorials/09_tracing.ipynb +876 -0
  56. laco-1.0.0/notebooks/tutorials/10_production_patterns.ipynb +972 -0
  57. laco-1.0.0/packages/laco-dvc/README.md +19 -0
  58. laco-1.0.0/packages/laco-dvc/docs/index.md +117 -0
  59. laco-1.0.0/packages/laco-dvc/pyproject.toml +19 -0
  60. laco-1.0.0/packages/laco-dvc/sources/laco/integrations/dvc/__init__.py +28 -0
  61. laco-1.0.0/packages/laco-dvc/sources/laco/integrations/dvc/_core.py +117 -0
  62. laco-1.0.0/packages/laco-dvc/tests/__init__.py +0 -0
  63. laco-1.0.0/packages/laco-dvc/tests/test_laco_dvc.py +91 -0
  64. laco-1.0.0/packages/laco-lightning/README.md +19 -0
  65. laco-1.0.0/packages/laco-lightning/docs/index.md +120 -0
  66. laco-1.0.0/packages/laco-lightning/pyproject.toml +22 -0
  67. laco-1.0.0/packages/laco-lightning/sources/laco/integrations/lightning/__init__.py +34 -0
  68. laco-1.0.0/packages/laco-lightning/sources/laco/integrations/lightning/_core.py +177 -0
  69. laco-1.0.0/packages/laco-lightning/tests/__init__.py +0 -0
  70. laco-1.0.0/packages/laco-lightning/tests/test_laco_lightning.py +96 -0
  71. laco-1.0.0/packages/laco-logging/README.md +28 -0
  72. laco-1.0.0/packages/laco-logging/docs/index.md +132 -0
  73. laco-1.0.0/packages/laco-logging/pyproject.toml +25 -0
  74. laco-1.0.0/packages/laco-logging/sources/laco/integrations/logging/__init__.py +58 -0
  75. laco-1.0.0/packages/laco-logging/sources/laco/integrations/logging/_backends/__init__.py +1 -0
  76. laco-1.0.0/packages/laco-logging/sources/laco/integrations/logging/_backends/mlflow.py +69 -0
  77. laco-1.0.0/packages/laco-logging/sources/laco/integrations/logging/_backends/tensorboard.py +89 -0
  78. laco-1.0.0/packages/laco-logging/sources/laco/integrations/logging/_backends/wandb.py +46 -0
  79. laco-1.0.0/packages/laco-logging/sources/laco/integrations/logging/_core.py +94 -0
  80. laco-1.0.0/packages/laco-logging/sources/laco/integrations/logging/mlflow.py +7 -0
  81. laco-1.0.0/packages/laco-logging/sources/laco/integrations/logging/tensorboard.py +6 -0
  82. laco-1.0.0/packages/laco-logging/sources/laco/integrations/logging/wandb.py +6 -0
  83. laco-1.0.0/packages/laco-logging/tests/__init__.py +0 -0
  84. laco-1.0.0/packages/laco-logging/tests/test_laco_logging.py +50 -0
  85. laco-1.0.0/packages/laco-pydantic/README.md +19 -0
  86. laco-1.0.0/packages/laco-pydantic/docs/index.md +135 -0
  87. laco-1.0.0/packages/laco-pydantic/pyproject.toml +19 -0
  88. laco-1.0.0/packages/laco-pydantic/sources/laco/integrations/pydantic/__init__.py +25 -0
  89. laco-1.0.0/packages/laco-pydantic/sources/laco/integrations/pydantic/_core.py +116 -0
  90. laco-1.0.0/packages/laco-pydantic/tests/__init__.py +0 -0
  91. laco-1.0.0/packages/laco-pydantic/tests/test_laco_pydantic.py +99 -0
  92. laco-1.0.0/packages/laco-pytest/README.md +19 -0
  93. laco-1.0.0/packages/laco-pytest/docs/index.md +87 -0
  94. laco-1.0.0/packages/laco-pytest/pyproject.toml +22 -0
  95. laco-1.0.0/packages/laco-pytest/sources/laco/integrations/pytest/__init__.py +6 -0
  96. laco-1.0.0/packages/laco-pytest/sources/laco/integrations/pytest/plugin.py +131 -0
  97. laco-1.0.0/packages/laco-pytest/tests/__init__.py +0 -0
  98. laco-1.0.0/packages/laco-pytest/tests/test_laco_pytest.py +40 -0
  99. laco-1.0.0/packages/laco-submitit/README.md +19 -0
  100. laco-1.0.0/packages/laco-submitit/docs/index.md +121 -0
  101. laco-1.0.0/packages/laco-submitit/pyproject.toml +19 -0
  102. laco-1.0.0/packages/laco-submitit/sources/laco/integrations/submitit/__init__.py +38 -0
  103. laco-1.0.0/packages/laco-submitit/sources/laco/integrations/submitit/_core.py +104 -0
  104. laco-1.0.0/packages/laco-submitit/tests/__init__.py +0 -0
  105. laco-1.0.0/packages/laco-submitit/tests/test_laco_submitit.py +89 -0
  106. laco-1.0.0/packages/laco-torch/README.md +19 -0
  107. laco-1.0.0/packages/laco-torch/docs/index.md +95 -0
  108. laco-1.0.0/packages/laco-torch/pyproject.toml +22 -0
  109. laco-1.0.0/packages/laco-torch/sources/laco/integrations/torch/__init__.py +33 -0
  110. laco-1.0.0/packages/laco-torch/sources/laco/integrations/torch/_core.py +81 -0
  111. laco-1.0.0/packages/laco-torch/tests/__init__.py +0 -0
  112. laco-1.0.0/packages/laco-torch/tests/test_laco_torch.py +72 -0
  113. laco-1.0.0/packages/laco-typer/README.md +19 -0
  114. laco-1.0.0/packages/laco-typer/docs/index.md +91 -0
  115. laco-1.0.0/packages/laco-typer/pyproject.toml +19 -0
  116. laco-1.0.0/packages/laco-typer/sources/laco/integrations/typer/__init__.py +21 -0
  117. laco-1.0.0/packages/laco-typer/sources/laco/integrations/typer/_core.py +147 -0
  118. laco-1.0.0/packages/laco-typer/tests/__init__.py +0 -0
  119. laco-1.0.0/packages/laco-typer/tests/test_laco_typer.py +77 -0
  120. laco-1.0.0/pyproject.toml +172 -0
  121. laco-1.0.0/setup.cfg +4 -0
  122. laco-1.0.0/sources/hydra_plugins/laco_resolvers/__init__.py +11 -0
  123. laco-1.0.0/sources/laco/__init__.py +40 -0
  124. laco-1.0.0/sources/laco/_app.py +95 -0
  125. laco-1.0.0/sources/laco/_env.py +111 -0
  126. laco-1.0.0/sources/laco/_groups.py +651 -0
  127. laco-1.0.0/sources/laco/_io.py +755 -0
  128. laco-1.0.0/sources/laco/_lazy.py +287 -0
  129. laco-1.0.0/sources/laco/_lint/__init__.py +14 -0
  130. laco-1.0.0/sources/laco/_lint/lie_typing.py +618 -0
  131. laco-1.0.0/sources/laco/_overrides.py +252 -0
  132. laco-1.0.0/sources/laco/_plugins.py +42 -0
  133. laco-1.0.0/sources/laco/_resolvers.py +47 -0
  134. laco-1.0.0/sources/laco/_strict.py +116 -0
  135. laco-1.0.0/sources/laco/cli.py +867 -0
  136. laco-1.0.0/sources/laco/compat.py +54 -0
  137. laco-1.0.0/sources/laco/examples/blocks/decoder.py +70 -0
  138. laco-1.0.0/sources/laco/examples/blocks/residual.py +81 -0
  139. laco-1.0.0/sources/laco/examples/blocks/transformer.py +57 -0
  140. laco-1.0.0/sources/laco/examples/cnn_classifier.py +87 -0
  141. laco-1.0.0/sources/laco/examples/integrations/_lit_classifier.py +36 -0
  142. laco-1.0.0/sources/laco/examples/integrations/lightning_module.py +37 -0
  143. laco-1.0.0/sources/laco/examples/integrations/tensordict_module.py +34 -0
  144. laco-1.0.0/sources/laco/examples/integrations/transformers_qa.py +43 -0
  145. laco-1.0.0/sources/laco/examples/layers/fpn.py +37 -0
  146. laco-1.0.0/sources/laco/examples/layers/gqa_attention.py +91 -0
  147. laco-1.0.0/sources/laco/examples/layers/mean_pool.py +14 -0
  148. laco-1.0.0/sources/laco/examples/layers/panoptic_heads.py +57 -0
  149. laco-1.0.0/sources/laco/examples/layers/patch_embed.py +35 -0
  150. laco-1.0.0/sources/laco/examples/layers/register_tokens.py +21 -0
  151. laco-1.0.0/sources/laco/examples/layers/rms_norm.py +23 -0
  152. laco-1.0.0/sources/laco/examples/layers/rope.py +40 -0
  153. laco-1.0.0/sources/laco/examples/layers/swiglu.py +20 -0
  154. laco-1.0.0/sources/laco/examples/linear_regression.py +39 -0
  155. laco-1.0.0/sources/laco/examples/mlp.py +79 -0
  156. laco-1.0.0/sources/laco/examples/models/_dinov3.py +31 -0
  157. laco-1.0.0/sources/laco/examples/models/_lm.py +39 -0
  158. laco-1.0.0/sources/laco/examples/models/_panoptic_fcn.py +36 -0
  159. laco-1.0.0/sources/laco/examples/models/_resnet.py +39 -0
  160. laco-1.0.0/sources/laco/examples/models/_vit.py +34 -0
  161. laco-1.0.0/sources/laco/examples/models/dinov3.py +55 -0
  162. laco-1.0.0/sources/laco/examples/models/gemma3.py +130 -0
  163. laco-1.0.0/sources/laco/examples/models/panoptic_fcn.py +56 -0
  164. laco-1.0.0/sources/laco/examples/models/qwen3.py +84 -0
  165. laco-1.0.0/sources/laco/examples/models/resnet.py +103 -0
  166. laco-1.0.0/sources/laco/examples/models/vit.py +85 -0
  167. laco-1.0.0/sources/laco/examples/pipelines/clm_finetune.py +87 -0
  168. laco-1.0.0/sources/laco/examples/pipelines/mnist_train.py +117 -0
  169. laco-1.0.0/sources/laco/examples/text_classifier.py +50 -0
  170. laco-1.0.0/sources/laco/examples/typed/__init__.py +6 -0
  171. laco-1.0.0/sources/laco/examples/typed/linear_regression.py +57 -0
  172. laco-1.0.0/sources/laco/examples/typed/mlp.py +84 -0
  173. laco-1.0.0/sources/laco/examples/typed/text_classifier.py +54 -0
  174. laco-1.0.0/sources/laco/handler.py +6 -0
  175. laco-1.0.0/sources/laco/keys.py +32 -0
  176. laco-1.0.0/sources/laco/language.py +1627 -0
  177. laco-1.0.0/sources/laco/ops.py +13 -0
  178. laco-1.0.0/sources/laco/py.typed +0 -0
  179. laco-1.0.0/sources/laco/utils.py +219 -0
  180. laco-1.0.0/sources/laco.egg-info/PKG-INFO +158 -0
  181. laco-1.0.0/sources/laco.egg-info/SOURCES.txt +208 -0
  182. laco-1.0.0/sources/laco.egg-info/dependency_links.txt +1 -0
  183. laco-1.0.0/sources/laco.egg-info/entry_points.txt +9 -0
  184. laco-1.0.0/sources/laco.egg-info/requires.txt +9 -0
  185. laco-1.0.0/sources/laco.egg-info/top_level.txt +2 -0
  186. laco-1.0.0/tests/test_cli_app.py +529 -0
  187. laco-1.0.0/tests/test_cli_diff.py +80 -0
  188. laco-1.0.0/tests/test_cli_run.py +326 -0
  189. laco-1.0.0/tests/test_env.py +145 -0
  190. laco-1.0.0/tests/test_examples.py +564 -0
  191. laco-1.0.0/tests/test_groups.py +251 -0
  192. laco-1.0.0/tests/test_groups_dsl.py +345 -0
  193. laco-1.0.0/tests/test_handler.py +23 -0
  194. laco-1.0.0/tests/test_instantiate_bench.py +43 -0
  195. laco-1.0.0/tests/test_io.py +336 -0
  196. laco-1.0.0/tests/test_language.py +530 -0
  197. laco-1.0.0/tests/test_language_defaults.py +100 -0
  198. laco-1.0.0/tests/test_language_params.py +256 -0
  199. laco-1.0.0/tests/test_language_typing.py +766 -0
  200. laco-1.0.0/tests/test_lazy_cycle.py +260 -0
  201. laco-1.0.0/tests/test_lint_lie_typing.py +898 -0
  202. laco-1.0.0/tests/test_overrides.py +349 -0
  203. laco-1.0.0/tests/test_property.py +105 -0
  204. laco-1.0.0/tests/test_strict.py +108 -0
  205. laco-1.0.0/tests/test_task.py +171 -0
  206. laco-1.0.0/tests/test_trace.py +266 -0
  207. laco-1.0.0/tests/test_utils.py +6 -0
  208. laco-1.0.0/tests/test_version.py +13 -0
  209. laco-1.0.0/tests/test_wire_format.py +201 -0
  210. laco-1.0.0/uv.lock +2649 -0
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "Python 3 with UV",
3
+ "image": "mcr.microsoft.com/devcontainers/python:1-3.13",
4
+ "features": {
5
+ "ghcr.io/khwstolle/devcontainer-features/ruff:1": {},
6
+ "ghcr.io/khwstolle/devcontainer-features/uv:1": {}
7
+ },
8
+ "forwardPorts": [],
9
+ "postCreateCommand": "uv sync",
10
+ "customizations": {}
11
+ }
laco-1.0.0/.envrc ADDED
@@ -0,0 +1,14 @@
1
+ if has nix; then
2
+ use flake
3
+ fi
4
+
5
+ if has uv; then
6
+ uv sync --all-groups --frozen
7
+
8
+ export VIRTUAL_ENV="$PWD/.venv"
9
+ PATH_add "$VIRTUAL_ENV/bin"
10
+ else
11
+ log_error "uv not found; skipping virtual environment setup"
12
+ fi
13
+
14
+ dotenv_if_exists
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "pip"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
@@ -0,0 +1,92 @@
1
+ name: QA
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - master
7
+ # No push trigger: the PR already gates merges into master, so re-running
8
+ # QA on the merge commit just doubles the Actions spend.
9
+ workflow_dispatch:
10
+
11
+ # Cancel superseded in-progress runs on the same PR branch.
12
+ concurrency:
13
+ group: ${{ github.workflow }}-${{ github.ref }}
14
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
15
+
16
+ jobs:
17
+ setup:
18
+ name: Setup Environment
19
+ runs-on: ubuntu-latest
20
+ outputs:
21
+ cache-key: ${{ steps.cache-key.outputs.value }}
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Generate Cache Key
26
+ id: cache-key
27
+ run: echo "value=$(sha256sum uv.lock | cut -d ' ' -f1)" >> "$GITHUB_OUTPUT"
28
+
29
+ - name: UV Setup
30
+ uses: astral-sh/setup-uv@v5
31
+ with:
32
+ enable-cache: true
33
+ cache-dependency-glob: "uv.lock"
34
+
35
+ - name: Python Setup
36
+ uses: actions/setup-python@v5
37
+ with:
38
+ python-version: "3.13"
39
+
40
+ - name: Sync Dependencies
41
+ run: uv sync --all-extras --all-groups
42
+
43
+ lint:
44
+ name: Linting
45
+ runs-on: ubuntu-latest
46
+ needs: setup
47
+ steps:
48
+ - uses: actions/checkout@v4
49
+
50
+ - name: UV Setup
51
+ uses: astral-sh/setup-uv@v5
52
+ with:
53
+ enable-cache: true
54
+ cache-dependency-glob: "uv.lock"
55
+
56
+ - name: Python Setup
57
+ uses: actions/setup-python@v5
58
+ with:
59
+ python-version: "3.13"
60
+
61
+ - name: Restore Dependencies from Cache
62
+ run: uv sync --all-extras --all-groups
63
+
64
+ - name: Run Ruff
65
+ run: uv run ruff check --output-format=github .
66
+
67
+ - name: Run laco-lint
68
+ run: uv run laco-lint sources/
69
+
70
+ test:
71
+ name: Testing
72
+ runs-on: ubuntu-latest
73
+ needs: setup
74
+ steps:
75
+ - uses: actions/checkout@v4
76
+
77
+ - name: UV Setup
78
+ uses: astral-sh/setup-uv@v5
79
+ with:
80
+ enable-cache: true
81
+ cache-dependency-glob: "uv.lock"
82
+
83
+ - name: Python Setup
84
+ uses: actions/setup-python@v5
85
+ with:
86
+ python-version: "3.13"
87
+
88
+ - name: Restore Dependencies from Cache
89
+ run: uv sync --all-extras --all-groups
90
+
91
+ - name: Run Tests
92
+ run: uv run pytest tests
@@ -0,0 +1,57 @@
1
+ name: Upload Python Package
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ release-build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v4
16
+
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version-file: "pyproject.toml"
21
+
22
+ - name: Build release distributions
23
+ run: |
24
+ python -m pip install build
25
+ python -m build --wheel
26
+
27
+ - name: Upload distributions
28
+ uses: actions/upload-artifact@v4
29
+ with:
30
+ name: release-dists
31
+ path: dist/
32
+
33
+ pypi-publish:
34
+ runs-on: ubuntu-latest
35
+ needs:
36
+ - release-build
37
+ permissions:
38
+ # IMPORTANT: this permission is mandatory for trusted publishing
39
+ id-token: write
40
+
41
+ # Dedicated environments with protections for publishing are strongly recommended.
42
+ # For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
43
+ environment:
44
+ name: pypi
45
+ url: https://pypi.org/project/laco/${{ github.event.release.name }}
46
+
47
+ steps:
48
+ - name: Retrieve release distributions
49
+ uses: actions/download-artifact@v4
50
+ with:
51
+ name: release-dists
52
+ path: dist/
53
+
54
+ - name: Publish release distributions to PyPI
55
+ uses: pypa/gh-action-pypi-publish@release/v1
56
+ with:
57
+ packages-dir: dist/
laco-1.0.0/.gitignore ADDED
@@ -0,0 +1,135 @@
1
+ # WandB
2
+ wandb
3
+
4
+ # Benchmarking
5
+ .benchmarks
6
+
7
+ # SLURM
8
+ slurm-*
9
+
10
+ # Logs
11
+ log.txt
12
+
13
+ # Ruff
14
+ .ruff_cache
15
+
16
+ # VSCode
17
+ .vscode
18
+
19
+ # Symlinked defaults
20
+ ./scratch/
21
+ ./output/
22
+ ./outputs/
23
+ ./datasets/
24
+ ./data/
25
+ ./log/
26
+ ./logs/
27
+ ./cache/
28
+
29
+ # Documentation
30
+ docs/build/
31
+ docs/source/_generated/
32
+
33
+ # Byte-compiled / optimized / DLL files
34
+ __pycache__/
35
+ *.py[cod]
36
+ *$py.class
37
+
38
+ # C extensions
39
+ *.so
40
+
41
+ # Distribution / packaging
42
+ .Python
43
+ build/
44
+ develop-eggs/
45
+ dist/
46
+ downloads/
47
+ eggs/
48
+ .eggs/
49
+ lib/
50
+ lib64/
51
+ parts/
52
+ sdist/
53
+ var/
54
+ wheels/
55
+ pip-wheel-metadata/
56
+ share/python-wheels/
57
+ *.egg-info/
58
+ .installed.cfg
59
+ *.egg
60
+ MANIFEST
61
+
62
+ # PyInstaller
63
+ # Usually these files are written by a python script from a template
64
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
65
+ *.manifest
66
+ *.spec
67
+
68
+ # Installer logs
69
+ pip-log.txt
70
+ pip-delete-this-directory.txt
71
+
72
+ # Unit test / coverage reports
73
+ htmlcov/
74
+ .tox/
75
+ .nox/
76
+ .coverage
77
+ .coverage.*
78
+ .cache
79
+ nosetests.xml
80
+ tests.xml
81
+ coverage.xml
82
+ *.cover
83
+ *.py,cover
84
+ .hypothesis/
85
+ .pytest_cache/
86
+
87
+ # Translations
88
+ *.mo
89
+ *.pot
90
+
91
+ # Django stuff:
92
+ *.log
93
+ local_settings.py
94
+ db.sqlite3
95
+ db.sqlite3-journal
96
+
97
+ # Flask stuff:
98
+ instance/
99
+ .webassets-cache
100
+
101
+ # Scrapy stuff:
102
+ .scrapy
103
+
104
+ # PyBuilder
105
+ target/
106
+
107
+ # Jupyter Notebook
108
+ .ipynb_checkpoints
109
+
110
+ # IPython
111
+ profile_default/
112
+ ipython_config.py
113
+
114
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
115
+ __pypackages__/
116
+
117
+ # Environments
118
+ .venv
119
+ venv/
120
+
121
+ # Nix / direnv
122
+ .direnv/
123
+ result
124
+ result-*
125
+
126
+ # mypy
127
+ .mypy_cache/
128
+ .dmypy.json
129
+ dmypy.json
130
+
131
+ # Pyre type checker
132
+ .pyre/
133
+ output
134
+ cache
135
+ ./tmp/
laco-1.0.0/.pypirc ADDED
@@ -0,0 +1,10 @@
1
+ [distutils]
2
+ index-servers =
3
+ pypi
4
+ testpypi
5
+
6
+ [pypi]
7
+ repository = https://upload.pypi.org/legacy/
8
+
9
+ [testpypi]
10
+ repository = https://test.pypi.org/legacy/
laco-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Kurt Stolle
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
laco-1.0.0/Makefile ADDED
@@ -0,0 +1,44 @@
1
+
2
+ help:
3
+ @echo "install - install the package"
4
+ @echo "check - run linters and formatters"
5
+ @echo "test - run tests"
6
+ @echo "benchmark - run benchmarks"
7
+ @echo "coverage - run coverage"
8
+ @echo "build - build the package"
9
+ @echo "dist - build and upload the package"
10
+ @echo "clean - clean the project"
11
+
12
+ clean:
13
+ rm -rf build dist *.egg-info .pytest_cache .tox .coverage .hypothesis .mypy_cache .mypy .ruff .ruff_cache .pytest_cache .pytest .benchmarks .benchmarks_cache wheelhouse
14
+ find . '(' \
15
+ -name ".mypy_cache" -o -name "__pycache__" -o -name "*.egg-info" \
16
+ -o -name ".pytest_cache" -o -name ".tox" -o -name ".coverage" \
17
+ -o -name ".hypothesis" -o -name ".mypy" -o -name ".ruff" \
18
+ -o -name ".ruff_cache" -o -name ".pytest" -o -name ".benchmarks" \
19
+ -o -name ".benchmarks_cache" -o -name "wheelhouse" \
20
+ ')' -type d -exec rm -rf {} +
21
+ find . -type f -name "*.pyc" -delete
22
+
23
+ install:
24
+ uv pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation ./
25
+
26
+ check:
27
+ uv run ruff check --fix .
28
+
29
+ test:
30
+ uv run pytest -s -v -n auto --dist=loadfile --junitxml=tests.xml --no-cov --benchmark-disable
31
+
32
+ benchmark:
33
+ uv run pytest -s -v -n 0 --no-cov benchmarks
34
+
35
+ coverage:
36
+ uv run pytest --cov=sources --cov-report=html --cov-report=xml --benchmark-disable
37
+
38
+ build:
39
+ uv build --all-packages
40
+
41
+ dist: build
42
+ uv publish
43
+
44
+ .PHONY: help install check test benchmark coverage dist build clean compile
laco-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,158 @@
1
+ Metadata-Version: 2.4
2
+ Name: laco
3
+ Version: 1.0.0
4
+ Summary: Lazy configurations for reproducible deep learning experiments.
5
+ Author-email: Kurt Stolle <kurt@khws.io>
6
+ Keywords: perception,computer vision,deep learning,object detection,instance segmentation,semantic segmentation
7
+ Classifier: Development Status :: 5 - Production/Stable
8
+ Classifier: Programming Language :: Python
9
+ Classifier: Programming Language :: Python :: 3.13
10
+ Classifier: Programming Language :: Python :: Implementation :: CPython
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
+ Requires-Python: >=3.13
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: omegaconf
18
+ Requires-Dist: setuptools
19
+ Requires-Dist: regex
20
+ Requires-Dist: hydra-core
21
+ Requires-Dist: expath>=0.0.5
22
+ Requires-Dist: docstring-parser
23
+ Provides-Extra: wandb
24
+ Requires-Dist: wandb>=0.19.6; extra == "wandb"
25
+ Dynamic: license-file
26
+
27
+ # Laco — Lazy Configuration for Reproducible ML
28
+
29
+ **LAzy COnfiguration** (Laco) is a Python-first configuration system that
30
+ gives you type-checked, IDE-navigable configs with zero magic strings.
31
+ It is compatible with [Hydra](https://hydra.cc/) and a drop-in
32
+ alternative to [hydra-zen](https://mit-ll-responsible-ai.github.io/hydra-zen/).
33
+
34
+ ## Key ideas
35
+
36
+ | Construct | Static type | What you get |
37
+ |-----------|-------------|--------------|
38
+ | `L.call(T)(**kw)` | `T` | lazy `_target_:` node |
39
+ | `L.partial(T)(**kw)` | `functools.partial[T]` | lazy `_partial_: true` node |
40
+ | `L.just(obj)` | `type(obj)` | identity-instantiated node |
41
+ | `L.required[T]()` | `T` | `MISSING` sentinel |
42
+ | `class G(L.Group[T])` | typed group | registers in Hydra ConfigStore |
43
+ | `@L.config class S` | dataclass schema | structured-config target |
44
+ | `@L.task` | task wrapper | auto-instantiates config fields |
45
+ | `@laco.main(config_name=…)` | Hydra app | composes config + runs task |
46
+ | `L.trace(lambda: …)` | `R` | records a config tree from Python |
47
+
48
+ ## 30-second example
49
+
50
+ ```python
51
+ import laco
52
+ import laco.language as L
53
+ from torch import nn, optim
54
+
55
+ # --- Groups: swappable variants ---
56
+ class OptimGroup(L.Group[optim.Optimizer]):
57
+ sgd = L.partial(optim.SGD)(lr=L.required[float](), momentum=0.9)
58
+ adam = L.partial(optim.Adam)(lr=1e-3)
59
+
60
+ # --- Schema: typed config ---
61
+ @L.config
62
+ class TrainSchema:
63
+ epochs: int = 10
64
+ optimizer: optim.Optimizer = L.slot(OptimGroup)
65
+
66
+ # --- Model ---
67
+ model_cfg = L.call(nn.Linear)(in_features=784, out_features=10)
68
+
69
+ # --- Task: runs with a composed config ---
70
+ @laco.main(config_name="train")
71
+ @L.task
72
+ def run(model: nn.Module, optimizer: optim.Optimizer, epochs: int = 10):
73
+ opt = optimizer(model.parameters())
74
+ # ... training loop ...
75
+
76
+ if __name__ == "__main__":
77
+ run()
78
+ ```
79
+
80
+ Override from the CLI:
81
+ ```
82
+ python train.py optimizer=adam epochs=20
83
+ python train.py -m optimizer=sgd,adam optimizer.lr=1e-2,1e-3 # multirun
84
+ ```
85
+
86
+ ## Tracing
87
+
88
+ ```python
89
+ @L.configurable
90
+ class Encoder:
91
+ def __init__(self, depth: int) -> None: ...
92
+
93
+ # Records a config tree — no constructors run:
94
+ cfg = L.trace(lambda: Encoder(depth=24))
95
+ # Reproduce the object:
96
+ enc = laco.instantiate(cfg)
97
+ ```
98
+
99
+ ## Examples
100
+
101
+ The `sources/laco/examples/` directory contains a curriculum of examples:
102
+
103
+ | Tier | Files | What it demonstrates |
104
+ |------|-------|----------------------|
105
+ | 0–1 | `mlp.py`, `linear_regression.py`, `cnn_classifier.py`, `text_classifier.py` | Basics: `L.call`, `L.params`, `L.required` |
106
+ | 2 | `blocks/residual.py`, `blocks/transformer.py`, `blocks/decoder.py` | Building blocks |
107
+ | 3–4 | `models/` | Vision & language model configs |
108
+ | 5 | `integrations/` | Lightning, Transformers, TensorDict |
109
+ | 6 | `pipelines/mnist_train.py`, `pipelines/clm_finetune.py` | End-to-end training pipelines with `@L.task` |
110
+
111
+ Typed-group variants live in `examples/typed/` (same models, `@L.config` + `L.Group` API).
112
+
113
+ ## CLI
114
+
115
+ ```
116
+ laco compose configs/train.py # load & dump YAML
117
+ laco compose configs/train.py lr=1e-3 # with overrides
118
+ laco show configs/train.py --groups # list registered groups
119
+ laco run configs/train.py # run the @L.task entry point
120
+ laco diff configs/a.py configs/b.py # diff two config files
121
+ laco app my-project train --lr 1e-4 # run a laco.apps entry point
122
+ ```
123
+
124
+ ### `laco app` — simple argparse CLI for published configs
125
+
126
+ Researchers and collaborators can reproduce experiments without knowing Hydra:
127
+
128
+ ```bash
129
+ laco app my-project train --help # show all available flags
130
+ laco app my-project train --lr 1e-4 # override a hyperparameter
131
+ laco app my-project train --dry-run # preview resolved config as YAML
132
+ laco app my-project train --save-dir out/ # save config.yaml before running
133
+ ```
134
+
135
+ Flags are derived from `@L.params` blocks and `L.param()` declarations in
136
+ the config file. Authors register the entry point in `pyproject.toml`:
137
+
138
+ ```toml
139
+ [project.entry-points."laco.apps"]
140
+ train = "my_project.train:run"
141
+ ```
142
+
143
+ See `docs/how-to/laco-app.md` for the full author and user guide.
144
+
145
+ ## Migration from 0.x
146
+
147
+ Add `import laco.compat` once at startup to enable deprecation warnings
148
+ for legacy `_target_: laco.ops.partial` configs. Run `laco fix <dir>` to
149
+ rewrite them in-place.
150
+
151
+ ## Linting
152
+
153
+ Two lint passes run in CI and are available locally:
154
+
155
+ - `nix run .#lint` — ruff over `sources/` and `tests/`.
156
+ - `nix run .#lie-lint` (or `laco-lint sources/`) — LACO001, a heuristic
157
+ AST check for attribute access on lie-typed Laco nodes. Suppress with
158
+ `# noqa: LACO001`.
laco-1.0.0/README.md ADDED
@@ -0,0 +1,132 @@
1
+ # Laco — Lazy Configuration for Reproducible ML
2
+
3
+ **LAzy COnfiguration** (Laco) is a Python-first configuration system that
4
+ gives you type-checked, IDE-navigable configs with zero magic strings.
5
+ It is compatible with [Hydra](https://hydra.cc/) and a drop-in
6
+ alternative to [hydra-zen](https://mit-ll-responsible-ai.github.io/hydra-zen/).
7
+
8
+ ## Key ideas
9
+
10
+ | Construct | Static type | What you get |
11
+ |-----------|-------------|--------------|
12
+ | `L.call(T)(**kw)` | `T` | lazy `_target_:` node |
13
+ | `L.partial(T)(**kw)` | `functools.partial[T]` | lazy `_partial_: true` node |
14
+ | `L.just(obj)` | `type(obj)` | identity-instantiated node |
15
+ | `L.required[T]()` | `T` | `MISSING` sentinel |
16
+ | `class G(L.Group[T])` | typed group | registers in Hydra ConfigStore |
17
+ | `@L.config class S` | dataclass schema | structured-config target |
18
+ | `@L.task` | task wrapper | auto-instantiates config fields |
19
+ | `@laco.main(config_name=…)` | Hydra app | composes config + runs task |
20
+ | `L.trace(lambda: …)` | `R` | records a config tree from Python |
21
+
22
+ ## 30-second example
23
+
24
+ ```python
25
+ import laco
26
+ import laco.language as L
27
+ from torch import nn, optim
28
+
29
+ # --- Groups: swappable variants ---
30
+ class OptimGroup(L.Group[optim.Optimizer]):
31
+ sgd = L.partial(optim.SGD)(lr=L.required[float](), momentum=0.9)
32
+ adam = L.partial(optim.Adam)(lr=1e-3)
33
+
34
+ # --- Schema: typed config ---
35
+ @L.config
36
+ class TrainSchema:
37
+ epochs: int = 10
38
+ optimizer: optim.Optimizer = L.slot(OptimGroup)
39
+
40
+ # --- Model ---
41
+ model_cfg = L.call(nn.Linear)(in_features=784, out_features=10)
42
+
43
+ # --- Task: runs with a composed config ---
44
+ @laco.main(config_name="train")
45
+ @L.task
46
+ def run(model: nn.Module, optimizer: optim.Optimizer, epochs: int = 10):
47
+ opt = optimizer(model.parameters())
48
+ # ... training loop ...
49
+
50
+ if __name__ == "__main__":
51
+ run()
52
+ ```
53
+
54
+ Override from the CLI:
55
+ ```
56
+ python train.py optimizer=adam epochs=20
57
+ python train.py -m optimizer=sgd,adam optimizer.lr=1e-2,1e-3 # multirun
58
+ ```
59
+
60
+ ## Tracing
61
+
62
+ ```python
63
+ @L.configurable
64
+ class Encoder:
65
+ def __init__(self, depth: int) -> None: ...
66
+
67
+ # Records a config tree — no constructors run:
68
+ cfg = L.trace(lambda: Encoder(depth=24))
69
+ # Reproduce the object:
70
+ enc = laco.instantiate(cfg)
71
+ ```
72
+
73
+ ## Examples
74
+
75
+ The `sources/laco/examples/` directory contains a curriculum of examples:
76
+
77
+ | Tier | Files | What it demonstrates |
78
+ |------|-------|----------------------|
79
+ | 0–1 | `mlp.py`, `linear_regression.py`, `cnn_classifier.py`, `text_classifier.py` | Basics: `L.call`, `L.params`, `L.required` |
80
+ | 2 | `blocks/residual.py`, `blocks/transformer.py`, `blocks/decoder.py` | Building blocks |
81
+ | 3–4 | `models/` | Vision & language model configs |
82
+ | 5 | `integrations/` | Lightning, Transformers, TensorDict |
83
+ | 6 | `pipelines/mnist_train.py`, `pipelines/clm_finetune.py` | End-to-end training pipelines with `@L.task` |
84
+
85
+ Typed-group variants live in `examples/typed/` (same models, `@L.config` + `L.Group` API).
86
+
87
+ ## CLI
88
+
89
+ ```
90
+ laco compose configs/train.py # load & dump YAML
91
+ laco compose configs/train.py lr=1e-3 # with overrides
92
+ laco show configs/train.py --groups # list registered groups
93
+ laco run configs/train.py # run the @L.task entry point
94
+ laco diff configs/a.py configs/b.py # diff two config files
95
+ laco app my-project train --lr 1e-4 # run a laco.apps entry point
96
+ ```
97
+
98
+ ### `laco app` — simple argparse CLI for published configs
99
+
100
+ Researchers and collaborators can reproduce experiments without knowing Hydra:
101
+
102
+ ```bash
103
+ laco app my-project train --help # show all available flags
104
+ laco app my-project train --lr 1e-4 # override a hyperparameter
105
+ laco app my-project train --dry-run # preview resolved config as YAML
106
+ laco app my-project train --save-dir out/ # save config.yaml before running
107
+ ```
108
+
109
+ Flags are derived from `@L.params` blocks and `L.param()` declarations in
110
+ the config file. Authors register the entry point in `pyproject.toml`:
111
+
112
+ ```toml
113
+ [project.entry-points."laco.apps"]
114
+ train = "my_project.train:run"
115
+ ```
116
+
117
+ See `docs/how-to/laco-app.md` for the full author and user guide.
118
+
119
+ ## Migration from 0.x
120
+
121
+ Add `import laco.compat` once at startup to enable deprecation warnings
122
+ for legacy `_target_: laco.ops.partial` configs. Run `laco fix <dir>` to
123
+ rewrite them in-place.
124
+
125
+ ## Linting
126
+
127
+ Two lint passes run in CI and are available locally:
128
+
129
+ - `nix run .#lint` — ruff over `sources/` and `tests/`.
130
+ - `nix run .#lie-lint` (or `laco-lint sources/`) — LACO001, a heuristic
131
+ AST check for attribute access on lie-typed Laco nodes. Suppress with
132
+ `# noqa: LACO001`.