generated from tweag/project
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Preliminary support for Pixi projects using pyproject.toml #455
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When invalid lines are found in a requirements.txt file, we used to silently ignore them. With this, we still ignore them, but we now log a debug message so that it is easier for inquisitive users to see what's happening.
jherland
force-pushed
the
jherland/pixi-support
branch
from
September 9, 2024 22:32
4b6445f
to
2a66337
Compare
Add preliminary support for parsing Conda dependencies in the [tool.pixi.dependencies] section of pyproject.toml. This is used by Pixi to declare mandatory dependencies that are taken from the Conda ecosystem (rather than the PyPI ecosystem). One complication of Pixi dependencies is that if a dependency is listed _both_ as a PyPI dependency (in the standard PEP621 location) and as a Conda dependency in the [tool.pixi.dependencies] table, then the latter takes precedence. NOTE: We do not currently differentiate between Conda dependencies and PyPI dependencies, meaning that we assume that a Conda dependency named FOO will map one-to-one to a Python package named FOO. This is certainly not true for Conda dependencies that are not Python packages, and it probably isn't even true for all Conda dependencies that do indeed include Python packages. For now, we only make sure that the "same" dependency is not yielded twice when it appears in both as a PyPI and Conda dependency.
In addition to accepting PyPI dependencies in the standard PEP621 [project.dependencies] table, Pixi also supports a separate [tool.pixi.pypi-dependencies] table for these dependencies, e.g.: ```toml [project] name = "my_project" requires-python = ">= 3.9" [tool.pixi.project] channels = ["conda-forge"] platforms = ["linux-64"] [tool.pixi.pypi-dependencies] nump = "*" ``` (This section is also used for the editable self-dependency that Pixi adds by default in its projects, but more on that in a later commit.)
Pixi uses the name "feature" to signify an optional dependency group. They look very much like Poetry's dependency groups, and the "extras" that are declared in PEP621's `optional-dependencies`, but contain Conda dependencies rather than PyPI dependencies. Add support for parsing them. For now, FawltyDeps does not differentiate between mandatory and optional dependencies: Dependencies from all feature sections are parsed and returned.
jherland
force-pushed
the
jherland/pixi-support
branch
from
September 10, 2024 09:51
2a66337
to
ce56b5f
Compare
In addition to [tool.pixi.feature.NAME.dependencies] for declaring optional Conda dependencies, Pixi completes the picture by also having [tool.pixi.feature.NAME.pypi-dependencies] for declaring optional PyPI dependencies (although this technically overlaps with the PEP621 [project.optional-dependencies]).
Pixi inserts this self-dependency by default in its projects: ```toml [project] name = "my_project" requires-python = ">= 3.9" [tool.pixi.project] channels = ["conda-forge"] platforms = ["linux-64"] [tool.pixi.pypi-dependencies] my_project = { path = ".", editable = true } ``` This self-dependency should NOT be considered a declared dependency, but is rather a mechanism to produce an editable installation of the project itself inside the environments that Pixi creates. In general it probably does not make sense for FawltyDeps to accept these self-dependencies, no matter how/where they are found?
jherland
force-pushed
the
jherland/pixi-support
branch
from
September 10, 2024 13:57
ce56b5f
to
322300e
Compare
jherland
force-pushed
the
jherland/pixi-support
branch
from
September 10, 2024 18:53
322300e
to
e032a4c
Compare
This was created with the following commands: - pixi init --format pyproject pixi_pyproject_example - cd pixi_pyproject_example/ - pixi add python - pixi add requests - pixi add --pypi fawltydeps - echo "import requests" > pixi_pyproject_example/__init__.py followed by removing/truncating files that I do not currently consider to be important for FawltyDeps to make sense of this project. The result is a simple Pixi project with two declared Conda dependencies (Python itself + requests) and one PyPI dependency (fawltydeps), along with a single source file that imports requests. The expected result of running FawltyDeps here is success (requests is both declared and imported, fawltydeps is part of the default tool exception, and Python itself is auto-ignored as a dependency).
jherland
changed the title
Preliminary support for Pixi project using pyproject.toml
Preliminary support for Pixi projects using pyproject.toml
Sep 11, 2024
mknorps
approved these changes
Oct 2, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NOTE: We do not currently differentiate between Conda dependencies and PyPI dependencies, meaning that we assume that a Conda dependency named FOO will map one-to-one to a Python package named FOO. This is certainly not true for Conda dependencies that are not Python packages, and it probably isn't even true for all Conda dependencies that do indeed include Python packages.
Commits:
parse_requirements_txt
: Add debug log messages for invalid linesparse_pyproject_toml
: Support Pixi dependenciesparse_pyproject_toml
: Support Pixi pypi-dependenciesparse_pyproject_toml
: Support Pixi "feature" dependenciesparse_pyproject_toml
: Support Pixi "feature" pypi-dependenciesparse_pyproject_toml
: Ignore Pixi's self-dependencysample_projects
: Add Pixi project usingpyproject.toml