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

Behavior without configuration #3

Open
zanieb opened this issue Mar 22, 2024 · 1 comment
Open

Behavior without configuration #3

zanieb opened this issue Mar 22, 2024 · 1 comment

Comments

@zanieb
Copy link
Member

zanieb commented Mar 22, 2024

Right now, we do not provide default arguments so the default behavior is a failure (see #2).

We could provide something else and probably should have it working "out of the box". This is a tracking issue to discuss what would be best.

@CoderJoshDK
Copy link
Contributor

Considering that this is "drop-in replacement" for pip-tools, you could try to match their behavior. The hook they have: https://github.com/jazzband/pip-tools/blob/main/.pre-commit-hooks.yaml, when ran the same way you tried it (with try-repo), generates the requirements.txt file. However, this is not because arguments were used, but rather that there is default behavior for pip-compile. So, should uv pip compile have a default behavior? Or is it wiser to mimic that behavior in the args of this hook?

In principle, I agree that the hook should not fail on default. However, uv has different behaviors from pip-tools. Primarily, if you run just pip-compile : Error: Invalid value: If you do not specify an input file, the default is one of: requirements.in, setup.py, pyproject.toml, setup.cfg. So, it checks for multiple files as the thing to compile. Even so, the pre-commit is set to only trigger if there are changes to either requirements.txt or requirements.in. And so, we could always assume that the requirements.in file exists and add a default arg of args: ["requirements.in"]. Because in both tools, you would still need to change the default behavior for any other setup. (pip-compile checks multiple file types, but the hook is setup to only check the requirments file)

All of this to say; Let the end user configure the tools provided to work for them. And just make it clear how it works in the README. And the default config should not error in default situations. So, the default "out of the box" configure should have the args: ["requirements.in"].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants