-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for writing pyproject.toml files (#33)
This PR adds support for in-place modification of pyproject.toml files. The modification cannot be done out of place in this case because only a subset of the file is dependencies and there is no way for a pyproject.toml file to point to another location for its dependencies. On the positive side, the changeset here is quite small and easily manageable. OTOH, there are a number of open design questions that should be addressed before merging this PR. Note that some of these considerations are the same as for conda meta.yaml files in #28. I would consider pyproject.toml to be the easier of the two and require solving a subset of the problems needed for meta.yaml. Essentially all of the problems below exist in similar form for those files, so figuring out how pyproject.toml support should look will get us a large part of the way towards enabling meta.yaml. 1. The interpretation of the `files` key of dependencies.yaml is somewhat suspect when used for pyproject.toml because there is no sensible reason to want to rename the file (this is also true for meta.yaml) 2. For the optional dependencies, we need a way to specify the key of the optional dependencies section. I am currently using the file name for this purpose, but this may be problematic because the file name may not be unique i.e. we might need optional test dependencies in pyproject.toml as well as a test_*.yaml env file (This same problem exists for meta.yaml due to the different host/build/run/test sections). Furthermore, I've currently hacked this in by passing the filename key into the `make_dependency_file` function even though that function doesn't need it for anything else because the output filename has already been generated and is one of the inputs here (this is also why one test is currently failing). If we move forward with this approach, that code will need a bit of refactoring. 3. I am currently splitting up the build requirements, the run dependencies, and the optional dependencies as different OutputTypes, which is functional but somewhat contrived as being distinct from the different sections in (2). **EDIT** The above concerns have mostly been addressed. We are now using a single output type for all pyproject sections and allowing a new `extras` section that can be used to provide data specific to pyproject.toml, in this case the table and key under which to store a particular dependency list. This addresses points 2 and 3 above. Point 1 is still somewhat unaddressed, but is mitigated by better documenting the behavior.
- Loading branch information
Showing
10 changed files
with
254 additions
and
16 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ requires-python = ">=3.8" | |
dependencies = [ | ||
"PyYAML", | ||
"jsonschema", | ||
"tomlkit", | ||
] | ||
|
||
[project.scripts] | ||
|
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
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
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
27 changes: 27 additions & 0 deletions
27
tests/examples/invalid/pyproject_bad_key/dependencies.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
files: | ||
py_build: | ||
output: pyproject | ||
pyproject_dir: output/actual | ||
matrix: | ||
cuda: ["11.5", "11.6"] | ||
includes: | ||
- build | ||
extras: | ||
table: build-system | ||
key: dependencies | ||
channels: | ||
- rapidsai | ||
- conda-forge | ||
dependencies: | ||
build: | ||
specific: | ||
- output_types: [conda, requirements] | ||
matrices: | ||
- matrix: | ||
cuda: "11.5" | ||
packages: | ||
- cuda-python>=11.5,<11.7.1 | ||
- matrix: | ||
cuda: "11.6" | ||
packages: | ||
- cuda-python>=11.6,<11.7.1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
files: | ||
py_build: | ||
output: pyproject | ||
pyproject_dir: output/actual | ||
matrix: | ||
cuda: ["11.5", "11.6"] | ||
includes: | ||
- build | ||
extras: | ||
table: build-system | ||
channels: | ||
- rapidsai | ||
- conda-forge | ||
dependencies: | ||
build: | ||
specific: | ||
- output_types: [conda, requirements] | ||
matrices: | ||
- matrix: | ||
cuda: "11.5" | ||
packages: | ||
- cuda-python>=11.5,<11.7.1 | ||
- matrix: | ||
cuda: "11.6" | ||
packages: | ||
- cuda-python>=11.6,<11.7.1 |
Oops, something went wrong.