Skip to content

Add py-rattler skill#30

Open
pavelzw wants to merge 3 commits intomainfrom
py-rattler
Open

Add py-rattler skill#30
pavelzw wants to merge 3 commits intomainfrom
py-rattler

Conversation

@pavelzw
Copy link
Copy Markdown
Owner

@pavelzw pavelzw commented Mar 13, 2026

needed in https://github.com/pavelzw/pixi-browse

Summary by CodeRabbit

  • New Features

    • Added py-rattler skill: Python bindings for the Rattler conda library featuring async-first design, comprehensive API documentation, and quick-start guide
    • Enables dependency management, package indexing, lock file handling, and shell activation
    • Includes networking, repodata caching, and environment configuration support
  • Documentation

    • Complete reference documentation and usage examples for all skill features

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 13, 2026

📝 Walkthrough

Walkthrough

This pull request introduces a new py-rattler skill package for conda environments. It adds a conda recipe, build configuration, comprehensive API reference documentation covering channels, exceptions, gateway interactions, indexing, lock files, package management, shell activation, solving/installing, versioning, and virtual packages, along with skill metadata and instructions.

Changes

Cohort / File(s) Summary
Metadata & Configuration
README.md, recipes/py-rattler/PROMPT.md, recipes/py-rattler/pixi.toml, recipes/py-rattler/recipe.yaml
Added README entry for py-rattler skill; created pixi build backend configuration, conda recipe with build/test/metadata definitions, and skill update instructions document.
Skill Documentation
recipes/py-rattler/SKILL.md
Introduced comprehensive skill documentation covering async-first Python bindings to rattler library, installation, API reference, quick start, import reference, and design principles.
API Reference - Core
recipes/py-rattler/references/channels-platforms.md, recipes/py-rattler/references/version.md, recipes/py-rattler/references/exceptions.md
Documented Channel, ChannelConfig, ChannelPriority, Platform abstractions; Version and VersionSpec classes; and exception hierarchy across 5 categories (parsing, operation, environment, version, other errors).
API Reference - Data & Records
recipes/py-rattler/references/lock-files.md, recipes/py-rattler/references/package-records.md, recipes/py-rattler/references/package-metadata.md, recipes/py-rattler/references/prefix-records.md
Documented LockFile/Environment/LockedPackage structures; PackageRecord/RepoDataRecord/NoArchType models; package metadata (IndexJson, AboutJson, RunExportsJson, PathsJson); and prefix inspection APIs (PrefixRecord, PrefixPaths, Link).
API Reference - Operations
recipes/py-rattler/references/match-spec.md, recipes/py-rattler/references/solving-installing.md, recipes/py-rattler/references/shell-activation.md
Documented MatchSpec/NamelessMatchSpec constructors and properties; solve/install function signatures and usage; Shell activation API with ActivationVariables and ActivationResult.
API Reference - Infrastructure
recipes/py-rattler/references/gateway-repodata.md, recipes/py-rattler/references/indexing.md, recipes/py-rattler/references/networking.md, recipes/py-rattler/references/package-streaming.md
Documented Gateway for repodata fetching, SourceConfig, RepoData/SparseRepoData; index_fs/index_s3 functions with S3Credentials; Client/Middleware networking stack; and package streaming utilities (extract, download, fetch_raw_package_file_from_url).
API Reference - Utilities
recipes/py-rattler/references/pty.md, recipes/py-rattler/references/virtual-packages.md
Documented PtyProcess/PtySession for Unix PTY support; VirtualPackage detection and GenericVirtualPackage/VirtualPackageOverrides configuration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hop hop, the rattler comes alive,
With Python bindings, async can thrive,
Channels, versions, locks in sight,
Documentation shining bright!

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add py-rattler skill' directly and clearly summarizes the main change—adding a new skill for py-rattler (Python bindings for the rattler conda library). It accurately reflects the primary objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Recipe Version Bump ✅ Passed This PR introduces a completely new py-rattler recipe with initial version 0.0.1, not modifying an existing recipe.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch py-rattler
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

The rattler repo lives at github.com/conda/rattler. The old
prefix-dev/rattler URL returned 404 in CI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 13, 2026

