GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow to pass features to cargo install in rust hooks · Issue #3230 · pre-commit/pre-commit

Allow to pass features to cargo install in rust hooks #3230

New issue
Copy link
New issue
Copy link
Open
#3235
Open
Allow to pass features to cargo install in rust hooks#3230
#3235
Copy link

Description

@Terseus
Terseus
opened on Jun 12, 2024
Issue body actions

search you tried in the issue tracker

rust features

describe your actual problem

The rust hooks execute cargo install --bins --root <root-dir> <packages> (taken from here) to install the hook, however if a hook wants to use a different set of features than its default features it can't because there's no way to pass either additional flags to the install command or a --features <features> to cargo command.

See JohnnyMorganz/StyLua#867 for a real world example where this has become a limitation.

It would be great to have a way to configure a hook to pass cargo additional features when building the hook's package.

pre-commit --version

3.7.1

Activity

  1. asottile commented on Jun 12, 2024

    @asottile
    asottile
    on Jun 12, 2024
    Member
    More actions

    I suspect this should just work through additional_dependencies, similar to how it's used for python

  2. Terseus commented on Jun 12, 2024

    @Terseus
    Terseus
    on Jun 12, 2024
    Author
    More actions

    @asottile

    I suspect this should just work through additional_dependencies, similar to how it's used for python

    Right now in rust that option is already in use:

    When specifying additional_dependencies for Rust, you can use the syntax {package_name}:{package_version} to specify a new library dependency (used to build your hook repo), or the special syntax cli:{package_name}:{package_version} for a CLI dependency (built separately, with binaries made available for use by hooks).

    Maybe we could add a new syntax for additional_dependencies in that e.g. values like feature-name could be passed as --features name.

  3. asottile commented on Jun 12, 2024

    @asottile
    asottile
    on Jun 12, 2024
    Member
    More actions

    yes I mean I suspect we can just send any arguments along to cargo install that don't fit the current format

  4. Terseus
    added 3 commits that reference this issue on Jun 15, 2024

    feat: allow rust hooks to specify crate features

    This issue will close once commit 1e5fc7f is merged into the 'main' branch.
    1e5fc7f

    feat: allow rust hooks to specify crate features

    This issue will close once commit 19f46ae is merged into the 'main' branch.
    19f46ae

    allow rust hooks to specify crate features

    This issue will close once commit bd153a6 is merged into the 'main' branch.
    bd153a6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.