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 config file search and inclusion in header #2048

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chrysle
Copy link
Contributor

@chrysle chrysle commented Jan 20, 2024

Just stumbled over this issue again, so I thought I might as well fix it.

Closes #1902

Contributor checklist
  • Included tests for the changes.
  • PR title is short, clear, and ready to be included in the user-facing changelog.
Maintainer checklist
  • Verified 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).

@chrysle chrysle added bug Something is not working config Related to pip-tools' configuration labels Jan 20, 2024
@chrysle chrysle force-pushed the fix-config-file-search-path branch from 685bcba to 0385403 Compare January 20, 2024 17:37
@chrysle chrysle force-pushed the fix-config-file-search-path branch from 0385403 to db7b044 Compare January 22, 2024 08:16
@chrysle chrysle force-pushed the fix-config-file-search-path branch from c1474fd to cbc8f01 Compare January 22, 2024 08:20
@@ -630,7 +630,7 @@ def select_config_file(src_files: tuple[str, ...]) -> Path | None:
# NOTE: input.
working_directory = Path.cwd()
src_files_as_paths = (
(working_directory / src_file).resolve() for src_file in src_files or (".",)
(working_directory / src_file).resolve() for src_file in src_files + (".",)
Copy link
Member

Choose a reason for hiding this comment

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

Could you explain this? Obviously, there's some unspecified side effect in external logic, but I don't get it.

Copy link
Contributor Author

@chrysle chrysle Feb 15, 2024

Choose a reason for hiding this comment

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

This adds the current working directory to the search path for source files as well, as proposed in the linked issue.

@@ -245,6 +245,7 @@ def _get_default_option(option_name: str) -> Any:
src_files = click.argument(
"src_files",
nargs=-1,
is_eager=True,
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See #1902 (comment). Making only src_files eager doesn't work though, as it won't pick up the config if not specified, then.

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.

annotation --config is added even there is no configuration
2 participants