@introspection-ai/recipes 0.60.0 → 0.61.0

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.
@@ -717,17 +717,21 @@ Those host concerns MUST NOT become mandatory Recipe source fields.
717
717
 
718
718
  ## Runtime requirements
719
719
 
720
- A Recipe MAY declare portable runtime requirements under `pi.runtime`. These
721
- requirements are fail-closed: a host MUST satisfy every declaration before the
722
- first model call or reject the Recipe with an actionable diagnostic.
720
+ A Recipe MAY bring Python. Its requirements are fail-closed: a host MUST
721
+ satisfy them before the first model call or reject the Recipe with an
722
+ actionable diagnostic.
723
+
724
+ **A `pyproject.toml` and `uv.lock` at the Recipe root are the Recipe's Python
725
+ project.** They list only the Recipe's own libraries. A Recipe without them
726
+ has no project of its own. A root `pyproject.toml` without a `uv.lock` is an
727
+ error: run `uv lock` and commit the lock. `pi.runtime.python` is optional and
728
+ holds overrides for that project only:
723
729
 
724
730
  ```json
725
731
  {
726
732
  "pi": {
727
733
  "runtime": {
728
734
  "python": {
729
- "project": "python",
730
- "lockfile": "python/uv.lock",
731
735
  "version": ">=3.12,<3.15",
732
736
  "imports": ["pandas", "openpyxl"]
733
737
  }
@@ -736,48 +740,68 @@ first model call or reject the Recipe with an actionable diagnostic.
736
740
  }
737
741
  ```
738
742
 
739
- `python.project` names a Recipe-relative Python project directory and
740
- `python.lockfile` names its committed `uv.lock`, which must be the
741
- `uv.lock` beside the project's `pyproject.toml`. Hosts MUST install with
742
- frozen resolution (`uv sync --frozen --no-dev`) and MUST NOT install into
743
- system Python or resolve an unlocked dependency graph. `version` is passed to
744
- uv as the interpreter request. `imports` are optional boot preflights, each a
745
- dotted Python module name (`docx`, `paper_docx.api`); hosts import them with
746
- `PYTHONHOME` removed.
743
+ Declaring it without a root `pyproject.toml` is an error
744
+ (`runtime.python_project_missing`); a Recipe that uses only first-party
745
+ packages' Python declares none. `version` is passed to uv as the interpreter
746
+ request. `imports` are optional
747
+ boot preflights, each a dotted Python module name (`docx`, `paper_docx.api`);
748
+ hosts import them with `PYTHONHOME` removed. Hosts MUST install with frozen
749
+ resolution and MUST NOT install into system Python or resolve an unlocked
750
+ dependency graph. `pi.runtime.python.project` (a subdirectory holding the
751
+ project) and `pi.runtime.python.lockfile` are legacy: still read, with
752
+ `recipes check` warning `runtime.python_project_legacy`; the lockfile is
753
+ always the project's `uv.lock`.
747
754
 
748
755
  `pi.runtime.python` is the only runtime key; any other key under `pi.runtime`
749
756
  is rejected. PDF and Word work goes through the `documents` tool (`pi.documents`
750
757
  with the `pdf` or `docx` format), not shell utilities. A Recipe that only uses
751
- the `documents` tool needs no `pi.runtime.python`; the format packages bring
752
- their own.
758
+ the `documents` tool needs no `pi.runtime.python` and no Python project; the
759
+ host prepares the shared environment for the Word and PDF formats (below).
753
760
 
754
761
  ### Package declarations
755
762
 
756
763
  A package the Recipe depends on MAY declare `pi.runtime.python` in its own
757
- `package.json`, with the same fields relative to the package. Hosts read it
758
- from each direct `dependencies` or `peerDependencies` entry, found with Node's
759
- package resolution from the Recipe directory (the Recipe's own `node_modules`,
760
- or one above it when an npm install hoists the dependency beside the Recipe);
761
- `devDependencies` and transitive dependencies are
764
+ `package.json`, with `project` naming its Python project directory (relative
765
+ to the package; `lockfile`, if given, is that project's `uv.lock`). Hosts read
766
+ it from each direct `dependencies` or `peerDependencies` entry, found with
767
+ Node's package resolution from the Recipe directory (the Recipe's own
768
+ `node_modules`, or one above it when the platform provides a peer or an npm
769
+ install hoists a dependency); `devDependencies` and transitive dependencies are
762
770
  not read, and a declared dependency that is not installed is skipped. A
