IDE Python other

By pjain      Published Dec. 9, 2019, 6:18 a.m. in blog Programming   

Python IDEs

Python 2x,5x,10x Setup & REPL

  • Install it - should be already there on ubuntu, mac osx $ python --version

  • REPL interpreter python to start it, exit() or ^Z to exit

  • just run $IDLE to start up a Python interpreter

    help(map) dir(map) #methods map.doc quit() `

    Mac OSX pains

https://www.davidculley.com/installing-python-on-a-mac/ https://matplotlib.org/faq/osx_framework.html https://www.macobserver.com/tmo/article/how-to-upgrade-your-mac-to-python-3

r IDEs

http://wiki.python.org/moin/PythonEditors
http://wiki.python.org/moin/IntegratedDevelopmentEnvironments

This focusses on free & cross platform IDEs

Python IDE: The10 Best IDEs for Python Programmers (1) What is the best IDE for Python? - Quora best python ide for data science - Google Search (1) What's the best Python IDE for data analysis/science? - Quora Kaggle: Your Home for Data Science Python IDE for Data Analysis - Stack Overflow (1) What is the best Python IDE for doing data analysis/science and ML on Macs? - Quora

Online REPL

CodeSkulptor CodeSkulptor repl.it - Python3 Compiler

iPython

can't set breakpoints -Launching a Python console programatically: you have to stop your code, insert an extra line of code, and run again from the beginning to do this. Plus, you can't access functions already imported without re-importing them.

Spyder

has good integration with scientific tools, but its debugging is limited to the built-in pdb, which lacks the requirement to execute any code and have this code affect the namespace after continuing.

  • Python(x,y) Python(x,y) is a free scientific and engineering development software for numerical computations, data analysis and data visualization based on Python programming language, Qt graphical user interfaces and Spyder interactive scientific development environment.

It will not cater to all your wishes, but it certainly made me feel comfortable when I started out with Python, coming from Matlab.

Python(x,y) uses Spyder, which relies on the simple pdb debugger, thereby not satisfying the ability to run any code wish. The pdb environment differs from the ordinary python/ipython environment.

Interpreter

Start

  • python to start it, exit() or ^Z to exit

Python Interpreter Usage

  • Do a quick run! cd c:\python c:\python>python >>>print "Hello, there" Hello, there >>>exit() c:\python>

