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

Test that Hatch environments are discovered and activated #23088

Closed
3 tasks done
flying-sheep opened this issue Mar 18, 2024 · 3 comments
Closed
3 tasks done

Test that Hatch environments are discovered and activated #23088

flying-sheep opened this issue Mar 18, 2024 · 3 comments
Labels
testplan-item Test plan item/assignments for upcoming release
Milestone

Comments

@flying-sheep
Copy link

flying-sheep commented Mar 18, 2024

Refs: #22810

Complexity: 4

Authors: @flying-sheep, @karrtikr

Create Issue


  1. Install Hatch
    • using the GUI installers on macOS or windows

    • using your system package manager on Arch Linux or Fedora

    • using pipx install Hatch on other Linux distributions. Please make sure you set your PATH correctly in this case.

      Setting PATH on Linux

      If you cannot install Hatch system-wide, you might need to add $HOME/.local/bin to your PATH environment variable for your graphical session, not just your terminal. Check like this:

      $ pgrep bin/code  # or some other graphical application
      1234
      $ cat /proc/1234/environ | tr '\0' '\n' | grep -E '^PATH='
      PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

      If the the directory is not in there, you need to add it in your session startup script, in a way that depends on your desktop environment:

  2. In an empty VS Code project, add two files:
    1. testproj.py containing
      import session_info
      
      session_info.show()
    2. … and a pyproject.toml specifying dependencies:
      [project]
      name = "testproj"
      version = "0.1.0"
      dependencies = ["session-info"]
      
      [build-system]
      requires = ["hatchling"]
      build-backend = "hatchling.build"
  3. Make Hatch install the project and its dependencies to an environment using hatch run ..., e.g. hatch run python -V (there is no configuration necessary for Hatch to work in a simple case like this)
  4. Select the testproj as an interpreter using Python: Select Interpreter command
    image
  5. Run it using the play icon on top right
    image
  6. The file is successfully run and prints the session info:
    grafik
  7. Open a new terminal: If you have the python.terminal.activateEnvironment setting set to true, the environment should be activated:
    Run pip -V and compare if the path starts with the path displayed by hatch env find (pip’s contains an additional lib/pythonX.YZ/site-packages/pip)
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Mar 18, 2024
@karrtikr karrtikr added testplan-item Test plan item/assignments for upcoming release and removed triage-needed Needs assignment to the proper sub-team labels Mar 18, 2024
@karrtikr karrtikr changed the title [testplan-item] Test that Hatch environments are discovered and activated Test that Hatch environments are discovered and activated Mar 18, 2024
@rzhao271 rzhao271 added this to the March 2024 milestone Mar 25, 2024
@karthiknadig
Copy link
Member

karthiknadig commented Mar 25, 2024

@ofek @flying-sheep You might need to report the MSI as safe:
image

Another issue is that the publisher on the MSI is unknown, it is getting blocked by defender. You might need a code signing certificate for this.

@karthiknadig karthiknadig removed their assignment Mar 25, 2024
@connor4312 connor4312 removed their assignment Mar 25, 2024
@Tyriar Tyriar removed their assignment Mar 25, 2024
@Tyriar Tyriar closed this as completed Mar 25, 2024
@flying-sheep
Copy link
Author

@ofek is the maintainer of both Hatch and PyApp (the framework to create the Hatch installer), and AFAIK also using Windows, so he’d need to sign it.

I personally don’t have access to any Windows machine and am therefore blissfully unaware of all the hoops Microsoft makes poor developers jump through to distribute their applications in a way that doesn’t scare users off 😄

@ofek
Copy link

ofek commented Mar 26, 2024

The installers are currently created with PyOxidizer but I only have a certificate from the PSF for macOS. I'll ask about Windows today, it hasn't been a high priority.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
testplan-item Test plan item/assignments for upcoming release
Projects
None yet
Development

No branches or pull requests

8 participants