Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: give better errors on broken pyproject.toml #2075

Merged
merged 2 commits into from
Sep 18, 2024

Conversation

ruben-arts
Copy link
Contributor

You'll now get:

$ pixi install
  × failed to parse project manifest
    ╭─[pyproject.toml:18:12]
 17 │ 
 18 │ [tool.pixi.pypi-depenencies]
    ·            ────────┬───────
    ·                    ╰── unknown field `pypi-depenencies`, expected one of `project`, `system-requirements`, `target`, `dependencies`, `host-dependencies`, `build-dependencies`, `pypi-dependencies`, `activation`, `tasks`, `feature`, `environments`, `pypi-options`, `tool`, `$schema`
 19 │ test_init = { path = ".", editable = true }
    ╰────

instead of:

❯ ~/.pixi/bin/pixi i
  × could not find pixi.toml or pyproject.toml which is configured to use pixi

Copy link
Contributor

@baszalmstra baszalmstra left a comment

Choose a reason for hiding this comment

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

The reason we did it this way is to be able to have a nested subdirectory that contains a non-pixi pyproject and a top level pixi project.

With this PR this will fail if the current directory is the nested subdirectory.

Instead, I think we should try to loosely parse the toml file and see if it contains a tool.pixi section.

writeln!(file, "[project]").unwrap();

// Change directory to the temp directory
std::env::set_current_dir(&dir).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

This will change the current directory for all tests. Please modify the code so that it can recieve the current directory instead of reading it from the environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lol, that was a bit extreme. Improved the find function!

@ruben-arts
Copy link
Contributor Author

@baszalmstra I re-enabled the pyproject validation code but only or the [tool.pixi search not the full parse.

@baszalmstra
Copy link
Contributor

nice!

@ruben-arts ruben-arts merged commit 76fc13d into prefix-dev:main Sep 18, 2024
39 checks passed
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.

2 participants