The >>> is Python way of telling you that you are in interactive mode. In interactive mode what you type is immediately run. Try typing 1+1 in. Python will respond with 2. Interactive mode allows you to test out and see what Python will do. If you ever feel you need to play with new Python statements go into interactive mode and try them out.

  • Start c:\python\python Python 2.4.2 (#2, Sep 30 2005, 21:19:01) [GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>

  • Note that path should include e.g. c:\python\ in it .. path=%path%;c:\python\;

  • End >>> exit() >>> quit() >>> import sys; sys.exit()

    ^Z - on windows ^D - on unix & macosx

  • Continuation Lines >>> the_world_is_flat = True >>> if the_world_is_flat: ... print "hello world! ... hello world!

  • The last expression is assigned to variable _

  • Running external .py files - if you save the "print "Hellow World" in a file say hellow.py, then you can run it at the OS prompt. (Note python accepts a command line argument as well!)

    python < hellow.py

    python hellow.py

IDLE Apple default ~2.6?

  • PKJ

In the stock Mac OS X python installation, idle is found in /usr/bin, which is not (easily) accessible from Finder and not indexed by Spotlight. The quickest option is to open the Terminal utility and type 'idle' at the prompt. $ which idle /usr/local/bin/idle

$ idle # or python -m idlelib.idle

File, click "New File", type your program, Run or Run Module or F5 - results appear in shell window save as xyz.py

Ananconda has no idle installed ..

x Just runs python scripts - need to open them - really no diff than commndline - no debugger .. /Applicaitons/Python3Launcher.app -> maps to interpreter in terminal window /usr/local/bin/pythonw

x if you installed Python using Homebrew, you can run 'brew linkapps' (from the command line); that will place an app for IDLE (among other things) in Launchpad (Applications folder).

  • IDLE etc need latest ActiveTCL 8.6.4 10/27/15 Community

  • FOLLOWING IS BLAH...

Mac OS X 10.8 comes with Python 2.7 pre-installed by Apple. If you wish, you are invited to install the most recent version of Python from the Python website (https://www.python.org). A current “universal binary” build of Python, which runs natively on the Mac’s new Intel and legacy PPC CPU’s, is available there.

What you get after installing is a number of things:

A MacPython 2.7 folder in your Applications folder. In here you find IDLE, the development environment that is a standard part of official Python distributions; PythonLauncher, which handles double-clicking Python scripts from the Finder; and the “Build Applet” tool, which allows you to package Python scripts as standalone applications on your system.
A framework /Library/Frameworks/Python.framework, which includes the Python executable and libraries. The installer adds this location to your shell path. To uninstall MacPython, you can simply remove these three things. A symlink to the Python executable is placed in /usr/local/bin/.

The Apple-provided build of Python is installed in /System/Library/Frameworks/Python.framework and /usr/bin/python, respectively. You should never modify or delete these, as they are Apple-controlled and are used by Apple- or third-party software. Remember that if you choose to install a newer Python version from python.org, you will have two different but functional Python installations on your computer, so it will be important that your paths and usages are consistent with what you want to do.

IDLE includes a help menu that allows you to access Python documentation. If you are completely new to Python you should start reading the tutorial introduction in that document.

If you are familiar with Python on other Unix platforms you should read the section on running Python scripts from the Unix shell.

IDLE

  • IDLE idle is the funny little (python/tk programmed) python “ide” that comes with the official download. - Whatever it is it’s Eastern Bloc ugly compared to the Pythonwin IDE

The official Python windows installer http://www.python.org/download/ ? It seems a little bit pointless to use Activestate’s repackaged version when you could get the official version from the creators in a Windows-friendly format.

Alternatively you might find a shortcut to something called IDLE, or the Python GUI, in your start menus. If you start IDLE instead of the command line version you will get a similar prompt but in a window of its own and with some pretty font colors!

  • Danny Yoo has written a pretty good IDLE Tutorial to get you started with IDLE and I recommend you pay it a visit if you want to stick with it rather than the basic command prompt. It duplicates some of the early material here but repetition of the basics is no bad thing! For now I'd recommend you stick with Danny's tutor. http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html

  • The full manual for IDLE is found here. http://www.python.org/idle/doc/idlemain.html

One interesting thing about IDLE is that it is itself a Python program, so it's a very good demonstration of just what is possible using Python

Python GUI Interpreter (IDLE) Usage

  • You can run the C:\python\Lib\idlelib\idle.bat which basically does ..

    c:\python\pythonw.exe c:\python\Lib\idle.pyw %1 %2 %3 %4 %5 %6 %7 %8 %9

  • Running external .py files - if you save the in a file say hellow.py, then you can run it at the GUI shell prompt.. print "Hellow World"

Running Saved Programs

You can ofcourse also save your program so you can run it again at any time. To run a Python program from a file, pass the ".py" file name to the interpreter, for example:

$ python myprogram.py

Under windows, you can give the file an extension of ".py" or ".pyw" and then you can just double-click on it. The .py will open a console (a black window) where your output (print commands for example) will appear. The ".pyw" extension will not show any output, so you have to build a user-interface yourself.

The Interactive Startup File¶

When you use Python interactively, it is frequently handy to have some standard commands executed every time the interpreter is started. You can do this by setting an environment variable named PYTHONSTARTUP to the name of a file containing your start- up commands. This is similar to the .profile feature of the Unix shells.

This file is only read in interactive sessions, not when Python reads commands from a script, and not when /dev/tty is given as the explicit source of commands (which otherwise behaves like an interactive session). It is executed in the same namespace where interactive commands are executed, so that objects that it defines or imports can be used without qualification in the interactive session. You can also change the prompts sys.ps1 and sys.ps2 in this file.

If you want to read an additional start-up file from the current directory, you can program this in the global start-up file using code like if os.path.isfile('.pythonrc.py'): exec(open('.pythonrc.py').read()). If you want to use the startup file in a script, you must do this explicitly in the script:

import os
filename = os.environ.get('PYTHONSTARTUP')
if filename and os.path.isfile(filename):
    exec(open(filename).read())

SublimeText

Setup ST3 for full stack Python dev

https://realpython.com/blog/python/setting-up-sublime-text-3-for-full-stack-python-development/

Setup ST2

*- Tools — Build System — New Build System (you can verify your cmd, path - which python3)

#For Windows users:
{
    "cmd": ["C:\\python33\\python.exe", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",
    "encoding": "utf8",
    "path": "C:\\Python33\\"
}

# For Mac OS X users:
{
    "cmd": ["/usr/local/bin/python3", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",
    "encoding": "utf8",
    "path": "/usr/local/Frameworks/Python.framework/Versions/3.3/bin/"
}
  • Save new files with .py extensions

  • When you open a new Python file, be sure to select Tools-BuildSytem-Python3 , then you can use Tools-Build to run python within ST2 or ST3.

  • Intepretive build sys .. with console input! package control install SublimeREPL To use it go to Tools>sublimerepl>python from the menus. You can run a script inside tab by >>> execfile("filexyz.py",vars)

Running Py in ST2

  1. Install package SublimeREPL, in window with PY program run C+B Console popsup with output of script there.

Sublime Text3 TIPS for IDE for Python

SublimeREPL

  • Install package SublimeREPL, restart
  • scP - tools pallete SublimeREPL - select language SublimeREPL Python this starts a terminal inside PYthon OR .. Tools>SublimeREPL>Python

  • http://sublimerepl.readthedocs.io/en/latest/

  • SublimeREPL has a built-in support for command history ^ or aP walk prev Command v or aN walk next Command Send current line to REPL - execute command Esc clear line c-L Clear screen sc-C Send SIGINT to REPL KeyboardInterrupt long running .. and return

  • SOURCE BUFFER - USP transferring code from open buffers to the interpreters for evaluation, enabling interactive programming. * Keys Evaluate in REPL: ctrl+,, s Selection ctrl+,, f File ctrl+,, l Lines ctrl+,, b Block

Transfer in REPL (just copy, without evaluating it): ctrl+shift+,, s Selection ctrl+shift+,, f File ctrl+shift+,, l Lines ctrl+shift+,, b Block Note: ctrl+,, f means: press Ctrl and Comma, release all, press F.

VEnv in Sublime REPL

Set up Sublime Text for light-weight all-in-one data science IDE – Opiate for the masses how to install SublimeREPL - Google Search SublimeREPL — SublimeREPL 1.0.30 documentation SublimeREPL keybindings - Google Search Better user key bindings for SublimeREPL. how to run virtualenv in sublime repl - Google Search SublimeREPL — SublimeREPL 1.0.30 documentation python - Sublime text3 and virtualenvs - Stack Overflow eval() arg 1 must be a string or code object - Google Search

Debugging in IDE/IDLE

  • The ability to set breakpoints graphically by clicking next to a line of code in the editor."
  • forcing breakpoint (pdb,q) has no graphical breakpoints. When you have to set hundreds of breakpoints, inserting lines of code is a bad way to do it. You also can't insert breakpoints during execution this way.

  • When an error occurs, the debugger should automatically open an interactive console at the error line.

  • Once done with the interactive console, you can resume normal execution.

pdb - launch shell

http://docs.python.org/2/library/pdb.html

  • For someone coming from C/C++, ipdb is a godsend. Simply the best Python debugger the pdb module? It doesn't do everything you ask, but it's still quite powerful.

  • QUIK

    import pdb

    pdb.set_trace() # launches debugger at that point to inspect

You will have an interactive shell thus, whenever the set_trace() statement is met.

You can then use step(s), next(n), continue(c) and so on to check the execution flow, and print values of variables like print var

Open up interactive shell

q module for this easily https://pypi.python.org/pypi/q

xyxy.py

import q do_something() q.d() #this will open interactive shell

def f(): do_something() q.d() #open console here with access to all local variables of f

Eclipse & Python PyDev

  • Eclipse has an excellent pydev extension which allows debugging like in C, Java.
  • The ability to set breakpoints graphically by clicking next to a line of code in the editor.
  • When an error occurs, the debugger should automatically open an interactive console at the error line.

PyDev has this. Double-click in the gray margin bar.

"The ability to run ANY CODE while stopped in t

IIRC, what's missing in PyDev is integration with the scientific tools like IPython and matplotlib. Integration with matplotlib means that if you run plot(a, b), you get your prompt back before closing the plot window. This is quite essential for many interactive scientific applications. But it's been a while since I checked so I might be wrong. –

Pydev Eclipse plugin

  • See Pydev.org for full info

See our doc on Eclipse.pcms

Pydev is a plugin that enables users to use Eclipse for Python and Jython development -- making Eclipse a first class Python IDE -- It comes with many goodies such as code completion, syntax highlighting, syntax analysis, refactor, debug and many others. If you want more details on the provided features, you can check here. http://pydev.sourceforge.net/features.html

Pydev and Pydev Extensions are now products of Aptana, makers of the popular Aptana Studio, Eclipse-based IDE for Ajax, Jaxer, Ruby on Rails, and PHP. You can plug Pydev into Aptana Studio or both into Eclipse and use them side by side. Aptana plans deeper integrations in the future.

Pydev Extensions

is a plugin that works with Pydev, providing many other features such as code-analysis, code completion with auto-import, a much better implementation of go to definition, remote debugging, 'quick-fixes', mark-occurrences, among others.http://www.fabioz.com/pydev

  • eclipse + pydev plugin will be a good choice Why not hint at eclipse with pydev as a python ide? eclipse is also cool to write java, php, cmfl, and to some extent even fortran or c. it’s free and i guess you can set it up in 7 minutes with pydev, assuming you have a fast connection to load pydev from the update site.

  • Even though Pydev is called an extension, it did not penetrate my brain immediately that you install it through the Eclipse menu (the way you install Firefox extensions), so I spent some time looking around the web for installation files.

On linux, I pretty quickly discovered that the Yast installer offered Eclipse from one of the Suse Linux 10.2 repositories. When I got Eclipse installed (which Yast did flawlessly, configuring

KDE properly and making a menu entry under Development>Integrated Environment). On Linux, I didn't see any entries in linux repositories for the Pydev extension.

At this point, I hadn't yet figured out that, in effect, Eclipse is the package manager for Pydev, so I thought about giving up.

  • After installing Eclipse core package first, I was unable to install Pydev from within Eclipse. Eclipse kept saying that the two Pydev extensions needed other things that it couldn't seem to find.

  • So, I went back to Yast and installed everything that mentioned Eclipse. No luck.

  • Tried installing older version of Pydev. Still no luck. Gave up and went to bed.

  • This morning, it worked like a charm. I'm guessing a server may have been temporarily unavailable, but don't really know.

  • Easiest. If you are getting started, I would recommend you python easyeclipse. http://www.easyeclipse.org/site/distributions/python.html

2A. Normal If you just plan on doing Python dev, I'd just go with Classic Eclipse. http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.4.1-200809111700/eclipse-SDK-3.4.1-win32.zip After that, I'd follow the instructions to install PyDev. http://pydev.sourceforge.net/download.html I use this same setup for Python development. I also have the RadRails plugin for Ruby on Rails development.

2B. Pydev can give some incompatibilities when using it together with other extensions. pydev and Python2.6 doesnt work with eclipse for C++. Download the classic version and you should be good.

  1. Hard. I use J2EE Eclipse for Python and Java development. It works well. But Classic Eclipse should be enought.

The PyDev home page is at: http://pydev.sourceforge.net/index.html

PyDev was acquired by Aptana.com, so you might want to check that one out as well.

PyDev Tutorials

  • Marc Abramowitz PyDev tutorial http://marc-abramowitz.com/archives/2005/12/05/pydev-tutorial/&ei=UascSdCdCYmIsAO8pYG9CA&sig2=iT6Tr4_F9k4PnfGorZT7dg&usg=AFQjCNGLsubj6mAaEfO3GHZUwEtdYzmq-w

  • http://www-inst.eecs.berkeley.edu/~cs188/fa06/eclipse.html

  • Plone/Eclipse

  • Setting & developing Plone CMS with Eclipse & plugins http://plone.org/documentation/tutorial/developing-plone-with-eclipse/installing-eclipse&ei=0KYcSdXWMIK2sQPN9NmxCA&sig2=9-4fIhoebgknk6ATI007MA&usg=AFQjCNGMS7yI6Br6FYxlZ6JQj-FCpnlYgw

  • Python-Ogre installer, ... I'm running eclipse and pydev on my development box (one of them http://www.ogre3d.org/phpBB2addons/viewtopic.php%3Ft%3D7780%26sid%3Dce193664e1d3d7c4af509e6f4e2718c6&ei=5aocSYi7EZKasAPbvpC-CA&sig2=P_3qCxc3aneMcYiyb1e6Tw&usg=AFQjCNHh1sUMnO68RKzuDzBsjM4Wbm0n8g

JyDt

  • Tutorial provides a brief description of the JyDT project and how to configure it. Learn to use the PyDev perspective and explorer
  • 7

Emacs

This is just great when it comes to Python programming.

Emacs mode Built Into Python

There's an excellent Emacs editing mode for Python code; see the file Misc/python-mode.el. Originally written by the famous Tim Peters, it is now maintained by the equally famous Barry Warsaw (it's no coincidence that they now both work on the same team). The latest version, along with various other contributed Python-related Emacs goodies, is online at http://www.python.org/emacs/python-mode. And if you are planning to edit the Python C code, please pick up the latest version of CC Mode http://www.python.org/emacs/cc-mode; it contains a "python" style used throughout most of the Python C source files. (Newer versions of Emacs or XEmacs may already come with the latest version of python-mode.)

VIM

I use vim on both Windows XP and Debian, but I used to use Komodo for big projects.

http://www.jeffknupp.com/blog/2013/12/04/my-development-environment-for-python/

Windows IDEs & Win32 GUI Extensions

DOS Mini IDEs

DOS Prompt - The 'standard' way

Windows Mini IDEs

pythonwin

If you downloaded the Windows specific extensions (the winall package), you also have access to another GUI programming environment, very similar to IDLE but perhaps a little more polished, called Pythonwin. Either Pythonwin or IDLE make far better programming environments than the standard DOS prompt, but at the very beginning I prefer to use the most basic tools to focus on the underlying principles rather than the toys.

Official Python.org

Win32

Does the Python.org version include the Mark Hammond Win32 extensions? Don’t they have to be installed separately? I thought this came up once on the Python boards, and people told me they were two separate downloads.

The idea here is to get Python downloaded and installed for the user who is perhaps intimidated by a big shaggy page of versions, bug fixes, and multiple downloads.

If you’d like the Windows Extensions, (eg to add to ActiveState Python IDE) you can download them here:

    http://sourceforge.net/projects/pywin32/
  • I think you can get almost the full effect by just installing Mark Hammond’s Win32 extensions together with your recent Python installation. Here is the site. http://starship.python.net/crew/mhammond/win32/

  • The ActivePython distro just installs BOTH Python and the win32 extensions together in a nice package, but I don’t think it’s worth uninstalling your other installation unless you are having trouble. I believe the ActiveState Python distro also sets up your environment, paths, etc. But you can also do this yourself. I use both ActiveState on one machine and the Python.org distro on others. But then I’ve moved to Linux so I can’t say for sure about the Windows thing. Try just installing the win32 extensions. The gui IDE is very nice compared to the dullish IDLE one.

Pyscripter for Windows

Windows XP

I need a Python IDE and debugger, but have yet to find one as good as Pyscripter for Windows. Can anyone recommend anything? What are you all using?

Coming from a Visual Studio background, editing text files and using the terminal to execute them offends my sensibilities :)

Linux/Ubuntu

Wing IDE Professional

Wingware IDE 101, Ubuntu package at http://wingware.com/downloads. I love it; great for teaching/learning, built-in shell, run programs from within the environment.

www.wingware.com

Webmin x

Do you know of a similar resource for how to install Webmin on Windows? Webmin’s own instructions assume too much knowledge and I’m no sysadmin.

Looks a bit dodgy for Windows. Just scanning the instructions, it looks like you need ActiveState Perl installed, along with a module and such. Seems like primarily a Linux tool? Let us know if you get it working and if it’s worth the install.

Stani SPE

SPE is developped on and works well with Ubuntu Gutsy. It includes a debugger and gui builers. Get it from subversion: http://pythonide.blogspot.com/2007/02/how-to-download-latest-spe-from_26.html

    http://photobatch.stani.be
    http://pythonide.stani.be

Tutorials & Debugging

http://showmedo.com/videos/series?name=PythonDevelopmentWithSPE

Debugging with WinPDB from Within SPE

The WinPDB graphical debugger can be launched from within SPE to debug Python code. Here I show how to launch the debugger, step through the code and stack frame, inspect variables and exit back to SPE. I also explain the significance of the Magic Letters. http://www.digitalpeers.com/pythondebugger/

KDevelop

This is a discussion on the Ubuntu forums-something like 51 pages worth. Even though you are using Gutsy, you want to take a look at KDevelop. It will install without problems even though it is KDE. A lot of people use Geany or Eclipse also. Anyway, you can page through as much of this thread as you like. http://ubuntuforums.org/showthread.php?t=6762

Eric4 KDE-focussed

Eric4 is and excellent graphical IDE with built-in debugger, profiler, project management, a RAD Qt4 builder (Qt designer), and all sorts of other goodies.

    http://www.die-offenbachs.de/eric/index.html

IMO, it's the way to go for Python development. And since I prefer KDE (Kubuntu) over Gnome (Ubuntu) there's an even greater attraction! Gotta love KDE.

Komodo

Komodo Edit is free http://www.activestate.com/Products/komodo_edit/

Setup

  • Download & Double-click on the ActivePython file.
  • http://www.activestate.com/store/download.aspx?prdGUID=b08b04e0-6872-4d9d-a722-7a0c2dea2758
  • we got an error on the x64 2.5.2.2 on metubes CPU
  • anyway try the x86 version instad ..
  • Don't customize install - just go default .. it installs to c:\Python25

  • Usage - Most work done in Editor menu - Pythonwin Editor.

Open Komodo is free and open source:

http://www.openkomodo.com/

activestate Try the free trial of Komodo

A company called ActiveState makes a free, all-in-one Python distribution that has everything you need to run Python on Windows XP, with all of the “hooks” you’ll eventually want to control your Windows machine and Windows programs using Python.

    http://www.activestate.com/Products/komodo_ide/

It has what you want, and it comes with licenses for both Windows and Linux.


0 comments

There are no comments yet

Add new comment

Similar posts

IDE PyCharm

Collaboration, Sync Processing =========

Simulation

PIMy Project Managment Review