Re: [Python-Dev] Clarification of PEP 394 for scripts that run under Python 2 and 3
On Nov 13, 2015, at 10:32 PM, Damien George wrote: >1. What is the true intent of PEP 394 when only Python 3 is installed? Is >"python" available or not to run scripts compatible with 2.x and 3.x? > >2. Is it possible to write a shebang line that supports all variations of >Python installations on *nix machines? > >3. If the answer to 2 is no, then what is the recommended way to support >all Python installations with one standalone script? It's important to remember that PEP 394 is an informational PEP, still under active (if dormant) discussion. It is also just a recommendation, and can't force any downstream redistributors to do one thing or another. Still, the intent is to provide a set of guidelines for the majority of *nix distributors to (eventually) adopt. I'll also point you to the recently created linux-sig where this topic is being discussed. https://mail.python.org/pipermail/linux-sig/2015-October/00.html As you've noticed, Arch took a particular approach, but speaking as part of the Debian/Ubuntu community, don't expect that ecosystem to go down the same path. It's highly unlikely /usr/bin/python will ever point to anything other than Python 2, even when only Python 3 is installed by default. That might change once Python 2.7 is actually EOL'd, and that won't happen for quite a long time. PEP 373 currently says there will be bug fix releases until 2020, and I'd expect security-only releases for some time after that. In general, the discussions on linux-sig and elsewhere is coalescing around a launcher-type approach, where you'd put something like /usr/bin/py in your shebang if your script really is bilingual. Then `py` can try to figure out what's available on your system, what your preference is, etc. and then execute your script using that version-specific binary. I would expect the launcher to eventually be provided by the upstream Python development community. AFAIK, there have been a few stabs at writing such a launcher, but nothing that's far enough to be usable. So for now, you don't have great options. Cheers, -Barry ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Clarification of PEP 394 for scripts that run under Python 2 and 3
Hi python-dev, We have a Python script that runs correctly under Python 2.6, 2.7 and 3.3+. It is executed on a *nix system using the "python" executable (ie not python2 or python3 specifically). This works just fine for systems that have Python 2 installed, or 2 and 3, or just 3 and symlink "python" to "python3" (eg Arch Linux). But it fails for systems that have only Python 3 and do not create a "python" symlink, ie only "python3" exists as an executable. We thought that PEP 394 would come to the rescue here but it seems to be unclear on this point. In particular it says: - 4th point of the abstract: "so python should be used in the shebang line only for scripts that are source compatible with both Python 2 and 3" - 6th point of the recommendation section: "One exception to this is scripts that are deliberately written to be source compatible with both Python 2.x and 3.x. Such scripts may continue to use python on their shebang line without affecting their portability" - 8th point in the migration notes: "If these conventions are adhered to, it will become the case that the python command is only executed in an interactive manner as a user convenience, or to run scripts that are source compatible with both Python 2 and Python 3." Well, that's pretty clear to me: one can expect the "python" executable to be available to run scripts that are compatible with versions 2.x and 3.x. The confusion comes because there are systems that install Python 3 without creating a "python" symlink (hence breaking the above). And Guido said that "'python' should always be the same as 'python2'" (see https://mail.python.org/pipermail/python-dev/2014-September/136389.html). Further, Nick Coghlan seemed to agree that "when there's only python3 installed, there should be no /usr/bin/python" (see https://mail.python.org/pipermail/python-dev/2014-September/136527.html). My questions are: 1. What is the true intent of PEP 394 when only Python 3 is installed? Is "python" available or not to run scripts compatible with 2.x and 3.x? 2. Is it possible to write a shebang line that supports all variations of Python installations on *nix machines? 3. If the answer to 2 is no, then what is the recommended way to support all Python installations with one standalone script? Thanks! Regards, Damien. ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Rietveld is broken
When I try to press 'retry' on http://bugs.python.org/review/25074/ page and send a message server responds with 500 error. Going through the page for viewing diff for concrete file http://bugs.python.org/review/25074/diff/15535/Lib/test/test_asyncio/test_base_events.py with adding a comment works well. The behavior is very annoying -- I was forced to write missed message twice. -- Thanks, Andrew Svetlov ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] doc tests failing
On 11/13/2015 07:12 AM, Ethan Furman wrote: > What am I doing wrong? On 11/13/2015 07:40 AM, Georg Brandl wrote: > Running "make doctest" in the first place. The doctests in the core > docs were not written to support that, and also never updated to do > so. On 11/13/2015 07:42 AM, Zachary Ware wrote: > Expecting it to work :) On 11/13/2015 07:44 AM, R. David Murray wrote: > We don't have clean doctests for the docs. Patches welcome. Ah, okay, that explains it. :) Which means I had tested 'enum.rst' manually back when I wrote it, and had forgotten. Thank you for the reminder! -- ~Ethan~ ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Summary of Python tracker Issues
ACTIVITY SUMMARY (2015-11-06 - 2015-11-13) Python tracker at http://bugs.python.org/ To view or respond to any of the issues listed below, click on the issue. Do NOT respond to this message. Issues counts and deltas: open5232 (+14) closed 32143 (+35) total 37375 (+49) Open issues with patches: 2307 Issues opened (36) == #7759: mhlib fails on Btrfs filesystem (test_mhlib failure) http://bugs.python.org/issue7759 reopened by serhiy.storchaka #25570: urllib.request > Request.add_header("abcd","efgh") fails with http://bugs.python.org/issue25570 opened by crickert #25571: Improve the lltrace feature with the Py_Debug mode http://bugs.python.org/issue25571 opened by matrixise #25572: _ssl doesn't build on OSX 10.11 http://bugs.python.org/issue25572 opened by matrixise #25573: FrameSummary repr() does not support previously working uses o http://bugs.python.org/issue25573 opened by zopieux #25574: 2.7 incorrectly documents objects hash as equal to id http://bugs.python.org/issue25574 opened by wim.glenn #25576: Remove âContent-Type: application/x-www-form-urlencoded; cha http://bugs.python.org/issue25576 opened by martin.panter #25578: Memory leak in SSLSocket.getpeercert() with 0-length AIA exten http://bugs.python.org/issue25578 opened by alex #25580: async and await missing from token list http://bugs.python.org/issue25580 opened by SilentGhost #25582: Fixed memory leaks in test_ctypes http://bugs.python.org/issue25582 opened by serhiy.storchaka #25583: os.makedirs with exist_ok=True raises PermissionError on Windo http://bugs.python.org/issue25583 opened by plachotich #25585: Bad path leads to: ImportError: DLL load failed: %1 is not a v http://bugs.python.org/issue25585 opened by lac #25586: socket.sendall broken when a socket has a timeout http://bugs.python.org/issue25586 opened by jstasiak #25588: Run test suite from IDLE idlelib.run subprocess http://bugs.python.org/issue25588 opened by terry.reedy #25590: tab-completition on instances repeatedly accesses attribute/de http://bugs.python.org/issue25590 opened by ezio.melotti #25591: improve test coverage for the imaplib http://bugs.python.org/issue25591 opened by maciej.szulik #25592: distutils docs: data_files always uses sys.prefix http://bugs.python.org/issue25592 opened by jdemeyer #25593: _sock_connect_cb can be called twice resulting in InvalidState http://bugs.python.org/issue25593 opened by thehesiod #25594: enum instance attribute access possible http://bugs.python.org/issue25594 opened by SilentGhost #25596: regular files handled as directories in the glob module http://bugs.python.org/issue25596 opened by xdegaye #25597: unittest.mock does not wrap dict objects correctly http://bugs.python.org/issue25597 opened by Darragh Bailey #25599: asyncio.iscoroutinefunction returns unexpected results when pr http://bugs.python.org/issue25599 opened by luhn #25601: test_cpickle failure on the ware-gentoo-x86 buildbot http://bugs.python.org/issue25601 opened by serhiy.storchaka #25602: Add support for EVFILT_USER kqueue filter http://bugs.python.org/issue25602 opened by jceel #25604: [Minor] bug in integer true division algorithm http://bugs.python.org/issue25604 opened by mark.dickinson #25606: asyncio doc: 'socket' transport extra info is not mandatory http://bugs.python.org/issue25606 opened by haypo #25608: ascynio readexactly() should raise ValueError if passed length http://bugs.python.org/issue25608 opened by mmarkk #25609: Add a ContextManager ABC and type http://bugs.python.org/issue25609 opened by brett.cannon #25610: Add typing.Awaitable http://bugs.python.org/issue25610 opened by brett.cannon #25611: test_deque failure on Gentoo and OpenIndiana buildbots on 2.7 http://bugs.python.org/issue25611 opened by serhiy.storchaka #25612: nested try..excepts don't work correctly for generators http://bugs.python.org/issue25612 opened by yselivanov #25613: fix ssl tests with sslv3 disabled http://bugs.python.org/issue25613 opened by doko #25614: Lib/code.py: InteractiveConsole.raw_input writes prompt to std http://bugs.python.org/issue25614 opened by Yclept.Nemo #25615: Document unsorted behaviour of glob.glob http://bugs.python.org/issue25615 opened by Dave Jones #25616: Extract OrderedDict tests into separate file http://bugs.python.org/issue25616 opened by serhiy.storchaka #25617: Installing local installation of Python http://bugs.python.org/issue25617 opened by koustavpal88 Most recent 15 issues with no replies (15) == #25617: Installing local installation of Python http://bugs.python.org/issue25617 #25616: Extract OrderedDict tests into separate file http://bugs.python.org/issue25616 #25615: Document unsorted behaviour of glob.glob http://bugs.python.org/issue25615 #25614: Lib/code.py: InteractiveConsole.raw_input writes prompt to std http://bugs.python.org/issue25614 #25611: test_deque failure
Re: [Python-Dev] doc tests failing
On Fri, Nov 13, 2015 at 9:12 AM, Ethan Furman wrote: > What am I doing wrong? Expecting it to work :) `make doctest` is a Sphinx feature, not specific to our docs. Ideally someday it should work (and I'll add it to the Docs buildbot), but nobody has tried to make it work yet. Making it work might be a good large-ish project for newer contributors. -- Zach ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] doc tests failing
We don't have clean doctests for the docs. Patches welcome. At one point I had made the turtle doctests pass (it draws a bunch of stuff on the screen) because otherwise we don't have very many turtle tests, but I haven't checked it in a couple years. Hmm. We could list making the doc doctests pass as an activity for beginners in the devguide. On Fri, 13 Nov 2015 07:12:32 -0800, Ethan Furman wrote: > What am I doing wrong? > > I have tried: > > > hg update 3.5 # and hg update default > make distclean && ./configure --with-pydebug && make -j2 > cd Doc > make doctest > > > and in both cases I get page after page of errors. I have tried > installing python-sphinx and python3-sphinx; I have tried adding > PYTHON=../python and PYTHON=python3 to the `make doctest` line -- all to > no avail. > > Here's a random sample of the errors: > > ** > File "library/shlex.rst", line ?, in default > Failed example: > remote_command > Exception raised: > Traceback (most recent call last): >File "/usr/lib/python2.7/doctest.py", line 1315, in __run > compileflags, 1) in test.globs >File "", line 1, in > remote_command > NameError: name 'remote_command' is not defined > > ** > File "howto/sorting.rst", line ?, in default > Failed example: > sorted([5, 2, 4, 1, 3], cmp=numeric_compare) > Exception raised: > Traceback (most recent call last): >File "/usr/lib/python2.7/doctest.py", line 1315, in __run > compileflags, 1) in test.globs >File "", line 1, in > sorted([5, 2, 4, 1, 3], cmp=numeric_compare) > NameError: name 'numeric_compare' is not defined > > ** > File "library/ipaddress.rst", line ?, in default > Failed example: > n2 = ip_network('192.0.2.1/32') > Exception raised: > Traceback (most recent call last): >File "/usr/lib/python2.7/doctest.py", line 1315, in __run > compileflags, 1) in test.globs >File "", line 1, in > n2 = ip_network('192.0.2.1/32') > NameError: name 'ip_network' is not defined > > -- > ~Ethan~ > ___ > Python-Dev mailing list > Python-Dev@python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/rdmurray%40bitdance.com ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] doc tests failing
On 11/13/2015 04:12 PM, Ethan Furman wrote: > What am I doing wrong? Running "make doctest" in the first place. The doctests in the core docs were not written to support that, and also never updated to do so. Georg > I have tried: > > > hg update 3.5 # and hg update default > make distclean && ./configure --with-pydebug && make -j2 > cd Doc > make doctest > > > and in both cases I get page after page of errors. I have tried > installing python-sphinx and python3-sphinx; I have tried adding > PYTHON=../python and PYTHON=python3 to the `make doctest` line -- all to > no avail. > > Here's a random sample of the errors: > > ** > File "library/shlex.rst", line ?, in default > Failed example: > remote_command > Exception raised: > Traceback (most recent call last): >File "/usr/lib/python2.7/doctest.py", line 1315, in __run > compileflags, 1) in test.globs >File "", line 1, in > remote_command > NameError: name 'remote_command' is not defined > > ** > File "howto/sorting.rst", line ?, in default > Failed example: > sorted([5, 2, 4, 1, 3], cmp=numeric_compare) > Exception raised: > Traceback (most recent call last): >File "/usr/lib/python2.7/doctest.py", line 1315, in __run > compileflags, 1) in test.globs >File "", line 1, in > sorted([5, 2, 4, 1, 3], cmp=numeric_compare) > NameError: name 'numeric_compare' is not defined > > ** > File "library/ipaddress.rst", line ?, in default > Failed example: > n2 = ip_network('192.0.2.1/32') > Exception raised: > Traceback (most recent call last): >File "/usr/lib/python2.7/doctest.py", line 1315, in __run > compileflags, 1) in test.globs >File "", line 1, in > n2 = ip_network('192.0.2.1/32') > NameError: name 'ip_network' is not defined > > -- > ~Ethan~ > ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] doc tests failing
What am I doing wrong? I have tried: hg update 3.5 # and hg update default make distclean && ./configure --with-pydebug && make -j2 cd Doc make doctest and in both cases I get page after page of errors. I have tried installing python-sphinx and python3-sphinx; I have tried adding PYTHON=../python and PYTHON=python3 to the `make doctest` line -- all to no avail. Here's a random sample of the errors: ** File "library/shlex.rst", line ?, in default Failed example: remote_command Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in remote_command NameError: name 'remote_command' is not defined ** File "howto/sorting.rst", line ?, in default Failed example: sorted([5, 2, 4, 1, 3], cmp=numeric_compare) Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in sorted([5, 2, 4, 1, 3], cmp=numeric_compare) NameError: name 'numeric_compare' is not defined ** File "library/ipaddress.rst", line ?, in default Failed example: n2 = ip_network('192.0.2.1/32') Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in n2 = ip_network('192.0.2.1/32') NameError: name 'ip_network' is not defined -- ~Ethan~ ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com