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 revealed default config in header if requirements in subfolder #1904

Merged
merged 15 commits into from
Aug 7, 2023

Conversation

atugushev
Copy link
Member

@atugushev atugushev commented Jul 8, 2023

Ensure src_files are handled prior to --config, as override_defaults_from_config_file is dependent on src_files.

Fixes #1903.

Contributor checklist
  • Provided the tests for the changes.
  • Assure PR title is short, clear, and good to be included in the user-oriented changelog
Maintainer checklist
  • Assure one of these labels is present: backwards incompatible, feature, enhancement, deprecation, bug, dependency, docs or skip-changelog as they determine changelog listing.
  • Assign the PR to an existing or new milestone for the target version (following Semantic Versioning).

@atugushev atugushev added the bug Something is not working label Jul 8, 2023
@atugushev
Copy link
Member Author

atugushev commented Jul 8, 2023

@q0w this should fix your issue too #1902. However, this does not cover "empty config file" case which is not a bug IMO.

@q0w
Copy link
Contributor

q0w commented Jul 8, 2023

what about this? I think it should pickup config from pyproject.toml
#1902 (comment)

@webknjaz webknjaz changed the title Fix revealed default config in header if requirements in suboflder Fix revealed default config in header if requirements in subfolder Jul 9, 2023
tests/test_utils.py Outdated Show resolved Hide resolved
Regression test for issue GH-1903.
"""
default_config_file = Path("pyproject.toml")
default_config_file.touch()
Copy link
Member

Choose a reason for hiding this comment

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

Can we also test the case when the [tool.pip-tools] section is present and empty?

Also, how about a .pip-tools.toml with an empty or missing [tool.pip-tools] and pyproject.toml with a non-empty one? I think that the pyproject.toml shouldn't be taken into account in this case.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, I'll add those combinations to parametrized tests 👍🏻

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed in 64445d0

Copy link
Member

Choose a reason for hiding this comment

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

I was hoping to see what happens if both files exist too..

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

@atugushev atugushev Jul 9, 2023

Choose a reason for hiding this comment

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

This looks like out of scope of get_compile_command. We can add more detailed unit tests for select_config_file() directly. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

If it's out of the scope, it'd be good to add the tests separately.

Copy link
Member Author

@atugushev atugushev Jul 10, 2023

Choose a reason for hiding this comment

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

Addressed In 845029a

atugushev and others added 3 commits July 9, 2023 22:02
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
@chrysle
Copy link
Contributor

chrysle commented Jul 11, 2023

I guess #1906 is to be merged first?

@atugushev
Copy link
Member Author

atugushev commented Jul 13, 2023

I've added more tests, and it turns out that the config option apparently requires eagerness. Otherwise, it would break the compilation without an explicitly passed config.

Working on a fix.

@atugushev atugushev added the config Related to pip-tools' configuration label Jul 16, 2023
@atugushev
Copy link
Member Author

Looks like the bug is fixed now. Ready for another round of review.

@atugushev
Copy link
Member Author

FTR, resolved some conflicts after merging with the main branch.

@atugushev atugushev requested a review from a team July 27, 2023 21:08
tests/conftest.py Outdated Show resolved Hide resolved
Copy link
Member

@theryanwalker theryanwalker left a comment

Choose a reason for hiding this comment

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

Left a minor comment. Otherwise, LGTM!

atugushev and others added 2 commits August 7, 2023 17:02
Co-authored-by: Ryan Walker <theryanwalker@proton.me>
@atugushev atugushev enabled auto-merge (squash) August 7, 2023 15:17
@atugushev atugushev added this to the 7.3.0 milestone Aug 7, 2023
@atugushev atugushev merged commit d1e9215 into jazzband:main Aug 7, 2023
33 of 34 checks passed
@atugushev atugushev deleted the main branch August 7, 2023 15:34
@atugushev
Copy link
Member Author

Thanks @webknjaz and @theryanwalker for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working config Related to pip-tools' configuration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pip-compile reveals default --config=pyproject.toml option in header
5 participants