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

Avoid having to specify the name twice when using pyproject.toml #1090

Closed
tdejager opened this issue Mar 29, 2024 · 3 comments · Fixed by #1112
Closed

Avoid having to specify the name twice when using pyproject.toml #1090

tdejager opened this issue Mar 29, 2024 · 3 comments · Fixed by #1112
Labels
enhancement New feature or request pypi Issue related to PyPI dependencies pyproject

Comments

@tdejager
Copy link
Contributor

Problem description

With the new pyproject file format. When looking at an example:

[project]
name = "flask-hello-world-pyproject"
version = "0.1.0"
description = "Example how to get started with flask in a pixi environment."
readme = "README.md"
requires-python = ">=3.11"
dependencies = ["flask==2.*"]

[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[tool.pixi.project]
name = "flask-hello-world-pyproject"
channels = ["conda-forge"]
platforms = ["linux-64", "osx-arm64"]

[tool.pixi.tasks]
start = "python -m flask run --port=5050"

I think we should allow having the name in [project] section only, instead of having to specify it twice. Or is there some technicality that I'm missing :)?

@tdejager tdejager added the enhancement New feature or request label Mar 29, 2024
@tdejager tdejager changed the title [pyproject.toml] Avoid having to specify the name twice. [pyproject.toml] avoid having to specify the name twice. Mar 29, 2024
@tdejager tdejager added pypi Issue related to PyPI dependencies pyproject labels Mar 29, 2024
@tdejager tdejager changed the title [pyproject.toml] avoid having to specify the name twice. avoid having to specify the name twice when using pyproject.toml Mar 29, 2024
@tdejager tdejager changed the title avoid having to specify the name twice when using pyproject.toml Avoid having to specify the name twice when using pyproject.toml Mar 29, 2024
@olivier-lacroix
Copy link
Contributor

olivier-lacroix commented Mar 29, 2024

Definitely. @ruben-arts was happy to leave this for a later PR, hence why it is as it is.

I am not sure of how to proceed:

  • make it optional in the current struct, and make sure it is defined in the validate function?
  • Create a different struct for pyproject.toml parsing?
  • Some serde wizardry to inject the pyproject name into the pixi name when deserialising ?

Any preference @tdejager ?

@tdejager
Copy link
Contributor Author

tdejager commented Apr 2, 2024

I was thinking about this over the weekend, but cannot really think of a better way than doing your: 1) (a bit easier) or 2) somewhat harder, but possible.

For 3) I've looked at de-serializing from seeded state, but could not find something satisfying, although there were some experiments from a quick glance: https://docs.rs/serde_state/latest/serde_state/

I would go with option 1) I don't know if it's possible to keep the current error message?

@olivier-lacroix
Copy link
Contributor

@tdejager agreed. let me give that a go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pypi Issue related to PyPI dependencies pyproject
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants