Skip to content

Conversation

@shaanmajid
Copy link
Collaborator

Summary

  • Replace FxHashSet<String> with Vec<String> for additional_dependencies throughout the codebase, preserving user-specified ordering and duplicates. This matches pre-commit semantics and fixes hooks that
    pass non-dependency arguments (e.g., --index-url <url>) in additional_dependencies.
  • For repo: local Python hooks with additional_dependencies, install from a synthetic placeholder repository (matching pre-commit's pre-commit-placeholder-package) instead of the project root. This prevents
    . from depending on user project contents.

Closes #1602
Closes #1603

Notes

  • Existing cached hook environments will be re-created on upgrade due to the FxHashSetVec serialization change. One-time cost, no user action needed in most cases.
  • Users with existing cached repo: local Python hooks using . in additional_dependencies should run prek clean to pick up the new synthetic repo behavior.
  • This fix is Python-specific for the synthetic local repo. Other languages with repo: local are not affected.

@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

❌ Patch coverage is 92.19858% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.66%. Comparing base (4406340) to head (a9687f7).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
crates/prek/src/languages/python/python.rs 66.66% 6 Missing ⚠️
crates/prek/src/hook.rs 95.23% 4 Missing ⚠️
crates/prek/src/store.rs 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1609      +/-   ##
==========================================
- Coverage   91.68%   91.66%   -0.02%     
==========================================
  Files          94       94              
  Lines       18387    18516     +129     
==========================================
+ Hits        16858    16973     +115     
- Misses       1529     1543      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@prek-ci-bot
Copy link

prek-ci-bot bot commented Feb 9, 2026

📦 Cargo Bloat Comparison

Binary size change: +0.00% (23.7 MiB → 23.7 MiB)

Expand for cargo-bloat output

Head Branch Results

 File  .text    Size             Crate Name
 0.3%   0.8% 80.0KiB             prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.3%   0.7% 71.2KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.6% 65.6KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.2%   0.5% 54.4KiB              prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.5% 51.2KiB annotate_snippets annotate_snippets::renderer::render::render
 0.2%   0.4% 43.4KiB              prek prek::identify::by_extension::{{closure}}
 0.2%   0.4% 41.1KiB              prek prek::cli::run::run::run::{{closure}}
 0.2%   0.4% 38.8KiB              prek prek::run::{{closure}}
 0.1%   0.3% 32.0KiB             prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.3% 28.4KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2% 24.8KiB             prek? <prek::config::_::<impl serde_core::de::Deserialize for prek::config::Config>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2% 22.6KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2% 22.2KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 21.1KiB      clap_builder clap_builder::parser::parser::Parser::get_matches_with
 0.1%   0.2% 20.4KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 20.2KiB              prek <prek::languages::ruby::ruby::Ruby as prek::languages::LanguageImpl>::install::{{closure}}
 0.1%   0.2% 19.8KiB              prek prek::archive::unzip::{{closure}}
 0.1%   0.2% 19.7KiB               std core::ptr::drop_in_place<prek::languages::<impl prek::config::Language>::install::{{closure}}>
 0.1%   0.2% 19.5KiB              prek prek::cli::run::filter::collect_files_from_args::{{closure}}
 0.1%   0.2% 19.4KiB   cargo_metadata? <cargo_metadata::_::<impl serde_core::de::Deserialize for cargo_metadata::Package>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
38.3%  91.4%  9.1MiB                   And 20911 smaller methods. Use -n N to show more.
41.9% 100.0% 10.0MiB                   .text section size, the file size is 23.7MiB

Base Branch Results

 File  .text    Size             Crate Name
 0.3%   0.7% 70.6KiB             prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.3%   0.7% 70.3KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.6% 65.6KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.2%   0.5% 51.2KiB annotate_snippets annotate_snippets::renderer::render::render
 0.2%   0.5% 50.5KiB              prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.4% 43.4KiB              prek prek::identify::by_extension::{{closure}}
 0.2%   0.4% 41.8KiB              prek prek::cli::run::run::run::{{closure}}
 0.2%   0.4% 38.8KiB              prek prek::run::{{closure}}
 0.1%   0.3% 32.0KiB             prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.3% 28.4KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2% 24.8KiB             prek? <prek::config::_::<impl serde_core::de::Deserialize for prek::config::Config>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2% 22.6KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2% 22.2KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 22.2KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 21.1KiB      clap_builder clap_builder::parser::parser::Parser::get_matches_with
 0.1%   0.2% 20.0KiB   cargo_metadata? <cargo_metadata::_::<impl serde_core::de::Deserialize for cargo_metadata::Package>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2% 19.8KiB              prek prek::archive::unzip::{{closure}}
 0.1%   0.2% 19.6KiB              prek prek::cli::run::filter::collect_files_from_args::{{closure}}
 0.1%   0.2% 19.3KiB               std core::ptr::drop_in_place<prek::languages::<impl prek::config::Language>::install::{{closure}}>
 0.1%   0.2% 19.2KiB              prek <prek::languages::ruby::ruby::Ruby as prek::languages::LanguageImpl>::install::{{closure}}
38.4%  91.5%  9.1MiB                   And 20946 smaller methods. Use -n N to show more.
42.0% 100.0% 10.0MiB                   .text section size, the file size is 23.7MiB

Replace FxHashSet<String> with Vec<String> for additional_dependencies
throughout the codebase. This preserves user-specified ordering and
duplicates, matching pre-commit semantics. Previously, FxHashSet caused
arbitrary reordering that broke hooks passing non-dependency arguments
like `--index-url <url>` in additional_dependencies.

For `repo: local` Python hooks, install from a synthetic placeholder
repository (containing a minimal setup.py) instead of the project root.
This prevents `.` in additional_dependencies from depending on project
contents and matches pre-commit's behavior.

Closes j178#1602
Closes j178#1603
@shaanmajid shaanmajid force-pushed the fix/1602-1603-origin-cleanone branch from a9687f7 to 2b719ef Compare February 9, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant