Skip to content

Update nix channel for python; use stock pip; monkeypatch pip to chan…#272

Merged
airportyh merged 2 commits intomainfrom
th-update-python-channel-3
Mar 1, 2024
Merged

Update nix channel for python; use stock pip; monkeypatch pip to chan…#272
airportyh merged 2 commits intomainfrom
th-update-python-channel-3

Conversation

@airportyh
Copy link
Collaborator

@airportyh airportyh commented Feb 29, 2024

…ge shebang line

Why

  1. We want to upgrade Python to nixpkgs-unstable
  2. due to an update in nixpkgs, we had to change how we package pip, we chose to:
    a. use the stock pip instead of our custom one
    b. add back a customization for the shebang line via monkeypatching, via python site customization, which has the advantage of working for a pip that's been installed in .pythonlibs. Thanks @blast-hardcheese for this!

What changed

  1. Use unstable channel for Python 3.10 and 3.11, but not 3.8.
  2. Updated pip to use stock pip, plus site customization
  3. set break-system-packages = yes to silence this error

Test plan

  1. create a Python Repl
  2. pip install gunicorn
  3. cat .pythonlibs/bin/gunicorn see that the shebang line starts with #!/usr/bin/env python3
  4. make sure template tests (in particular pip and poetry tests) pass

@airportyh airportyh requested a review from a team as a code owner February 29, 2024 21:33
@airportyh airportyh requested review from blast-hardcheese and ryantm and removed request for a team February 29, 2024 21:33
@airportyh airportyh force-pushed the th-update-python-channel-3 branch 2 times, most recently from d8011fd to 37d9b80 Compare February 29, 2024 21:41
@airportyh
Copy link
Collaborator Author

@blast-hardcheese I think we should expose PIP_CONFIG_FILE var to the repl so that an upgraded pip will have break-system-packages = yes set as well.

@airportyh airportyh force-pushed the th-update-python-channel-3 branch from 0ae8bf9 to 9a725e0 Compare February 29, 2024 21:53
@airportyh
Copy link
Collaborator Author

@blast-hardcheese I think we want to make the script not break if for some reason pip was not available on PYTHONPATH.

@airportyh
Copy link
Collaborator Author

I can't find a way to break it by setting the PYTHONPATH though, so it ok.

@ryantm
Copy link
Collaborator

ryantm commented Feb 29, 2024

I'm concerned about the test plan here, because it already does what the test plan says without this change.

@blast-hardcheese
Copy link
Contributor

@ryantm That won't be true in the upgraded nixmodules -- that is the case today, and our goal is to effectively have a noop through this upgrade

@blast-hardcheese
Copy link
Contributor

@airportyh if pip is on PATH but pip is not in PYTHONPATH then pip is broken anyway

@blast-hardcheese blast-hardcheese force-pushed the th-update-python-channel-3 branch from 9a725e0 to 2250a9a Compare February 29, 2024 23:37
@airportyh airportyh merged commit d46140e into main Mar 1, 2024
@airportyh airportyh deleted the th-update-python-channel-3 branch March 1, 2024 14:49
This was referenced Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments