diff --git a/Aliases/ipython@7 b/Aliases/ipython@8 similarity index 100% rename from Aliases/ipython@7 rename to Aliases/ipython@8 diff --git a/Formula/ipython.rb b/Formula/ipython.rb index ac9fe413de5..1c462f354e7 100644 --- a/Formula/ipython.rb +++ b/Formula/ipython.rb @@ -3,8 +3,8 @@ class Ipython < Formula desc "Interactive computing in Python" homepage "https://ipython.org/" - url "https://files.pythonhosted.org/packages/e3/57/ba3d99b9f23584ce28dd190c277bc7ab2faccf6cd2a20f2d9e3c45ff7480/ipython-7.31.0.tar.gz" - sha256 "346c74db7312c41fa566d3be45d2e759a528dcc2994fe48aac1a03a70cd668a3" + url "https://files.pythonhosted.org/packages/c2/4f/67e0c9ab885a5ba54b6dfe5f630df70b73a2de5ef04c402e0691c1936273/ipython-8.0.1.tar.gz" + sha256 "ab564d4521ea8ceaac26c3a2c6e5ddbca15c8848fd5a5cc325f960da88d42974" license "BSD-3-Clause" head "https://github.com/ipython/ipython.git", branch: "master" @@ -27,19 +27,34 @@ class Ipython < Formula sha256 "dd83cd4b5b460958838f6eb3000c660b1f9caf2a5b1de4264e941512f603258a" end + resource "asttokens" do + url "https://files.pythonhosted.org/packages/aa/51/59965dead3960a97358f289c7c11ebc1f6c5d28710fab5d421000fe60353/asttokens-2.0.5.tar.gz" + sha256 "9a54c114f02c7a9480d56550932546a3f1fe71d8a02f1bc7ccd0ee3ee35cf4d5" + end + resource "backcall" do url "https://files.pythonhosted.org/packages/a2/40/764a663805d84deee23043e1426a9175567db89c8b3287b5c2ad9f71aa93/backcall-0.2.0.tar.gz" sha256 "5cbdbf27be5e7cfadb448baf0aa95508f91f2bbc6c6437cd9cd06e2a4c215e1e" end + resource "black" do + url "https://files.pythonhosted.org/packages/f7/60/7a9775dc1b81a572eb26836c7e77c92bf454ada00693af4b2d2f2614971a/black-21.12b0.tar.gz" + sha256 "77b80f693a569e2e527958459634f18df9b0ba2625ba4e0c2d5da5be42e6f2b3" + end + + resource "click" do + url "https://files.pythonhosted.org/packages/f4/09/ad003f1e3428017d1c3da4ccc9547591703ffea548626f47ec74509c5824/click-8.0.3.tar.gz" + sha256 "410e932b050f5eed773c4cda94de75971c89cdb3155a72a0831139a79e5ecb5b" + end + resource "debugpy" do url "https://files.pythonhosted.org/packages/68/8a/aba73af65eb84e0c61c658d2aa2f2a9b4d2939a7f87294dd396f4987efac/debugpy-1.5.1.zip" sha256 "d2b09e91fbd1efa4f4fda121d49af89501beda50c18ed7499712c71a4bf3452e" end resource "decorator" do - url "https://files.pythonhosted.org/packages/92/3c/34f8448b61809968052882b830f7d8d9a8e1c07048f70deb039ae599f73c/decorator-5.1.0.tar.gz" - sha256 "e59913af105b9860aa2c8d3272d9de5a56a4e608db9a2f167a8480b323d529a7" + url "https://files.pythonhosted.org/packages/66/0c/8d907af351aa16b42caae42f9d6aa37b900c67308052d10fdce809f8d952/decorator-5.1.1.tar.gz" + sha256 "637996211036b6385ef91435e4fae22989472f9d571faba8927ba8253acbc330" end resource "entrypoints" do @@ -47,9 +62,14 @@ class Ipython < Formula sha256 "c70dd71abe5a8c85e55e12c19bd91ccfeec11a6e99044204511f9ed547d48451" end + resource "executing" do + url "https://files.pythonhosted.org/packages/ca/e4/efb182548f9931b36b76fd9ba2236bfc5e6d342c905beff92e868afb5b5c/executing-0.8.2.tar.gz" + sha256 "c23bf42e9a7b9b212f185b1b2c3c91feb895963378887bb10e64a2e612ec0023" + end + resource "ipykernel" do - url "https://files.pythonhosted.org/packages/dd/e7/62d8b675ab84460f27427524232239a23842379df33fb994f8cb4cf52a00/ipykernel-6.6.1.tar.gz" - sha256 "91ff0058b45660aad4a68088041059c0d378cd53fc8aff60e5abc91bcc049353" + url "https://files.pythonhosted.org/packages/f5/e9/fb451fa1c2439c8ad3670cc341b7837f2a8a7749de45720bf735f9c74666/ipykernel-6.7.0.tar.gz" + sha256 "d82b904fdc2fd8c7b1fbe0fa481c68a11b4cd4c8ef07e6517da1f10cc3114d24" end resource "jedi" do @@ -58,8 +78,8 @@ class Ipython < Formula end resource "jupyter-client" do - url "https://files.pythonhosted.org/packages/47/e3/192086e7b150f1fd549115190c3525a115e86b9227d6853f7ddcb07d7dc1/jupyter_client-7.1.0.tar.gz" - sha256 "a5f995a73cffb314ed262713ae6dfce53c6b8216cea9f332071b8ff44a6e1654" + url "https://files.pythonhosted.org/packages/6d/e4/669b78fa5905325f5ef4def0ee17a70729246b24f28de832926bb9bfcbb1/jupyter_client-7.1.1.tar.gz" + sha256 "540ca35e57e83c5ece81abd9b781a57cba39a37c60a2a30c8c1b2f6663544343" end resource "jupyter-core" do @@ -72,6 +92,11 @@ class Ipython < Formula sha256 "a04bfba22e0d1395479f866853ec1ee28eea1485c1d69a6faf00dc3e24ff34ee" end + resource "mypy-extensions" do + url "https://files.pythonhosted.org/packages/63/60/0582ce2eaced55f65a4406fc97beba256de4b7a95a0034c6576458c6519f/mypy_extensions-0.4.3.tar.gz" + sha256 "2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8" + end + resource "nest-asyncio" do url "https://files.pythonhosted.org/packages/60/51/b74def9b027b864d1d9b22dfffec4ddd83f9c15f757a5a4a412566f27670/nest_asyncio-1.5.4.tar.gz" sha256 "f969f6013a16fadb4adcf09d11a68a4f617c6049d7af7ac2c676110169a63abd" @@ -82,6 +107,11 @@ class Ipython < Formula sha256 "8c07be290bb59f03588915921e29e8a50002acaf2cdc5fa0e0114f91709fafa0" end + resource "pathspec" do + url "https://files.pythonhosted.org/packages/f6/33/436c5cb94e9f8902e59d1d544eb298b83c84b9ec37b5b769c5a0ad6edb19/pathspec-0.9.0.tar.gz" + sha256 "e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1" + end + resource "pexpect" do url "https://files.pythonhosted.org/packages/e5/9b/ff402e0e930e70467a7178abb7c128709a30dfb22d8777c043e501bc1b10/pexpect-4.8.0.tar.gz" sha256 "fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c" @@ -92,6 +122,11 @@ class Ipython < Formula sha256 "87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca" end + resource "platformdirs" do + url "https://files.pythonhosted.org/packages/be/00/bd080024010e1652de653bd61181e2dfdbef5fa73bfd32fec4c808991c31/platformdirs-2.4.1.tar.gz" + sha256 "440633ddfebcc36264232365d7840a970e75e1018d15b4327d11f91909045fda" + end + resource "prompt-toolkit" do url "https://files.pythonhosted.org/packages/15/e4/f138d6319c02a6052a590ef32e94366b74581973b43665c2960b07b9ec24/prompt_toolkit-3.0.24.tar.gz" sha256 "1bb05628c7d87b645974a1bad3f17612be0c29fa39af9f7688030163f680bad6" @@ -102,9 +137,14 @@ class Ipython < Formula sha256 "5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220" end + resource "pure-eval" do + url "https://files.pythonhosted.org/packages/0d/44/5cedbf05cce044385eec8f88777325259610963abbeb3c1e80f93741d17a/pure_eval-0.2.1.tar.gz" + sha256 "0f04483b16c9429532d2c0ddc96e2b3bb6b2dc37a2bfb0e986248dbfd0b78873" + end + resource "Pygments" do - url "https://files.pythonhosted.org/packages/15/53/5345177cafa79a49e02c27102019a01ef1682ab170d2138deca47a4c8924/Pygments-2.11.1.tar.gz" - sha256 "59b895e326f0fb0d733fd28c6839bd18ad0687ba20efc26d4277fd1d30b971f4" + url "https://files.pythonhosted.org/packages/94/9c/cb656d06950268155f46d4f6ce25d7ffc51a0da47eadf1b164bbf23b718b/Pygments-2.11.2.tar.gz" + sha256 "4e426f72023d88d03b2fa258de560726ce890ff3b630f88c21cbb8b2503b8c6a" end resource "python-dateutil" do @@ -117,6 +157,16 @@ class Ipython < Formula sha256 "8eddc033e716f8c91c6a2112f0a8ebc5e00532b4a6ae1eb0ccc48e027f9c671c" end + resource "stack-data" do + url "https://files.pythonhosted.org/packages/61/11/a8cb5cad5329f2ba10a8efd5cd94d06de70caed235787665ce582381aa30/stack_data-0.1.4.tar.gz" + sha256 "7769ed2482ce0030e00175dd1bf4ef1e873603b6ab61cd3da443b410e64e9477" + end + + resource "tomli" do + url "https://files.pythonhosted.org/packages/fb/2e/d0a8276b0cf9b9e34fd0660c330acc59656f53bb2209adc75af863a3582d/tomli-1.2.3.tar.gz" + sha256 "05b6166bff487dc068d322585c7ea4ef78deed501cc124060e0f238e89a9231f" + end + resource "tornado" do url "https://files.pythonhosted.org/packages/cf/44/cc9590db23758ee7906d40cacff06c02a21c2a6166602e095a56cbf2f6f6/tornado-6.1.tar.gz" sha256 "33c6e81d7bd55b468d2e793517c909b139960b6c790a60b7991b9b6b76fb9791" @@ -127,57 +177,43 @@ class Ipython < Formula sha256 "059f456c5a7c1c82b98c2e8c799f39c9b8128f6d0d46941ee118daace9eb70c7" end + resource "typing-extensions" do + url "https://files.pythonhosted.org/packages/0d/4a/60ba3706797b878016f16edc5fbaf1e222109e38d0fa4d7d9312cb53f8dd/typing_extensions-4.0.1.tar.gz" + sha256 "4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e" + end + resource "wcwidth" do url "https://files.pythonhosted.org/packages/89/38/459b727c381504f361832b9e5ace19966de1a235d73cdbdea91c771a1155/wcwidth-0.2.5.tar.gz" sha256 "c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83" end def install - xy = Language::Python.major_minor_version Formula["python@3.10"].opt_bin/"python3" - ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python#{xy}/site-packages" + venv = virtualenv_create(libexec, "python3") + res = resources.reject { |r| r.name == "appnope" && OS.linux? } + venv.pip_install res + venv.pip_install_and_link buildpath - # install other resources - ipykernel = resource("ipykernel") - res = resources - [ipykernel] - res -= [resource("appnope")] if OS.linux? - res.each do |r| - r.stage do - system Formula["python@3.10"].opt_bin/"python3", *Language::Python.setup_install_args(libexec/"vendor") - end - end - - # install and link IPython - ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python#{xy}/site-packages" - system Formula["python@3.10"].opt_bin/"python3", *Language::Python.setup_install_args(libexec) - bin.install libexec/"bin/ipython" - bin.env_script_all_files(libexec/"bin", PYTHONPATH: ENV["PYTHONPATH"] + "${PYTHONPATH:+:}$PYTHONPATH") - - # install IPython man page + # Install man page man1.install libexec/"share/man/man1/ipython.1" - # install IPyKernel - ipykernel.stage do - system Formula["python@3.10"].opt_bin/"python3", *Language::Python.setup_install_args(libexec/"vendor") + # Enable the kernel to be shared across envs (see also `post_install`) + # https://ipython.readthedocs.io/en/stable/install/kernel_install.html#kernels-for-different-environments + ENV.prepend_create_path "PYTHONPATH", libexec/Language::Python.site_packages("python3") + Dir.mktmpdir do |tmpdir| + system libexec/"bin/ipython", "kernel", "install", "--prefix", tmpdir + (share/"jupyter/kernels/python3").install Dir["#{tmpdir}/share/jupyter/kernels/python3/*"] end - - # install kernel - kernel_dir = Dir.mktmpdir - system libexec/"bin/ipython", "kernel", "install", "--prefix", kernel_dir - (share/"jupyter/kernels/python3").install Dir["#{kernel_dir}/share/jupyter/kernels/python3/*"] inreplace share/"jupyter/kernels/python3/kernel.json", "]", <<~EOS ], "env": { "PYTHONPATH": "#{ENV["PYTHONPATH"]}" } EOS - - pydevd_vendor_dir = libexec/"vendor"/Language::Python.site_packages("python3")/"debugpy/_vendored/pydevd" - pydevd_vendor_dir.rmtree # remove pre-built binaries end def post_install rm_rf etc/"jupyter/kernels/python3" - (etc/"jupyter/kernels/python3").install Dir[share/"jupyter/kernels/python3/*"] + (etc/"jupyter/kernels").install_symlink share/"jupyter/kernels/python3" end test do