-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
poetry: migrate to [email protected] #86776
Conversation
I think this is expecting
|
Because this is not hardcoded in the shabang, it can't use python 3.10 until |
We can use |
I thought the point of removing the exact homebrew python version was so that people could use homebrew poetry with whatever Python version they had set as python3, not tying it to homebrew python. (Didn't read the issue that carefully, and seemed a little silly to me to use homebrew poetry with non-homebrew python, but not strongly opinionated here) (Guessing this would replace python3 with the full path again, though correct me if I'm wrong) |
I think the idea was to be able to use Homebrew Poetry with Homebrew Python 3.7 or 3.8. I don't think we want to rewrite the shebang here. Things we could do:
(1) might take a while. (2) means extra setup for some users, but that seems better than a crippled installation. |
(2) would mean "brew install poetry" on a fresh installation would install Python 3.10 and poetry with python3, which wouldn't trigger Python 3.9, which means no |
It seems to work on Catalina and Wrap the |
I expect Catalina and Mojave have |
If poetry can be pointed at different pythons, doesn't that apply to python 3.10 too? so if we leave it pointing at python3, we need to keep requiring the package that provides python3 ([email protected]), but users can use 3.10 just like they can use 3.7 and 3.8? |
Sorry, I meant Catalina and Big Sur, not Mojave. I thought that Mojave had |
Yes. I'm not sure our mixed-version-dependency audit understands this, though, which is an issue for formulae that use |
Also, simplify the formula's style a little.
Pushed a fix. Added a label to build dependents from source to make sure this didn't break anything. |
Looks like python 3.5 is trying to run it on Ubuntu? |
Ah, yes. That's expected, since Python 3.5 will come before Python 3.10 in
2 and 4 probably cause the least pain for users, 2 is probably easiest for us, depending on how keen we are to get this running on Python3.10. [*] This change would make this problem worse, because users who currently have an old Python3 after |
Given the feature of being unpinned from a Python version that is causing the problem allows a user to use Python 3.10 already, I'd think option 2 isn't that bad. I'm not against option 1, personally, either, as I see homebrew as only supporting the latest version, and older versions are only there as a workaround due to some packages not supporting newer versions yet. But it's okay with me if people need something different. |
1d8eee0 884d475 Poetry has a new install script, install-poetry.py, which alters the requirements for adding Poetry to `$PATH`. `$HOME/.local/bin` was already on `$PATH` for pipx, so it seemed like a good option. Commits 1d8eee0 and 884d475 updated `.zshrc` and `script/strap-after-setup` for install-poetry.py and `POETRY_HOME=$HOME/.local`. This made sense initially, because Poetry installs its binaries into `$POETRY_HOME/bin`, and because Poetry doesn't have a `$POETRY_BIN_DIR` configuration variable like pipx does (`$PIPX_BIN_DIR`). Unfortunately, `POETRY_HOME=$HOME/.local` ended up being problematic, because Poetry takes over `$POETRY_HOME`, and doesn't consider other applications installed there. For example, if the get-poetry.py or install-poetry.py scripts were used to install Poetry, they can also be used to uninstall Poetry. Uninstalling with `python install-poetry.py --uninstall` or `python get-poetry.py --uninstall` deletes the entire `$POETRY_HOME` directory, which means it deletes `$HOME/.local`, causing problems for other applications that use `$HOME/.local` (python-poetry/poetry#4625). There have been many other issues with the Poetry custom install scripts get-poetry.py and install-poetry.py (br3ndonland/inboard#36), so other installation methods are be welcome. Poetry is now available through Homebrew, but Homebrew installation is not supported by the Poetry maintainers. Homebrew installation also requires its own custom install script, which creates its own issues. python-poetry/poetry#941 python-poetry/poetry#1765 Homebrew/homebrew-core#48883 Homebrew/homebrew-core#86776 pipx (https://pypa.github.io/pipx/) can also be used to install Poetry. The pipx installation method is suggested in the Poetry docs and GitHub, and pipx is already in use in this repo. python-poetry/poetry#677 python-poetry/poetry#3360 This commit will remove `export POETRY_HOME=$HOME/.local` from `.zshrc`, and will install Poetry with pipx.
4 would look something like: diff --git a/Formula/poetry.rb b/Formula/poetry.rb
index ae859e2d30f..81507a945d0 100644
--- a/Formula/poetry.rb
+++ b/Formula/poetry.rb
@@ -204,6 +204,7 @@ class Poetry < Formula
# We don't hardcode Homebrew Python here on purpose. See
# https://github.com/Homebrew/homebrew-core/issues/62910
+ python310 = Formula["[email protected]"].opt_bin/"python3"
(libexec/"bin/poetry").atomic_write <<~PYTHON
#!/usr/bin/env python3
import sys
@@ -211,6 +212,10 @@ class Poetry < Formula
sys.path.insert(0, "#{site_packages}")
sys.path.insert(0, "#{vendor_site_packages}")
+ if sys.version_info[:2] < (3, 6):
+ import os
+ os.execv("#{python310}", ("#{python310}",) + tuple(sys.argv))
+
if __name__ == "__main__":
from poetry.console import main
main() |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
poetry: migrate to [email protected]