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

fix: support rendering nested pyproject.toml outputs to stdout #86

Merged
merged 1 commit into from
May 13, 2024

Conversation

jameslamb
Copy link
Member

@jameslamb jameslamb commented May 10, 2024

Fixes #85.

Contributes to rapidsai/build-planning#31 (via making debugging those changes easier).

#85 contains a reproducible example and details of the problem this solves. In short:

  • when rendering to stdout, dependency-file-generator currently defaults to looking for the file to overwrite in the current working directory
  • that leads to it use, say, ./pyproject.toml as the source for an invocation that should be handling e.g. ./python/cudf/pyproject.toml

This proposes the following:

  • modifies make_dependency_files() to always conda_dir / pyproject_dir / requirements_dir as a source of the file to load / possibly overwrite
  • fixes some outdated stuff in get_output_dir() docstring
  • changes get_output_dir() to use keyword-only arguments
  • adds a test covering this functionality

Notes for Reviewers

How I tested this

Installed the version from main on this branch.

git checkout main -- src/rapids_dependency_file_generator/_rapids_dependency_file_generator.py
pip install --ignore-installed .

Confirmed that this new unit test fails on main, and is reading in the root-level pyproject.toml instead of the nested one.

pytest tests/test_rapids_dependency_file_generator.py

Confirmed that it fails with the same error as #85 on the new test project added here.

cd ./tests/examples/nested-pyproject
rapids-dependency-file-generator \
   --output pyproject \
   --file-key sparkly_unicorn \
   --matrix "cuda=100.1"

# tomlkit.exceptions.NonExistentKey: 'Key "project" does not exist.'

Tested on cudf's actual dependencies.yaml on branch-24.06.

rapids-dependency-file-generator \
  --output pyproject \
  --file-key py_run_cudf \
  --matrix "cuda=12.2"

@jameslamb jameslamb added bug Something isn't working non-breaking Introduces a non-breaking change labels May 10, 2024
Copy link
Contributor

@KyleFromNVIDIA KyleFromNVIDIA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. Thanks for fixing this!

Copy link
Member

@ajschmidt8 ajschmidt8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧑‍🚒

@jameslamb jameslamb merged commit b92d026 into rapidsai:main May 13, 2024
5 checks passed
GPUtester pushed a commit that referenced this pull request May 13, 2024
## [1.13.5](v1.13.4...v1.13.5) (2024-05-13)

### Bug Fixes

* support rendering nested pyproject.toml outputs to stdout ([#86](#86)) ([b92d026](b92d026))
@GPUtester
Copy link

🎉 This PR is included in version 1.13.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

difyrrwrzd added a commit to difyrrwrzd/dependency-file-generator that referenced this pull request Aug 10, 2024
## [1.13.5](rapidsai/dependency-file-generator@v1.13.4...v1.13.5) (2024-05-13)

### Bug Fixes

* support rendering nested pyproject.toml outputs to stdout ([#86](rapidsai/dependency-file-generator#86)) ([1fb6797](rapidsai/dependency-file-generator@1fb6797))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working non-breaking Introduces a non-breaking change released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rendering a nested pyproject.toml file to stdout is broken
4 participants