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

Hatch: Select interpreter list does not show hatch environments from 3.12 #23827

Open
jimisola opened this issue Jul 17, 2024 · 4 comments
Open
Assignees
Labels
info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@jimisola
Copy link

jimisola commented Jul 17, 2024

(per instructions in: #23706 (comment))

In our team some have this problem and for some it just works.

Background:

  • system uses Python 3.10 (Ubuntu 22.04)
  • pyenv is installed and provides 3.12.2
u30576@DCL0004:~$pyenv versions
* system (set by /home/u30576/.pyenv/version)
  3.12.2

image

We have different Python projects (we use hatch) and we are moving them over to 3.12.x.
We therefore have to select interpreter choose workspace and then pick among the following:

image

The hatch project has two environments in addition to the default: lint (black, flake8) and test (pytest etc). These are shown for 3.10.12 but not for 3.12. Why?

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jul 17, 2024
@karthiknadig karthiknadig self-assigned this Jul 17, 2024
@karthiknadig karthiknadig changed the title Select Interpreter does not all available environments defined in hatch project Hatch: Select interpreter list does not show hatch environments from 3.12 Jul 25, 2024
@karthiknadig
Copy link
Member

Would you be able to take a look at this issue? @ofek @flying-sheep

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Jul 25, 2024
@flying-sheep
Copy link

flying-sheep commented Jul 25, 2024

@jimisola the discovery works like this:

  1. hatch env show --json is run. The keys of the resulting JSON object are each a $name of a candidate env (display e.g. with hatch env show --json | jaq -r 'keys()[]')
  2. hatch env find $name is run for each of them to find the path
  3. the candidates are filtered using pathExists (envs that don’t exist are discarded)

So I assume you just didn’t cause hatch to create the environments that don’t appear.

@karthiknadig there is one way I can think of that we could of course make VS Code work more intuitively, i.e. we stop filtering out envs whose paths don’t exist, and when the user selects such an env, we hatch env create $name it.

But my VS Code codebase skills aren’t good enough for that, I don’t know if postponing the selection here and showing a little progress notification while trying to create the env is possible.

@lfvjimisola
Copy link

(for anyone reading it should be `jq -r 'keys[]'

@flying-sheep Ok. That explains it. I'm in and out of so many python projects that it's difficult to remember for which a particular environment have been created or not.

Personally, I rather have VS Code show all the environments that are available (perhaps indication if one needs to be created) and the, like you suggested, it's created on the fly.

Copy link

Hey @karthiknadig, this issue might need further attention.

@jimisola, you can help us out by closing this issue if the problem no longer exists, or adding more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

4 participants