Skip to content

Conversation

@tmi
Copy link

@tmi tmi commented Oct 17, 2025

We often don't want to add large files by mistake, but there are some cases where this is legit, like large uv locks or jupyter notebooks. But they are not that large to warrant git-lfs, and we don't want to increase the 500 kB limit globally because of those

@tmi tmi force-pushed the feat/largeFileFilter branch from d1c2aad to 89b1f94 Compare October 17, 2025 09:04
@tmi
Copy link
Author

tmi commented Oct 17, 2025

to whom it may concern -- when testing this, I've run into a curious case, maybe a bug. I see in most places just main() is invoked, like

, which however does not convert sys.argv into the first main's argument, and those then get lost. This happens even with explicit invocations of pre-commit run. Is that a known bug, or do I misunderstand something?

@asottile
Copy link
Member

there's no need. this is built in to pre-commit

search the docs or the issue tracker next time please!

@asottile asottile closed this Oct 17, 2025
@tmi
Copy link
Author

tmi commented Oct 17, 2025

ah I see, there is a general purpose exclude:, my bad, apologies. But @asottile do you have any thoughts regarding the argv not being passed? Thx

@asottile
Copy link
Member

not at a computer but I'm pretty sure it's one of the first videos in my explains playlist https://YouTube.com/anthonywritescode

something about a testable command line

@tmi
Copy link
Author

tmi commented Oct 17, 2025

@asottile testable command line? Getting confused... Let me provide more detail maybe. I was wondering why pre-commit run check-added-large-files -f <file> does not pass configuration from the .pre-commit-config.yml to the hook's callable. Gotten to pre-commit invoking the hook via xargs.xargs with the config's args passed as CLI args. But the __main__ calls main(), not main(sys.argv[1:]), so the arguments are lost. Even in this repo, I would have expected the individual main() functions in each hook to be called with the sys.argv, not like main()...

I checked your playlists, but I think I confused you with "testing", apologies -- this is not related to pytest

@asottile
Copy link
Member

trust me that's the right video watch it!

@tmi tmi deleted the feat/largeFileFilter branch October 20, 2025 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants