feat: add the conda-script block model to pixi_manifest - #6907
feat: add the conda-script block model to pixi_manifest#6907Hofer-Julian wants to merge 1 commit into
pixi_manifest#6907Conversation
pixi_conda_script crate with the block parser and TOML model
fe4a43d to
9d4a9b3
Compare
pixi_conda_script crate with the block parser and TOML modelpixi_manifest
057ca70 to
aa105fe
Compare
965e65f to
412b5aa
Compare
hunger
left a comment
There was a problem hiding this comment.
My feeling is that how files with several blocks are not going to get handled too well, but that is a corner-case you probably won't run into often, so I did not want to spend too much time on that.
I did not look into that too deeply, maybe you can ask your agent to validate that bit a bit deeper.
| Err(_) => { | ||
| errors.errors.push(custom_error( | ||
| format!( | ||
| "'{name}' is neither a platform family (`unix`, `linux`, `osx`, `win`) nor a conda platform" |
There was a problem hiding this comment.
What is a conda platform? A subdir?
You are passing the name to the output without any sanitization, ESC codes and all.
| } | ||
|
|
||
| let path = std::path::absolute(path)?; | ||
| let source: Arc<str> = Arc::from(std::str::from_utf8(contents)?); |
There was a problem hiding this comment.
You require the entire file to be utf8 encoded here if I read that correctly. Not all languages require their source code to be utf-8, so that might cause problems.
| let mut name_spans: IndexMap<Name, toml_span::Span> = IndexMap::new(); | ||
| for (key, mut value) in table.into_iter().sorted_by_key(|(key, _)| key.span.start) { | ||
| let name = match Name::from_str(&key.name) { | ||
| Ok(name) => name, |
There was a problem hiding this comment.
IIRC empty Names are Ok, you probably do not want those though.
| let mut errors = DeserError { errors: Vec::new() }; | ||
|
|
||
| let channels = th | ||
| .required_s::<Vec<TomlFromStr<NamedChannelOrUrl>>>("channels") |
There was a problem hiding this comment.
I think you can end up with empty channels in the list here...
412b5aa to
d06f01b
Compare
The first piece of the `conda-script` proposal (#3751): the `/// conda-script` comment block parsed as a script manifest next to the PEP 723 one. `script::block` holds the machinery both kinds share: comment-prefix stripping, source maps for diagnostics and serializing edits back into the block. The model covers `channels`, `entrypoint` (string or platform table), `[dependencies]` restricted to the keys the spec defines, and `[tool.pixi]` with `dependencies` and `pypi-dependencies`. Edits round-trip: `metadata_document` exposes the block as TOML and `write_metadata` writes it back through the comment prefix.
d06f01b to
433950f
Compare
The
/// conda-scriptcomment block (#3751) parsed as a script manifest next to the PEP 723 one.pixi_manifest::scriptsplits into machinery both block kinds share (comment-prefix stripping, source maps for diagnostics, serializing edits back into the block) and one submodule per kindchannels,entrypoint(string or platform table),[dependencies],[tool.pixi]withdependenciesandpypi-dependencies[dependencies]rejects pixi-build specs (git,path, aurlthat is not a conda archive)