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

Use custom pip #13

Merged
merged 2 commits into from
Jul 31, 2023
Merged

Use custom pip #13

merged 2 commits into from
Jul 31, 2023

Conversation

airportyh
Copy link
Collaborator

@airportyh airportyh commented Jul 31, 2023

Why?

  1. The 1.5 line of poetry does without pip by default (it uses installer package instead). We still need to use pip if we are to leverage the functionality of our customized version of pip. This can be switched off by setting POETRY_INSTALLER_MODERN_INSTALLATION to 0. However,
  2. When it does use pip, it does not call it in a way that can use our customized pip. It:
    • uses the python -m pip syntax, which requires the pip library to be in PYTHONPATH
    • uses its own embedded version of pip
    • it passes the --prefix parameter to pip, setting it to the system path, which for us is non-writable and conflicts with the user mode installation

I have considered making these changes based on 1 or 2 configuration flags so they can be upstreamed easier, but I am holding off because that would require a larger change (requiring various functions and their call sites to add a config parameter). I'll try to make this change in their current line (1.6 alpha) in the future.

Changes

  1. changed the pip command to simply ["pip"] if POETRY_PIP_FROM_PATH env var is set to "1"
  2. removed the --prefix arg when calling pip if POETRY_PIP_NO_PREFIX is set to "1"

@airportyh airportyh requested review from a team and masad-frost and removed request for a team July 31, 2023 15:50
@airportyh airportyh changed the title Th use custom pip Use custom pip Jul 31, 2023
Copy link
Collaborator

@ryantm ryantm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@airportyh
Copy link
Collaborator Author

I've put the new behavior behind env var flags so that:

  • ci can pass
  • we do not change poetry's behavior unless we opt in to them

@airportyh airportyh requested a review from ryantm July 31, 2023 17:43
@@ -5,3 +5,4 @@ channel = "stable-22_11"

[env]
PYTHONPATH = "$PYTHONPATH:$REPL_HOME/src"
POETRY_INSTALLER_MODERN_INSTALLATION = "0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you still need this now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's convient for testing. In fact I'll add the 2 new ones...

@airportyh airportyh merged commit e3fd7b8 into replit-1.5 Jul 31, 2023
15 checks passed
@ryantm ryantm deleted the th-use-custom-pip branch July 31, 2023 19:53
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.

2 participants