Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Which Python editor has this feature? Date: Tue, 12 Jan 2016 21:18:55 +1100 Lines: 104 Message-ID: References: <830f6f97-22dd-488c-9dd6-e9cd92844307@googlegroups.com> <5f1619e5-83ff-449e-b7e5-2374a37bd50b@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de eidijO+vKSFFLIaWHPBChgLAFHen6kHaRf1aQ/tTnwqg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'subject:Python': 0.05; 'cpython': 0.05; 'gsoc': 0.05; 'args)': 0.07; 'mouse': 0.07; 'nicely': 0.07; 'postgresql': 0.07; 'setup.py': 0.07; 'subject:editor': 0.07; 'versions.': 0.07; 'cc:addr:python-list': 0.09; "ain't": 0.09; 'exception:': 0.09; 'python': 0.10; 'assume': 0.11; 'jan': 0.11; 'package,': 0.13; 'folks': 0.15; 'skip:f 30': 0.15; '2016': 0.16; 'carriage': 0.16; 'display,': 0.16; 'experiment.': 0.16; 'fancy': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'fruit.': 0.16; 'hint': 0.16; 'hmm.': 0.16; 'idle,': 0.16; 'idle.': 0.16; 'invisible': 0.16; 'messy': 0.16; 'overwriting': 0.16; 'pip?': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'skip:" 100': 0.16; 'such,': 0.16; 'suggestion.': 0.16; 'ugly.': 0.16; 'verbose': 0.16; 'wrote:': 0.16; 'obviously': 0.16; 'attribute': 0.18; 'detect': 0.18; 'hacking': 0.18; 'thoughts': 0.18; 'written,': 0.18; 'gui': 0.18; '>>>': 0.20; 'student': 0.20; 'windows': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'fix': 0.21; 'so.': 0.22; '64-bit': 0.22; "aren't": 0.22; 'produces': 0.22; 'tkinter': 0.22; 'am,': 0.23; 'seems': 0.23; 'tried': 0.24; 'import': 0.24; '(most': 0.24; 'header:In-Reply-To:1': 0.24; 'feature': 0.24; 'mon,': 0.24; 'script': 0.25; 'install': 0.25; 'installed': 0.26; 'chris': 0.26; 'skip:_ 20': 0.26; 'supported': 0.27; 'packaging': 0.27; 'separate': 0.27; 'least': 0.27; 'message-id:@mail.gmail.com': 0.27; 'always,': 0.29; 'command-line': 0.29; 'itself,': 0.29; 'talked': 0.29; 'windows,': 0.29; 'random': 0.29; "i'm": 0.30; 'that.': 0.30; 'too.': 0.30; "i'd": 0.31; 'probably': 0.31; 'skip:s 30': 0.31; "can't": 0.32; 'skip:_ 10': 0.32; 'possibly': 0.32; 'maybe': 0.33; 'run': 0.33; 'accessible': 0.33; 'idle': 0.33; 'mentor': 0.33; 'traceback': 0.33; 'windows.': 0.33; 'tue,': 0.34; 'file': 0.34; 'except': 0.34; 'handle': 0.34; 'add': 0.34; 'that,': 0.34; 'gets': 0.35; 'received:google.com': 0.35; 'python.org': 0.35; 'skip:c 30': 0.35; 'next': 0.35; 'done': 0.35; 'installing': 0.35; 'platforms,': 0.35; 'knowledge': 0.35; "isn't": 0.35; 'item': 0.35; 'skip:p 30': 0.35; 'but': 0.36; 'instead': 0.36; 'there': 0.36; 'tool': 0.36; 'received:209.85': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'between': 0.65; 'fact,': 0.67; 'worth': 0.67; 'truth': 0.79; '"hey,': 0.84; '3.5.1': 0.84; 'about,': 0.84; 'actually,': 0.84; 'bernardo': 0.84; 'chrisa': 0.84; 'farms': 0.84; "it'd": 0.84; 'pip': 0.84; "students'": 0.84; 'wheel': 0.84; 'wheels': 0.84; 'subject:this': 0.85; 'to:none': 0.91; 'request:': 0.91; 'thing,': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=y/9MW5R9Sc5aEnrMAimtvEK1q8R358L4i4o2xI+qSIw=; b=KXknme2GFmz0yq0qBvDQ+S3/FR5WJW9QYZLa3mI3idCExPNsoF0yyDS+ZlELFdp0N0 2veWehoLE5roFX5M8zBRjZ3m6LMARvw8l5yqRe98HRY3JwRowE+bt1gaqtlYW5xm3ixT 74cZg79W45Q66eopjRZZCZe1l+heKaopIfCdipSyAVZmcQ+lYzQ9JVrN6eFsdCIwYN98 X3+JyiYDDcblQ/1/9dcyiUJ2yz9D1+tWIVT8ytAMm+BNs/EbpSJytW9BD/u4LFapTpsK vvN7zhdYKrYoMIWHpXXp3R6jiijBzNyqWa+Fma0UxcI+N/p+LVdECWoOs2bqkBrO7OB3 3Frg== X-Received: by 10.107.47.162 with SMTP id v34mr67964044iov.19.1452593935472; Tue, 12 Jan 2016 02:18:55 -0800 (PST) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:101534 On Tue, Jan 12, 2016 at 7:27 PM, Terry Reedy wrote: > On 1/11/2016 8:09 PM, Chris Angelico wrote: >> >> On Tue, Jan 12, 2016 at 11:55 AM, Bernardo Sulzbach >> wrote: >>> >>> On Mon, Jan 11, 2016 at 10:14 PM, Chris Angelico >>> wrote: >>>> >>>> >>>> Next IDLE feature request: Can you make it so that, across all >>>> platforms, it magically installs PostgreSQL and psycopg2? That would >>>> solve so many of my students' problems... > > > I detect an invisible smiley at the end of that. > > PostgresSQL is not a Python package, hence would need a custom script to > download and invoke, and would probably need user clicks anyway, at least on > Windows. Does/could psycopg2 have such for installing its dependency? > > Can psycopg2 be installed with pip? There is an issue (#23551) to make a > pip GUI and make it accessible from IDLE. We need someone with both pip and > tkinter knowledge to either design and write it or mentor a GSOC student to > do so. One written, I would add an IDLE menu item to run it, in a separate > process, just as done now with turtledemo. Yes, invisible smiley... but with a hint of truth too. Obviously installing PostgreSQL itself is outside the scope of IDLE, but psycopg2 is indeed pip-installable... except that it isn't always, on Windows, because wheels aren't available for all versions. (There's no Python 3.5 wheel yet; at least, I can't see one on PyPI.) So what I'm really looking for isn't an IDLE feature but a Python packaging feature - some people have talked about setting up build farms that can produce wheels for people. Hmm. I just tried this, and actually, there's some possibly low-hanging fruit. (Tested on Python 3.4.3 as 3.5 can't install psycopg2 anyway.) >>> import pip; pip.main(["install","psycopg2"]) This produces a rather messy display, because pip.main seems to assume that writing carriage returns to the console will result in the display nicely overwriting (producing a moving progress bar as the file gets downloaded). If IDLE can't handle carriage returns as such, an easy fix would be to simply display them as complete lines; it would be more verbose than the normal console behaviour, but not as ugly. A couple of other random thoughts from this experiment. * Going to python.org and pointing the mouse at the download link got me 3.5.1 32-bit. This is on Google Chrome on a Windows 7 64-bit VM. * Instead of pip.main(["install","psycopg2"]), I'd like to be able to say pip.install("psycopg2"). In fact, I might take that to the pip folks as a suggestion. * The performance difference between "import pip" on 3.4.3 and 3.5.1 was dramatic! I don't know whether it's CPython that's been sped up or pip itself, but it's awesome! There's some kind of issue between pip and Idle that means that installing a non-wheel blows up with an exception: Traceback (most recent call last): File "C:\Users\Rosuav\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\basecommand.py", line 211, in main status = self.run(options, args) File "C:\Users\Rosuav\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\commands\install.py", line 294, in run requirement_set.prepare_files(finder) File "C:\Users\Rosuav\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\req\req_set.py", line 334, in prepare_files functools.partial(self._prepare_file, finder)) File "C:\Users\Rosuav\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\req\req_set.py", line 321, in _walk_req_to_install more_reqs = handler(req_to_install) File "C:\Users\Rosuav\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\req\req_set.py", line 505, in _prepare_file abstract_dist.prep_for_dist() File "C:\Users\Rosuav\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\req\req_set.py", line 123, in prep_for_dist self.req_to_install.run_egg_info() File "C:\Users\Rosuav\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\req\req_install.py", line 410, in run_egg_info command_desc='python setup.py egg_info') File "C:\Users\Rosuav\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\utils\__init__.py", line 711, in call_subprocess line = console_to_str(proc.stdout.readline()) File "C:\Users\Rosuav\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\compat\__init__.py", line 47, in console_to_str return s.decode(sys.__stdout__.encoding) AttributeError: 'NoneType' object has no attribute 'encoding' Maybe calling pip.main just isn't a supported thing, but it'd be nice if there were _some_ way to do this, even without a fancy GUI. How much of this is worth doing anything about, and how much is "hey, you're hacking around calling a command-line tool from inside a GUI, and stuff ain't a'gonna work right"? ChrisA