Skip to content

Conversation

@sepehr-rs
Copy link
Member

Fixes #13279

I tried fixing this by providing the user with a helpful error message instead of crashing, and made a new parser to allow writing to the PIP_CONFIG_FILE environment variable temporarily.

One important caveat is that changes made to the config file via PIP_CONFIG_FILE may not be reflected in other commands like pip config get due to how pip loads config scopes.

Would appreciate any feedback on this :).

@sepehr-rs sepehr-rs changed the title Fix config error Fix fatal config set error Aug 11, 2025
@sepehr-rs
Copy link
Member Author

I think pre-commit is showing weird behavior here again...
I've changed the problematic files but it is still failing with the old files.

@notatallshaw
Copy link
Member

notatallshaw commented Aug 12, 2025

I think pre-commit is showing weird behavior here again...
I've changed the problematic files but it is still failing with the old files.

Do you know if there is anything particular about your git workflow? It does seem to be happening with your PRs more than anyone else's (though I have seen it happen at least once to mine).

You could perhaps report this to pre-commit, I would normally assist in reporting a bug but my experience with that project means I am not inclined to help it out.

In the mean time I'm thinking we should move off pre-commit.ci, and instead just add it as a github workflow, I don't see any advantage to having it run in a separate infrastructure. I'll make an issue and a PR when I have a moment.

@sepehr-rs
Copy link
Member Author

I think pre-commit is showing weird behavior here again...
I've changed the problematic files but it is still failing with the old files.

Do you know if there is anything particular about your git workflow? It does seem to be happening with your PRs more than anyone else's (though I have seen it happen at least once to mine).

You could perhaps report this to pre-commit, I would normally assist in reporting a bug but my experience with that project means I am not inclined to help it out.

In the mean time I'm thinking we should move off pre-commit.ci, and instead just add it as a github workflow, I don't see any advantage to having it run in a separate infrastructure. I'll make an issue and a PR when I have a moment.

No, I don’t think the issue is on my end. It might be that committing too quickly causes these problems. And sure, I’ll report this as a potential bug to pre-commit. Thanks for your feedback!

@notatallshaw
Copy link
Member

Oh great, Windows CI is failing today 😞 , I'll take a look in a min.

@notatallshaw
Copy link
Member

Seems like it was a transient error, I'll see if I can add some retry logic on the installing installing SVN step in the future.

Comment on lines +385 to +392
logger.warning(
"PIP_CONFIG_FILE is set to '{}'. "
"Applying changes to this file instead of '{}' config. "
"Note that some commands may not reflect these changes "
"as this config file is outside pip's normal config scopes. "
"Please inspect the file manually or unset "
"PIP_CONFIG_FILE for typical behavior.".format(
env_config_file, self.load_only
Copy link
Member

Choose a reason for hiding this comment

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

I'm not quite sure I follow what this is trying to say, you can you give me a high level description of what you want to convey to the user.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for reviewing this!
I wanted to let the user know that when the PIP_CONFIG_FILE environment variable is set, pip uses that file instead of its normal configuration hierarchy. As a result, some commands may not reflect changes made to this file, since it lies outside pip’s typical config scopes.

Copy link
Member

Choose a reason for hiding this comment

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

How about the following:

Because PIP_CONFIG_FILE is set, the changes will be applied to {}, rather than to {}. This may result in some commands not reflecting these changes. Please inspect the file manually or unset PIP_CONFIG_FILE for typical behavior.

Although I'm not 100% sure what commands would't respect the changes. Do you mean "other invocations of pip that don't set PIP_CONFIG_FILE"? Because I feel like it's relatively obvious that changing where pip gets its config from won't affect invocations that don't change where pip gets its config from... So letting the user know that PIP_CONFIG_FILE is set should be enough of a hint for them.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree with you. Maybe something like this would work better:

Because PIP_CONFIG_FILE is set, changes will be applied to {file}, not to {default}. To restore normal behavior, unset PIP_CONFIG_FILE.

Does this sound better to you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pip config set ERROR: Fatal Internal error [id=2]. Please report as a bug.

3 participants