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

pip-compile reveals default --config=pyproject.toml option in header #1903

Closed
atugushev opened this issue Jul 6, 2023 · 5 comments · Fixed by #1904
Closed

pip-compile reveals default --config=pyproject.toml option in header #1903

atugushev opened this issue Jul 6, 2023 · 5 comments · Fixed by #1904
Labels
bug Something is not working config Related to pip-tools' configuration

Comments

@atugushev
Copy link
Member

There is a bug with pip 6.14.0. I just use pip-compile --allow-unsafe --generate-hashes --output-file=requirements/test.txt --resolver=backtracking --strip-extras requirements/test.in
but now it adds --config=pyproject.toml even there is no configuration in pyproject.toml
When running pip-compile click context has no src_files, so select_config_file returns pyproject.toml, but after compiling click context has src_files as requirements/test.in, so select_config_file returns None and so pyproject.toml != None

Making --config is_eager=False works

Originally posted by @q0w in #1893 (comment)

@q0w
Copy link
Contributor

q0w commented Jul 6, 2023

#1902 i've added steps to replicate.
So src_files is resolved after --config. Maybe src_files should be resolved first

@atugushev
Copy link
Member Author

atugushev commented Jul 6, 2023

I think we could update this:

pip-tools/piptools/utils.py

Lines 365 to 368 in 4b9cc32

if option_long_name == "--config":
default_config = select_config_file(click_ctx.params.get("src_files", ()))
if value == default_config:
continue

to something like:

if option_long_name == "--config":
    default_configs = {'pyproject.toml', '.pip-tools.toml'}
    if value in default_config:
        continue

What do you think?

@atugushev
Copy link
Member Author

#1902 i've added steps to replicate.

Ah, sorry. You might close this as duplicate then.

@q0w
Copy link
Contributor

q0w commented Jul 6, 2023

if option_long_name == "--config":
    default_configs = {'pyproject.toml', '.pip-tools.toml'}
    if value in default_config:
        continue

It would not work, value is None here
upd: I guess it works

@atugushev atugushev added the duplicate Duplicate of an existing issue/PR label Jul 6, 2023
@q0w
Copy link
Contributor

q0w commented Jul 6, 2023

oh no, it does not work, only with is_eager = False
@atugushev

@atugushev atugushev reopened this Jul 8, 2023
@atugushev atugushev added bug Something is not working and removed duplicate Duplicate of an existing issue/PR labels Jul 8, 2023
@atugushev atugushev added the config Related to pip-tools' configuration label Jul 16, 2023
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 a pull request may close this issue.

2 participants