Build summary for agent-skill-py-rattler-0.0.1-h4616a5c_0

Artifact: /home/runner/work/skill-forge/skill-forge/output/noarch/agent-skill-py-rattler-0.0.1-h4616a5c_0.conda (41.72 KiB)

Included files (17 files)
Path Size Extra info
share/agent-skills/py-rattler/SKILL.md 5.03 KiB
share/agent-skills/py-rattler/references/channels-platforms.md 3.55 KiB
share/agent-skills/py-rattler/references/exceptions.md 2.42 KiB
share/agent-skills/py-rattler/references/gateway-repodata.md 7.51 KiB
share/agent-skills/py-rattler/references/indexing.md 3.75 KiB
share/agent-skills/py-rattler/references/lock-files.md 5.11 KiB
share/agent-skills/py-rattler/references/match-spec.md 5.24 KiB
share/agent-skills/py-rattler/references/networking.md 5.34 KiB
share/agent-skills/py-rattler/references/package-metadata.md 6.89 KiB
share/agent-skills/py-rattler/references/package-records.md 4.50 KiB
share/agent-skills/py-rattler/references/package-streaming.md 3.17 KiB
share/agent-skills/py-rattler/references/prefix-records.md 4.58 KiB
share/agent-skills/py-rattler/references/pty.md 3.60 KiB
share/agent-skills/py-rattler/references/shell-activation.md 3.02 KiB
share/agent-skills/py-rattler/references/solving-installing.md 6.67 KiB
share/agent-skills/py-rattler/references/version.md 4.04 KiB
share/agent-skills/py-rattler/references/virtual-packages.md 3.99 KiB
Resolved dependencies

Variant configuration (hash: h4616a5c_0):

Key Value
target_platform "noarch"

@pavelzw pavelzw marked this pull request as ready for review March 13, 2026 09:24
@pavelzw pavelzw requested a review from moritzwilksch as a code owner March 13, 2026 09:24
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (3)
recipes/py-rattler/recipe.yaml (1)

20-22: Consider if the tight version constraint is intentional.

The run_constraints pins py-rattler to >=0.23.0,<0.24, meaning users cannot install this skill alongside py-rattler 0.24+. If the API documentation in this skill is specific to 0.23.x, this is correct. However, if the API is stable across minor versions, consider relaxing to >=0.23 or adding a comment explaining why the upper bound is needed.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@recipes/py-rattler/recipe.yaml` around lines 20 - 22, The recipe's
run_constraints pins py-rattler to ">=0.23.0,<0.24", which prevents installation
with 0.24+; decide whether that tight upper bound is intentional and either (a)
relax the constraint to a more permissive spec like ">=0.23" if the API is
stable across minor versions, or (b) keep the upper bound but add an inline
comment in recipe.yaml next to run_constraints explaining why "<0.24" is
required (e.g., breaking changes in py-rattler >0.23.x) so future maintainers
understand the rationale.
recipes/py-rattler/references/gateway-repodata.md (1)

233-234: Minor wording polish for enum descriptions.

ONLY_TAR_BZ2 and ONLY_CONDA both start with “Only …”. Consider varying phrasing slightly for smoother reading.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@recipes/py-rattler/references/gateway-repodata.md` around lines 233 - 234,
Update the enum descriptions to avoid repeating “Only …” for both entries:
change `ONLY_TAR_BZ2` description to something like “Packages in .tar.bz2 format
only” (or “Tar.bz2 packages only”) and change `ONLY_CONDA` to “Packages in
.conda format only” (or “Conda packages only”) so the two lines read differently
while preserving meaning for `ONLY_TAR_BZ2` and `ONLY_CONDA`.
recipes/py-rattler/references/channels-platforms.md (1)

36-40: Fix inconsistent Channel example output after URL reassignment.

