Skip to content

Support reading [project] name, version and description from pyproject.toml #638

Closed

Description

@paugier

Problem description

For Python packages, the project name, version and description are usually already written in the pyproject.toml file.

When it is the case, it would be good if it would not be necessary to rewrite them in the pixi.toml file.

Activity

  1. baszalmstra commented on Jan 9, 2024

    @baszalmstra
    Contributor

    Duplicate of #79

  2. ruben-arts commented on Jan 9, 2024

    @ruben-arts
    Contributor

    Thanks for the input, but we're not going to support reading from pyproject.toml only partly. We either support what is stated in #79 or we should not read from the pyproject.toml at all in my opinion.

    Closing issue for now.

  3. paugier commented on Jan 10, 2024

    @paugier
    ContributorAuthor

    This is clearly not a duplicate of #79, which proposes that Pixi only uses pyproject.toml.

    I don't understand why it would be so bad to read some [project] data from a pyproject.toml file while keeping a pixi.toml file. In my point of view, it is not necessary to put everything in pyproject.toml and I have nothing against pixi.toml (which anyway should be supported for projects not related to Python).

    However, it is really very annoying for Python projects to duplicate in 2 files the same data, in particular things as basic as what is in pyproject.toml [project]. Do you really want your users to duplicate the version string in these two files? Why would it be useful? What happens if we accidentally change one (for example the proper one for a Python project, in pyproject.toml) and not the other?

    Note that if you support using pyproject.toml to store pixi related data (#79), there will be the same problem because you will have

    [project]
    name = "fluidsim"
    version = "0.8.0"
    description = "..."
    
    [tool.pixi.project]
    # we don't want to duplicate the name, version and description here!
    channels = ["conda-forge"]
    platforms = ["linux-64"]
    
    [tool.pixi.dependencies]
    ...
    
    
  4. ruben-arts commented on Jan 10, 2024

    @ruben-arts
    Contributor

    He @paugier,

    We appreciate you taking an interest in helping pixi improve. However, I'd like to request that we keep our discussions focused and constructive.
    This way of reading two files is not what we want to do with pixi because we believe in "one source of truth", that being the pixi.toml.
    That said you're always free to build it yourself and submit a PR which might change our view on the subject, this holds for any change.
    I was confused by your argument as we don't force the user to define anything in the project accept name, platforms and channels which is a bare minimum for pixi to work. I updated the documentation to clarify that these are the only ones.

  5. paugier commented on Jan 10, 2024

    @paugier
    ContributorAuthor

    I'd like to request that we keep our discussions focused and constructive.

    To be honest, I don't understand why you tell me that. It sounds like a criticism and I don't think I deserve that.

    About version, it is filled by default by pixi init. The user has to read the doc and find https://pixi.sh/configuration/#version-optional to discover that is it optional. But this documentation does not say how it is used by Pixi. Is it useful to maintain this field for a Python project? If it is useful I continue to think that this is not a good design for Python projects.

    Since you believe in "one source of truth" (meaning only one file), for Python projects, this has to be pyproject.toml and only this file. Python has a Python Packaging Authority, many related recent PEPs and a nice dynamics on packaging related to what is done by PyPA (PDM is a nice example and IMHO Pixi should also take inspiration from this project). It's counter productive not to follow the results of this standardization effort when you can.

    If you think "only one file" is important:

  6. ruben-arts commented on Jan 10, 2024

    @ruben-arts
    Contributor

    It sounds like a criticism and I don't think I deserve that.

    This is how I felt about your earlier message, if that was not the case for your message maybe its the translation boundary that made me think that.

    I think loosing version from the pixi init is a good idea. The meta information in the project is mostly there to support a build tool. We've had a PR in pixi to have a pixi build command which has been delayed but some of the preliminary work was already in. This is also the case for the build-dependencies and host-dependencies for instance. This doesn't win any beauty contests but I think we're such a fast moving development team that your unfortunately going to have some of these artifacts while developing.

    Most of our PEP integrations are done in rip as that is the library we use to support PyPI specific work.

    All current ideas seem to include that we will support the pyproject.toml in the future, but lets continue that story in issue #79.

  7. baszalmstra commented on Jan 10, 2024

    @baszalmstra
    Contributor

    Just a thought but I think some of this can already be achieved by using the dynamic feature of pyproject.toml. Instead of storing the version in the pyproject.toml it would actually be read from the pixi.toml.

    E.g. (see: https://peps.python.org/pep-0621/#dynamic)

    dynamic = ["version"]

    But I guess that requires a little pixi-build-helpers library or something. 🤔 Would be very interesting to explore that a little further. Might be a good initial first step to support pyproject.toml

    WDYT @paugier ?

  8. paugier commented on Jan 15, 2024

    @paugier
    ContributorAuthor

    To use dynamic = ["version"] and read the version from pixi.toml, one would need to use a Pixi build-backend and to have

     [build-system]
    requires = ["pixi-backend"]
    build-backend = "pixi.backend"
    

    So Pixi team would have to maintain a build backend: https://packaging.python.org/en/latest/tutorials/packaging-projects/#choosing-a-build-backend

    I personally think this task should not be done by Pixi since there are good specialized projects.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions