From 685bcbaa5489613b35eb5a112699250ff30cd944 Mon Sep 17 00:00:00 2001 From: chrysle Date: Sat, 20 Jan 2024 17:44:04 +0100 Subject: [PATCH] Fix config file search and inclusion in header --- piptools/scripts/options.py | 2 +- piptools/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/piptools/scripts/options.py b/piptools/scripts/options.py index ab456fce..3097b482 100644 --- a/piptools/scripts/options.py +++ b/piptools/scripts/options.py @@ -245,6 +245,7 @@ def _get_default_option(option_name: str) -> Any: src_files = click.argument( "src_files", nargs=-1, + is_eager=True, type=click.Path(exists=True, allow_dash=True), ) @@ -328,7 +329,6 @@ def _get_default_option(option_name: str) -> Any: f"Read configuration from TOML file. By default, looks for the following " f"files in the given order: {', '.join(DEFAULT_CONFIG_FILE_NAMES)}." ), - is_eager=True, callback=override_defaults_from_config_file, ) diff --git a/piptools/utils.py b/piptools/utils.py index 3b2061f7..ddbff322 100644 --- a/piptools/utils.py +++ b/piptools/utils.py @@ -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 + (".",) ) candidate_dirs = (src if src.is_dir() else src.parent for src in src_files_as_paths) config_file_path = next(