ch is reassigned to "https://repo.prefix.dev/conda-forge" on Line 37, but Line 39 still shows the default Anaconda base URL output. Please update the printed output (or split into two separate examples) so the example reflects the actual object state.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@recipes/py-rattler/references/channels-platforms.md` around lines 36 - 40,
The example reassigns ch to a URL but still shows the original base_url; update
the snippet so printed outputs match the actual object state by either splitting
into two examples or showing the new base_url after reassignment. For example,
keep the first Channel("conda-forge") example with its name and default
base_url, then create a second variable (e.g., ch2 =
Channel("https://repo.prefix.dev/conda-forge")) and print ch2.name and
ch2.base_url to show "conda-forge" and "https://repo.prefix.dev/conda-forge/"
(or, if you keep the single variable, change the base_url output to reflect the
repo.prefix.dev URL after reassignment). Ensure references to the Channel
constructor and .name/.base_url properties are updated accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@recipes/py-rattler/references/exceptions.md`:
- Around line 5-7: The example import uses an invalid ellipsis; replace the line
"from rattler.exceptions import SolverError, InvalidVersionError, ..." with a
syntactically valid import listing real exception names or a trailing comment,
e.g. import the actual exceptions you want (SolverError, InvalidVersionError,
ConstraintError, etc.) or write "from rattler import exceptions  # add specific
exceptions here" so the example is valid Python and references the real symbols
SolverError and InvalidVersionError.

In `@recipes/py-rattler/references/package-records.md`:
- Line 24: The constructor parameter type for PackageRecord.features is
incorrect: change the annotation in the PackageRecord constructor from
"list[str] | None" to "str | None" (the field is a single deprecated string, not
a list); update the constructor signature and any inline documentation in the
same file that references "features" to use "str | None" so it matches the
py-rattler API and the field usage elsewhere (e.g., where PackageRecord is
constructed/validated).

In `@recipes/py-rattler/references/prefix-records.md`:
- Around line 91-99: Update the properties table for PrefixPathsEntry to match
the constructor nullability: mark file_mode, sha256, sha256_in_prefix, and
size_in_bytes as optional by adding "| None" to their types in the documentation
so they match the constructor signature of PrefixPathsEntry(relative_path,
path_type, prefix_placeholder=None, file_mode: FileMode | None = None, sha256:
bytes | None = None, sha256_in_prefix: bytes | None = None, size_in_bytes: int |
None = None, original_path=None).

In `@recipes/py-rattler/references/pty.md`:
- Around line 55-63: The example uses top-level await with PtyProcess.async_read
and PtyProcess.async_wait which causes a SyntaxError in a regular .py file; wrap
the example in an async def (e.g., async def main()) and move the calls to proc
= PtyProcess(...), await proc.async_read(), and await proc.async_wait() into
that function, then invoke it with asyncio.run(main()) so the async_read and
async_wait calls run inside an event loop.

In `@recipes/py-rattler/references/shell-activation.md`:
- Around line 99-108: The ActivationResult docs currently list the `path`
property type as `Path` but the API returns a list of strings; update the
ActivationResult property table so the `path` row shows the correct type
`list[str]` (or equivalent "list of str") and adjust the Description if needed
to say "The new PATH value after activation as a list of filesystem path
strings" to match the behavior of the ActivationResult model.

In `@recipes/py-rattler/references/solving-installing.md`:
- Around line 145-157: The example uses await outside an async function (causing
SyntaxError); wrap the async calls in an async def main() and run it with
asyncio.run(main()), and ensure imports include asyncio and MatchSpec;
specifically update the snippet so solve(...) and install(...) are invoked
inside an async main() function (using await), keep Client.default_client()
inside that function, then call asyncio.run(main()) to execute it.

---

Nitpick comments:
In `@recipes/py-rattler/recipe.yaml`:
- Around line 20-22: The recipe's run_constraints pins py-rattler to
">=0.23.0,<0.24", which prevents installation with 0.24+; decide whether that
tight upper bound is intentional and either (a) relax the constraint to a more
permissive spec like ">=0.23" if the API is stable across minor versions, or (b)
keep the upper bound but add an inline comment in recipe.yaml next to
run_constraints explaining why "<0.24" is required (e.g., breaking changes in
py-rattler >0.23.x) so future maintainers understand the rationale.

