Skip to content

Instantly share code, notes, and snippets.

@ColdGrub1384
Last active June 2, 2020 02:51
Show Gist options
  • Select an option

  • Save ColdGrub1384/ade6aa4ab9af8b259bcc67307735f64b to your computer and use it in GitHub Desktop.

Select an option

Save ColdGrub1384/ade6aa4ab9af8b259bcc67307735f64b to your computer and use it in GitHub Desktop.

Revisions

  1. ColdGrub1384 revised this gist Jun 2, 2020. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -31,16 +31,13 @@
    runner = """'''???'''
    import warnings
    import code
    import console
    def start(banner=None, readfunc=None, local=None, exitmsg=None):
    with warnings.catch_warnings(record=True) as w:
    from IPython import start_ipython
    start_ipython()
    code.interact = start
    console.interact = start
    if __name__ == "__main__":
    start()
  2. ColdGrub1384 revised this gist Jun 2, 2020. No changes.
  3. ColdGrub1384 revised this gist Nov 28, 2019. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -17,6 +17,13 @@
    except:
    pass

    # Install ptyprocess

    try:
    pip(["install", "ptyprocess"])
    except:
    pass

    if not os.path.exists(_bin):
    os.makedirs(_bin)

  4. ColdGrub1384 revised this gist Nov 28, 2019. 1 changed file with 0 additions and 8 deletions.
    8 changes: 0 additions & 8 deletions install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -11,20 +11,12 @@
    site_packages = os.path.join(docs, "site-packages")
    _bin = os.path.join(docs, "stash_extensions/bin")

    if not os.path.exists(site_packages):
    os.makedirs(site_packages)

    # Install IPython
    try:
    pip(["install", "ipython"])
    except:
    pass

    try:
    pip(["install", "ptyprocess"])
    except:
    pass

    if not os.path.exists(_bin):
    os.makedirs(_bin)

  5. ColdGrub1384 revised this gist Nov 26, 2019. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@

    docs = os.path.expanduser("~/Documents")
    site_packages = os.path.join(docs, "site-packages")
    bin = os.path.join(docs, "stash_extensions/bin")
    _bin = os.path.join(docs, "stash_extensions/bin")

    if not os.path.exists(site_packages):
    os.makedirs(site_packages)
    @@ -25,8 +25,8 @@
    except:
    pass

    if not os.path.exists(bin):
    os.makedirs(bin)
    if not os.path.exists(_bin):
    os.makedirs(_bin)

    # Disable SyntaxWarning
    runner = """'''???'''
    @@ -48,10 +48,10 @@ def start(banner=None, readfunc=None, local=None, exitmsg=None):
    """

    with open(os.path.join(bin, "ipython.py"), 'w') as f:
    with open(os.path.join(_bin, "ipython.py"), 'w') as f:
    f.write(runner)

    with open(os.path.join(bin, "ipython3.py"), 'w') as f:
    with open(os.path.join(_bin, "ipython3.py"), 'w') as f:
    f.write(runner)

    print("")
  6. ColdGrub1384 revised this gist Nov 26, 2019. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,13 @@
    from pip import main as pip
    import os.path

    docs = os.path.expanduser("~/Documents")
    site_packages = os.path.join(docs, "site-packages")
    bin = os.path.join(docs, "stash_extensions/bin")

    if not os.path.exists(site_packages):
    os.makedirs(site_packages)

    # Install IPython
    try:
    pip(["install", "ipython"])
  7. ColdGrub1384 revised this gist Nov 26, 2019. 1 changed file with 4 additions and 20 deletions.
    24 changes: 4 additions & 20 deletions install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -5,32 +5,16 @@
    """

    from pip import main as pip
    from wget import main as wget
    from unzip import main as unzip
    import shutil
    import os.path

    docs = os.path.expanduser("~/Documents")
    site_packages = os.path.join(docs, "site-packages")
    bin = os.path.join(docs, "stash_extensions/bin")

    if not os.path.exists(site_packages):
    os.makedirs(site_packages)

    # Install 'ptyprocess', fails with pip
    ptyprocess_zip = os.path.join(docs, "ptyprocess.zip")
    ptyprocess_unzipped = os.path.join(docs, "ptyprocess-master")
    wget(["https://github.com/pexpect/ptyprocess/archive/master.zip", "--output-file", ptyprocess_zip])
    unzip([ptyprocess_zip, "--exdir", ptyprocess_unzipped])
    # Install IPython
    try:
    shutil.move(os.path.join(ptyprocess_unzipped, "ptyprocess"), os.path.join(site_packages, "ptyprocess"))
    shutil.rmtree(ptyprocess_unzipped)
    except shutil.Error:
    pip(["install", "ipython"])
    except:
    pass

    # Install IPython
    try:
    pip(["install", "ipython"])
    pip(["install", "ptyprocess"])
    except:
    pass

  8. ColdGrub1384 revised this gist Nov 26, 2019. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -42,13 +42,15 @@
    import warnings
    import code
    import console
    def start(banner=None, readfunc=None, local=None, exitmsg=None):
    with warnings.catch_warnings(record=True) as w:
    from IPython import start_ipython
    start_ipython()
    code.interact = start()
    code.interact = start
    console.interact = start
    if __name__ == "__main__":
    start()
  9. ColdGrub1384 revised this gist Nov 26, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@
    import warnings
    import code
    def start(banner=None, readfunc=None, local=None, exitmsg=None)
    def start(banner=None, readfunc=None, local=None, exitmsg=None):
    with warnings.catch_warnings(record=True) as w:
    from IPython import start_ipython
    start_ipython()
  10. ColdGrub1384 revised this gist Nov 22, 2019. 1 changed file with 9 additions and 5 deletions.
    14 changes: 9 additions & 5 deletions install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -43,13 +43,17 @@
    import warnings
    import code
    with warnings.catch_warnings(record=True) as w:
    from IPython import start_ipython
    def start(banner=None, readfunc=None, local=None, exitmsg=None)
    with warnings.catch_warnings(record=True) as w:
    from IPython import start_ipython
    start_ipython()
    code.interact = start_ipython
    code.interact = start()
    if __name__ == "__main__":
    start_ipython()"""
    if __name__ == "__main__":
    start()
    """

    with open(os.path.join(bin, "ipython.py"), 'w') as f:
    f.write(runner)
  11. ColdGrub1384 revised this gist Nov 19, 2019. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -55,4 +55,7 @@
    f.write(runner)

    with open(os.path.join(bin, "ipython3.py"), 'w') as f:
    f.write(runner)
    f.write(runner)

    print("")
    print("Restart Pyto to launch IPython shell. IPython can be executed from the script in ~/Documents/stash_extensions/bin/ipython.py, from the 'Run module' section or just by importing it.")
  12. ColdGrub1384 revised this gist Nov 19, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@
    # Install IPython
    try:
    pip(["install", "ipython"])
    except SystemExit:
    except:
    pass

    if not os.path.exists(bin):
  13. ColdGrub1384 revised this gist Nov 19, 2019. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    """
    Installs IPython on Pyto.
    Usage: import requests as r; exec(r.get('https://bit.ly/35iSbM1').content.decode())
    Usage: Usage: import requests as r; exec(r.get('https://bit.ly/35iSbM1').content.decode())
    """

    from pip import main as pip
    @@ -29,7 +29,10 @@
    pass

    # Install IPython
    pip(["install", "ipython"])
    try:
    pip(["install", "ipython"])
    except SystemExit:
    pass

    if not os.path.exists(bin):
    os.makedirs(bin)
  14. ColdGrub1384 revised this gist Nov 19, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    """
    Installs IPython on Pyto.
    Usage: import requests as r; exec(r.get('https://bit.ly/2O25drz').content.decode())
    Usage: import requests as r; exec(r.get('https://bit.ly/35iSbM1').content.decode())
    """

    from pip import main as pip
  15. ColdGrub1384 revised this gist Nov 19, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    """
    Installs IPython on Pyto.
    Usage: import requests as r; exec(r.get('https://bit.ly/2O25drz')
    Usage: import requests as r; exec(r.get('https://bit.ly/2O25drz').content.decode())
    """

    from pip import main as pip
  16. ColdGrub1384 revised this gist Nov 19, 2019. 1 changed file with 6 additions and 3 deletions.
    9 changes: 6 additions & 3 deletions install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    """
    Installs IPython on Pyto.
    Usage: import requests as r; exec(r.get('https://bit.ly/2O25drz').content.decode())
    Usage: import requests as r; exec(r.get('https://bit.ly/2O25drz')
    """

    from pip import main as pip
    @@ -22,8 +22,11 @@
    ptyprocess_unzipped = os.path.join(docs, "ptyprocess-master")
    wget(["https://github.com/pexpect/ptyprocess/archive/master.zip", "--output-file", ptyprocess_zip])
    unzip([ptyprocess_zip, "--exdir", ptyprocess_unzipped])
    shutil.move(os.path.join(ptyprocess_unzipped, "ptyprocess"), os.path.join(site_packages, "ptyprocess"))
    shutil.rmtree(ptyprocess_unzipped)
    try:
    shutil.move(os.path.join(ptyprocess_unzipped, "ptyprocess"), os.path.join(site_packages, "ptyprocess"))
    shutil.rmtree(ptyprocess_unzipped)
    except shutil.Error:
    pass

    # Install IPython
    pip(["install", "ipython"])
  17. ColdGrub1384 revised this gist Nov 19, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    """
    Installs IPython on Pyto.
    Usage: import requests as r; exec(r.get('https://bit.ly/2O25drz'))
    Usage: import requests as r; exec(r.get('https://bit.ly/2O25drz').content.decode())
    """

    from pip import main as pip
  18. ColdGrub1384 revised this gist Nov 19, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    """
    Installs IPython on Pyto.
    Usage: import requests as r; exec(r.get('https://bit.ly/2O25drz')
    Usage: import requests as r; exec(r.get('https://bit.ly/2O25drz'))
    """

    from pip import main as pip
  19. ColdGrub1384 revised this gist Nov 19, 2019. 1 changed file with 27 additions and 1 deletion.
    28 changes: 27 additions & 1 deletion install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    """
    Installs IPython on Pyto.
    Usage: import requests as r; exec(r.get('https://bit.ly/2O25drz')
    """

    from pip import main as pip
    @@ -10,6 +12,7 @@

    docs = os.path.expanduser("~/Documents")
    site_packages = os.path.join(docs, "site-packages")
    bin = os.path.join(docs, "stash_extensions/bin")

    if not os.path.exists(site_packages):
    os.makedirs(site_packages)
    @@ -23,4 +26,27 @@
    shutil.rmtree(ptyprocess_unzipped)

    # Install IPython
    pip(["install", "ipython"])
    pip(["install", "ipython"])

    if not os.path.exists(bin):
    os.makedirs(bin)

    # Disable SyntaxWarning
    runner = """'''???'''
    import warnings
    import code
    with warnings.catch_warnings(record=True) as w:
    from IPython import start_ipython
    code.interact = start_ipython
    if __name__ == "__main__":
    start_ipython()"""

    with open(os.path.join(bin, "ipython.py"), 'w') as f:
    f.write(runner)

    with open(os.path.join(bin, "ipython3.py"), 'w') as f:
    f.write(runner)
  20. ColdGrub1384 created this gist Nov 18, 2019.
    26 changes: 26 additions & 0 deletions install_ipython.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    """
    Installs IPython on Pyto.
    """

    from pip import main as pip
    from wget import main as wget
    from unzip import main as unzip
    import shutil
    import os.path

    docs = os.path.expanduser("~/Documents")
    site_packages = os.path.join(docs, "site-packages")

    if not os.path.exists(site_packages):
    os.makedirs(site_packages)

    # Install 'ptyprocess', fails with pip
    ptyprocess_zip = os.path.join(docs, "ptyprocess.zip")
    ptyprocess_unzipped = os.path.join(docs, "ptyprocess-master")
    wget(["https://github.com/pexpect/ptyprocess/archive/master.zip", "--output-file", ptyprocess_zip])
    unzip([ptyprocess_zip, "--exdir", ptyprocess_unzipped])
    shutil.move(os.path.join(ptyprocess_unzipped, "ptyprocess"), os.path.join(site_packages, "ptyprocess"))
    shutil.rmtree(ptyprocess_unzipped)

    # Install IPython
    pip(["install", "ipython"])