763
771
  package declaring it MUST ship the project's `pyproject.toml` and `uv.lock`:
764
772
  when its `package.json` lists `files`, both must be covered.
765
773
 
766
- Each declaration gets its own environment:
774
+ Each environment is separate:
767
775
 
768
- - **The Recipe's own declaration is the shell environment.** Hosts activate
769
- it for the agent's shell tools: `VIRTUAL_ENV` and `UV_PROJECT_ENVIRONMENT`
776
+ - **The Recipe's own project is the shell environment.** Hosts activate it
777
+ for the agent's shell tools: `VIRTUAL_ENV` and `UV_PROJECT_ENVIRONMENT`
770
778
  name it, its `bin` (`Scripts` on Windows) comes first on `PATH`, and
771
- `PYTHONHOME` is removed.
772
- - **Each package's declaration gets a separate environment**, installed with
773
- `--no-editable` and never activated or put on `PATH`. The host hands the
774
- package its interpreter; a documents format receives it as
775
- `createAdapter({ env, cwd, python })`.
779
+ `PYTHONHOME` is removed. It holds only what the Recipe's `pyproject.toml`
780
+ lists: a script that imports `docx` lists `paper-docx` there.
781
+ - **First-party packages share one environment**, Recipes' own
782
+ `python/shared` project, locked once in Recipes (today paper-docx for the
783
+ Word format, pypdfium2 and pillow for PDF). Hosts prepare it when the Recipe
784
+ uses a package it serves, through `pi.documents`, `pi.channels` or by
785
+ listing the package in `dependencies` or `peerDependencies` (installed or
786
+ not), and pass its interpreter to each of them (a documents format receives
787
+ it as `createAdapter({ env, cwd, python })`). **A Recipe with no Python of
788
+ its own gets it as its shell environment**, so a script the agent runs with
789
+ `python3` can `import docx` with no Python files in the Recipe.
790
+ - **For package authors:** a first-party `@introspection-ai/*` package that
791
+ needs Python adds its libraries to Recipes' `python/shared` project, joins
792
+ the one list of packages Recipes serves from it (`SHARED_PYTHON_PACKAGES`),
793
+ and declares no `pi.runtime.python`; a `pi.runtime.python` such a package
794
+ declared in an older release is not read. A third-party package declares
795
+ its own `pi.runtime.python` and gets its own environment.
796
+ - **Every other package's declaration gets a separate environment**,
797
+ installed with `--no-editable` from the package's own lock and never
798
+ activated or put on `PATH`. The host hands the package its interpreter.
776
799
 
777
800
  A package extension asks for a package's interpreter with
778
- `packagePython(name)` on its session context, by the package's name; it is
779
- `undefined` when that package declares no `pi.runtime.python` or is not a
780
- direct dependency. `@introspection-ai/recipes/python` runs a script with it:
801
+ `packagePython(name)` on its session context, by the package's name (a
802
+ shared-environment package's is the shared environment's); it is `undefined` when
803
+ that package declares no `pi.runtime.python` or is not a direct dependency.
804
+ `@introspection-ai/recipes/python` runs a script with it:
781
805
  `pythonExecutable({ python, env, override })` picks the interpreter
782
806
  (`env[override]`, then `python`, then `VIRTUAL_ENV`, then `python3`), and
783
807
  `runPythonJson(script, request, { python, env, cwd, signal, timeoutMs })`
@@ -801,9 +825,6 @@ export default function tables(pi) {
801
825
  }