In `@recipes/py-rattler/references/channels-platforms.md`:
- Around line 36-40: The example reassigns ch to a URL but still shows the
original base_url; update the snippet so printed outputs match the actual object
state by either splitting into two examples or showing the new base_url after
reassignment. For example, keep the first Channel("conda-forge") example with
its name and default base_url, then create a second variable (e.g., ch2 =
Channel("https://repo.prefix.dev/conda-forge")) and print ch2.name and
ch2.base_url to show "conda-forge" and "https://repo.prefix.dev/conda-forge/"
(or, if you keep the single variable, change the base_url output to reflect the
repo.prefix.dev URL after reassignment). Ensure references to the Channel
constructor and .name/.base_url properties are updated accordingly.

In `@recipes/py-rattler/references/gateway-repodata.md`:
- Around line 233-234: Update the enum descriptions to avoid repeating “Only …”
for both entries: change `ONLY_TAR_BZ2` description to something like “Packages
in .tar.bz2 format only” (or “Tar.bz2 packages only”) and change `ONLY_CONDA` to
“Packages in .conda format only” (or “Conda packages only”) so the two lines
read differently while preserving meaning for `ONLY_TAR_BZ2` and `ONLY_CONDA`.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9afee2be-dc87-460e-98b4-75c68288f093

📥 Commits

Reviewing files that changed from the base of the PR and between cfa314b and 1c27d10.

📒 Files selected for processing (21)
  • README.md
  • recipes/py-rattler/PROMPT.md
  • recipes/py-rattler/SKILL.md
  • recipes/py-rattler/pixi.toml
  • recipes/py-rattler/recipe.yaml
  • recipes/py-rattler/references/channels-platforms.md
  • recipes/py-rattler/references/exceptions.md
  • recipes/py-rattler/references/gateway-repodata.md
  • recipes/py-rattler/references/indexing.md
  • recipes/py-rattler/references/lock-files.md
  • recipes/py-rattler/references/match-spec.md
  • recipes/py-rattler/references/networking.md
  • recipes/py-rattler/references/package-metadata.md
  • recipes/py-rattler/references/package-records.md
  • recipes/py-rattler/references/package-streaming.md
  • recipes/py-rattler/references/prefix-records.md
  • recipes/py-rattler/references/pty.md
  • recipes/py-rattler/references/shell-activation.md
  • recipes/py-rattler/references/solving-installing.md
  • recipes/py-rattler/references/version.md
  • recipes/py-rattler/references/virtual-packages.md

sha256: bytes | None = None,
md5: bytes | None = None,
size: int | None = None,
features: list[str] | None = None,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n recipes/py-rattler/references/package-records.md | head -80 | tail -60

Repository: pavelzw/skill-forge

Length of output: 3359


🏁 Script executed:

# Check lines around 24 and 69 specifically
echo "=== Lines 20-30 ===" && sed -n '20,30p' recipes/py-rattler/references/package-records.md
echo "=== Lines 65-75 ===" && sed -n '65,75p' recipes/py-rattler/references/package-records.md

Repository: pavelzw/skill-forge

Length of output: 1091


🌐 Web query:

py-rattler PackageRecord features type documentation

💡 Result:

In py-rattler, PackageRecord.features is a writable, optional string field (str | None) on rattler.repo_data.PackageRecord.

The documentation notes that “features” is deprecated (it was used for solver feature sets, but is no longer supported) and recommends using mutex packages instead. The examples show it being None by default, set to a string (e.g. "feature1"), and reset back to None. [1]

Source: [1]


Fix constructor type for PackageRecord.features from list[str] | None to str | None.

