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

pixi init broken with incomplete pyproject.toml #1207

Closed
pavelzw opened this issue Apr 16, 2024 · 4 comments
Closed

pixi init broken with incomplete pyproject.toml #1207

pavelzw opened this issue Apr 16, 2024 · 4 comments

Comments

@pavelzw
Copy link
Contributor

pavelzw commented Apr 16, 2024

❯ cat pyproject.toml
[build-system]
requires = ["setuptools", "wheel"]

❯ pixi init
  × failed to parse project manifest
   ╭─[pyproject.toml:1:1]
 1 │ [build-system]
   · ┬
   · ╰── Missing field `project`
 2 │ requires = ["setuptools", "wheel"]
   ╰────

I personally would prefer to still be able to use the pixi.toml workflow and not be forced to use pyproject.toml as the pyproject.toml workflow always(?) introduces [pypi-dependencies] as this results in other issues (#1046). Maybe a prompt asking whether pixi should init into pyproject.toml or pixi.toml?

@olivier-lacroix
Copy link
Contributor

olivier-lacroix commented Apr 18, 2024

Another option would be to gate the pyproject.toml init behind the —pyproject flag for both new and existing pyproject.toml

@ruben-arts
Copy link
Contributor

I guess that would makes sense, or spawn a interactive choice

ruben-arts added a commit that referenced this issue Aug 5, 2024
This Fixes #1687 and
#1207 by keeping the
`[project]` table optional in `pyproject.toml`.

The `[project]` table had been made mandatory to make sure a name was
defined. Now, the project name is read from, in order of priority
 - the `[tool.pixi.project]` table
 - the `[project]` table
 - the `[tool.poetry]` table

The same is done for project description, version and authors.

During init, if the name cannot be read from the `[project]` table or
the `[tool.poetry]` table, a default name (inferred from the directory
name) is added to the `[tool.pixi.project]`

This PR also refactors handling of `pyproject.toml`: both pixi and
non-pixi `pyproject.toml` are now read into the same `PyProjectManifest`
struct, with existence checking of the `[tool.pixi.project]` table
managed outside of serde when necessary.

---------

Co-authored-by: Ruben Arts <[email protected]>
@olivier-lacroix
Copy link
Contributor

I believe we can close this issue, as pixi init is no more broken with incomplete pyproject.toml :-)

And the choice between pixi.toml / pyproject.toml on init is tracked in #1615

ruben-arts added a commit that referenced this issue Aug 5, 2024
…1640)

Adds a dialog for `pyproject.toml` use, and an option to overwrite the
dialog with `--format pixi`
```
> pixi init --format pixi # forces to always use pixi.toml
# And:
> touch pyproject.toml
> pixi init

A 'pyproject.toml' file already exists.
Do you want to extend it with the [tool.pixi] configuration? [y/N]
```

Fixes #1615 #1207

---------

Co-authored-by: Bas Zalmstra <[email protected]>
@ruben-arts
Copy link
Contributor

Fixed by #1640

Now you can do pixi init --format pixi
But in interactive mode pixi init on a folder with a pyproject.toml you'll be asked to choose if you want to add to the pyproject or not.

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

No branches or pull requests

3 participants