802
826
  ```
803
827
 
804
- No declaration has to agree with another: two packages may lock different
805
- versions of the same library.
806
-
807
828
  ### Preparing environments
808
829
 
809
830
  `prepareRecipePython(recipeDir, options)` from
@@ -820,21 +841,26 @@ versions of the same library.
820
841
  - uv runs with `--no-python-downloads` unless `allowPythonDownloads` is set.
821
842
 
822
843
  By default environments live in a shared cache,
823
- `~/.introspection/python/<hash>`, keyed by the environment kind (shell or
824
- package), platform and architecture, the `uv.lock` and `pyproject.toml`
825
- contents, and the declared `version`. Without a declared `version` it also
826
- keys on what uv would pick the interpreter from: `UV_PYTHON`, every
827
- `.python-version` or `.python-versions` file from the project directory up to
828
- the filesystem root, and uv's global pin. A Recipe project that is itself a
829
- package (it has `[build-system]`, so it installs editable) also keys on its
830
- directory. `environmentRoot` (or `PI_RECIPES_PYTHON_ROOT`) fixes the
831
- location instead: the shell environment is `<root>/python` and each package's
832
- `<root>/python-packages/<name>`, so a host baking environments into a Recipe
833
- image passes `<recipe>/.pi`. Concurrent preparations of one environment are
834
- serialised by a lock file beside it.
844
+ `~/.introspection/python/<hash>`, keyed by the environment kind (the Recipe's,
845
+ shared or package), platform and architecture, the `uv.lock` and
846
+ `pyproject.toml` contents, and the declared `version`. Without a declared
847
+ `version` it also keys on what uv would pick the interpreter from:
848
+ `UV_PYTHON`, every `.python-version` or `.python-versions` file from the
849
+ project directory up to the filesystem root, and uv's global pin. The
850
+ shared and package environments also key on the package's directory and
851
+ version; a Recipe project that is itself a package (it has `[build-system]`,
852
+ so it installs editable) keys on its directory. `environmentRoot` (or
853
+ `PI_RECIPES_PYTHON_ROOT`) fixes the location instead: the Recipe's
854
+ environment is `<root>/python`, the shared environment
855
+ `<root>/python-shared` and each package's `<root>/python-packages/<name>`,
856
+ so a host baking environments into a Recipe image passes `<recipe>/.pi`.
857
+ Concurrent preparations of one environment are serialised by a lock file
858
+ beside it. uv never creates a `.venv` in the Recipe: the host names the
859
+ environment.
835
860
 
836
861
  Each prepared environment reports its directory and interpreter, plus the
837
- activation for the shell environment. Failures are named errors:
862
+ activation for the shell environment (`kind: "shared"` when it is the
863
+ shared environment). Failures are named errors:
838
864
  `RecipePythonUvMissingError` (uv not installed), `RecipePythonVersionError`
839
865
  (no interpreter satisfies the version), `RecipePythonOutdatedError` (check
840
866
  mode found an environment missing or not matching its lock) and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@introspection-ai/recipes",
3
- "version": "0.60.0",
3
+ "version": "0.61.0",
4
4
  "description": "The open format for vertical agents, built on Pi.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -10,6 +10,8 @@
10
10
  "files": [
11
11
  "dist",
12
12
  "skills",
13
+ "python/shared/pyproject.toml",
14
+ "python/shared/uv.lock",
13
15
  "docs",
14
16
  "README.md",
15
17
  "package.json"
@@ -150,10 +152,10 @@
150
152
  "@introspection-ai/recipe-productivity-microsoft": ">=0.1.0",
151
153
  "@introspection-ai/recipe-search": ">=0.1.0",
152
154
  "@introspection-ai/recipe-signature": ">=0.1.0",
153
- "@introspection-ai/mcp-client-linux-x64": "0.60.0",
154
- "@introspection-ai/mcp-client-linux-arm64": "0.60.0",
155
- "@introspection-ai/mcp-client-darwin-arm64": "0.60.0",
156
- "@introspection-ai/mcp-client-darwin-x64": "0.60.0"
155
+ "@introspection-ai/mcp-client-linux-x64": "0.61.0",
156
+ "@introspection-ai/mcp-client-linux-arm64": "0.61.0",
157
+ "@introspection-ai/mcp-client-darwin-arm64": "0.61.0",
158
+ "@introspection-ai/mcp-client-darwin-x64": "0.61.0"
157
159
  },
158
160
  "peerDependencies": {
159
161
  "@earendil-works/pi-agent-core": ">=1.1.0 <2.0.0",
@@ -0,0 +1,15 @@
1
+ [project]
2
+ name = "recipes-shared"
3
+ version = "0.1.0"
4
+ description = "The one Python environment every first-party @introspection-ai package that needs Python runs in; a package adds its libraries here."
5
+ requires-python = ">=3.12,<3.15"
6
+ dependencies = ["paper-docx>=0.2.1", "pypdfium2==5.14.0", "pillow==13.0.0"]
7
+
8
+ [project.optional-dependencies]
9
+ # Table cells for fee schedules, SLA grids and price tables. Optional: about 41 MB
10
+ # installed (pdfminer.six, cryptography, Pillow, cffi). Without it, a PDF read returns text.
11
+ tables = ["pdfplumber==0.11.10"]
12
+
13
+ [tool.uv]
14
+ package = false
15
+ constraint-dependencies = ["python-docx<0"]