Line 24 documents the constructor parameter as list[str] | None, but line 69 and the actual py-rattler API show it should be str | None. The field is a single deprecated string, not a list. Update line 24 to match.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@recipes/py-rattler/references/package-records.md` at line 24, The constructor
parameter type for PackageRecord.features is incorrect: change the annotation in
the PackageRecord constructor from "list[str] | None" to "str | None" (the field
is a single deprecated string, not a list); update the constructor signature and
any inline documentation in the same file that references "features" to use "str
| None" so it matches the py-rattler API and the field usage elsewhere (e.g.,
where PackageRecord is constructed/validated).

Comment on lines +91 to +99
PrefixPathsEntry(
relative_path: os.PathLike[str],
path_type: PrefixPathType,
prefix_placeholder: str | None = None,
file_mode: FileMode | None = None,
sha256: bytes | None = None,
sha256_in_prefix: bytes | None = None,
size_in_bytes: int | None = None,
original_path: os.PathLike[str] | None = None,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n recipes/py-rattler/references/prefix-records.md | head -120 | tail -35

Repository: pavelzw/skill-forge

Length of output: 1462


🏁 Script executed:

cat -n recipes/py-rattler/references/prefix-records.md | sed -n '100,130p'

Repository: pavelzw/skill-forge

Length of output: 1249


🏁 Script executed:

cat -n recipes/py-rattler/references/prefix-records.md | sed -n '80,105p'

Repository: pavelzw/skill-forge

Length of output: 830


🏁 Script executed:

# Check if there's any py-rattler source code or additional documentation
find . -type f -name "*.py" -o -name "*.md" | grep -i rattler | head -20

Repository: pavelzw/skill-forge

Length of output: 996


🏁 Script executed:

# Check the full context around properties section and any notes
cat -n recipes/py-rattler/references/prefix-records.md | sed -n '85,125p'

Repository: pavelzw/skill-forge

Length of output: 1645


🏁 Script executed:

# Check if there's any note or clarification elsewhere in the file
grep -n "optional\|nullable\|None\|guarantee" recipes/py-rattler/references/prefix-records.md

Repository: pavelzw/skill-forge

Length of output: 1138


🏁 Script executed:

# Check the full file to see if there are any notes about how the library handles default values
wc -l recipes/py-rattler/references/prefix-records.md

Repository: pavelzw/skill-forge

Length of output: 114


🏁 Script executed:

# Check if there are any other similar patterns in the file that show Optional handling
grep -B2 -A2 "FileMode\|sha256\|size_in_bytes" recipes/py-rattler/references/prefix-records.md | head -30

Repository: pavelzw/skill-forge

Length of output: 718


🏁 Script executed:

# Check the original_path field to see how similar optional fields are documented
grep -n "original_path" recipes/py-rattler/references/prefix-records.md

Repository: pavelzw/skill-forge

Length of output: 116


Correct PrefixPathsEntry property types to match constructor nullability.

The constructor marks file_mode, sha256, sha256_in_prefix, and size_in_bytes as optional (with | None), but the properties table documents them as non-optional types. Update the properties table to include | None for these fields to match the constructor signature and reflect the actual API behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@recipes/py-rattler/references/prefix-records.md` around lines 91 - 99, Update
the properties table for PrefixPathsEntry to match the constructor nullability:
mark file_mode, sha256, sha256_in_prefix, and size_in_bytes as optional by
adding "| None" to their types in the documentation so they match the
constructor signature of PrefixPathsEntry(relative_path, path_type,
prefix_placeholder=None, file_mode: FileMode | None = None, sha256: bytes | None
= None, sha256_in_prefix: bytes | None = None, size_in_bytes: int | None = None,
original_path=None).

Comment on lines +55 to +63
```python
from rattler import PtyProcess

proc = PtyProcess(["python3", "-c", "print('hello')"])
output = await proc.async_read()
print(output.decode())
status = await proc.async_wait()
print(status) # "Exited(0)"
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Is top-level await valid in regular Python scripts, or only in specific environments (e.g., REPL/Jupyter)?

💡 Result:

Top-level await is not valid in regular Python scripts (.py). In standard Python syntax, await may only appear inside a coroutine function body (i.e., inside async def ...); using it at module top level raises a SyntaxError (“await outside function”). [1]

It can work at “top level” only in special interactive environments that intentionally support it by running an event loop and/or transforming input code, such as:

  • The asyncio REPL (python -m asyncio), which explicitly lets you “Use await directly …” at the prompt. [2]
  • IPython/Jupyter, which supports “autoawait” and allows await at top-level scope in cells/REPL. [3]

In a script, the usual pattern is:

import asyncio

async def main():
    await something()

asyncio.run(main())

Wrap async example in async def function to fix invalid top-level await usage.

Lines 59 and 61 show await statements at module level, which is invalid Python syntax outside special interactive environments (asyncio REPL, Jupyter). The code will fail with SyntaxError: 'await' outside async function if copied into a regular .py file.

Wrap the code in an async def main(): function and execute it with asyncio.run(main()):

Corrected example
import asyncio
from rattler import PtyProcess

async def main():
    proc = PtyProcess(["python3", "-c", "print('hello')"])
    output = await proc.async_read()
    print(output.decode())
    status = await proc.async_wait()
    print(status)  # "Exited(0)"

asyncio.run(main())
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@recipes/py-rattler/references/pty.md` around lines 55 - 63, The example uses
top-level await with PtyProcess.async_read and PtyProcess.async_wait which
causes a SyntaxError in a regular .py file; wrap the example in an async def
(e.g., async def main()) and move the calls to proc = PtyProcess(...), await
proc.async_read(), and await proc.async_wait() into that function, then invoke
it with asyncio.run(main()) so the async_read and async_wait calls run inside an
event loop.

