Skip to content

Accomodate Hatch use case #30

Closed

Description

@flying-sheep

Hatch currently monkeypatches propose_interpreters to apply its own filter logic: https://github.com/RRosio/hatch/blob/ecff6e6f3fff42efbd30866fb64e6273c93774d7/src/hatch/env/virtual.py#L378-L398

This broke because virtualenv moved the functionality to this package.

Would it be possible to add a filter callback or so to get_interpreter to make Hatch’s implementation fully based on public APIs, or is there another way to achieve the same?

Activity

  1. gaborbernat commented on Feb 26, 2026

    @gaborbernat
    Member

    Can you detail how would you like this to look and behave? Thanks!

  2. flying-sheep commented on Feb 26, 2026

    @flying-sheep
    Author

    Added a link to the code. It’s simply:

    def _patched_propose_interpreters(*args, **kwargs):
        for interpreter, impl_must_match in propose_interpreters(*args, **kwargs):
            if not self._interpreter_is_compatible(interpreter):
                continue
            yield interpreter, impl_must_match

    so a straightforward way would be to replace all this with

    -[monkeypatching code]
    -python_info = virtualenv_discovery.get_interpreter(python_version, (), env=self.get_interpreter_resolver_env())
    +python_info = virtualenv_discovery.get_interpreter(python_version, (), env=self.get_interpreter_resolver_env(), filter=self._interpreter_is_compatible)

    or maybe a variant where impl_must_match is also passed to the callback or so.

  3. self-assigned this
    on Feb 26, 2026
  4. added 3 commits that reference this issue on Feb 26, 2026
    e9d020e
    9539c9d
    7849929
  5. added a commit that references this issue on Feb 26, 2026
    27d0d1a
  6. flying-sheep commented on Feb 26, 2026

    @flying-sheep
    Author

    Thank you!

  7. ofek commented on Feb 26, 2026

    @ofek

    Thanks a lot 🙇‍♂️

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

Metadata

Metadata

Assignees

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