Comment on lines +99 to +108
## ActivationResult

Result of activating a conda environment.

### Properties

| Property | Type | Description |
|----------|------|-------------|
| `script` | `str` | Shell code to execute for activation (source/eval this) |
| `path` | `Path` | The new PATH value after activation |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

py-rattler ActivationResult path property type

💡 Result:

In py-rattler, ActivationResult.path is effectively a list[str] (a list of filesystem path strings).

Reason: the underlying Rust field is path: Vec<PathBuf> in rattler_shell::activation::ActivationResult [1], and PyO3 converts PathBuf values to Python str objects at the API boundary [2].

Sources: [1] [2]


Correct the path property type in the ActivationResult table.

The path property is documented as type Path, but the actual py-rattler API returns a list[str] (a list of filesystem path strings converted from the underlying Vec<PathBuf>). Update the table to reflect the correct type.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@recipes/py-rattler/references/shell-activation.md` around lines 99 - 108, The
ActivationResult docs currently list the `path` property type as `Path` but the
API returns a list of strings; update the ActivationResult property table so the
`path` row shows the correct type `list[str]` (or equivalent "list of str") and
adjust the Description if needed to say "The new PATH value after activation as
a list of filesystem path strings" to match the behavior of the ActivationResult
model.

Comment on lines +145 to +157
```python
from rattler import solve, install, Client

records = await solve(sources=["conda-forge"], specs=["python 3.12.*"])
client = Client.default_client()
await install(
records,
target_prefix="/opt/envs/myenv",
client=client,
show_progress=True,
requested_specs=[MatchSpec("python 3.12.*")],
)
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistent async usage in the install() example.

The await keyword is used outside of an async function context. Unlike the solve() example which properly wraps code in async def main() and asyncio.run(main()), this example will raise a SyntaxError.

📝 Proposed fix
-```python
-from rattler import solve, install, Client
-
-records = await solve(sources=["conda-forge"], specs=["python 3.12.*"])
-client = Client.default_client()
-await install(
-    records,
-    target_prefix="/opt/envs/myenv",
-    client=client,
-    show_progress=True,
-    requested_specs=[MatchSpec("python 3.12.*")],
-)
-```
+```python
+import asyncio
+from rattler import solve, install, Client, MatchSpec
+
+async def main():
+    records = await solve(sources=["conda-forge"], specs=["python 3.12.*"])
+    client = Client.default_client()
+    await install(
+        records,
+        target_prefix="/opt/envs/myenv",
+        client=client,
+        show_progress=True,
+        requested_specs=[MatchSpec("python 3.12.*")],
+    )
+
+asyncio.run(main())
+```
</details>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@recipes/py-rattler/references/solving-installing.md` around lines 145 - 157,
The example uses await outside an async function (causing SyntaxError); wrap the
async calls in an async def main() and run it with asyncio.run(main()), and
ensure imports include asyncio and MatchSpec; specifically update the snippet so
solve(...) and install(...) are invoked inside an async main() function (using
await), keep Client.default_client() inside that function, then call
asyncio.run(main()) to execute it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant