Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop 2to3 mechanism #1350

Closed
shimizukawa opened this issue Jan 3, 2015 · 32 comments
Closed

Drop 2to3 mechanism #1350

shimizukawa opened this issue Jan 3, 2015 · 32 comments
Labels
type:enhancement enhance or introduce a new feature type:proposal a feature suggestion
Milestone

Comments

@shimizukawa
Copy link
Member

There is some way to complete to drop 2to3.

(see also #1220 discussion)


@shimizukawa shimizukawa added this to the 1.3 milestone Jan 3, 2015
@shimizukawa shimizukawa added type:enhancement enhance or introduce a new feature other type:proposal a feature suggestion labels Jan 3, 2015
@shimizukawa
Copy link
Member Author

From Dmitry Shachnev on 2014-01-18 11:05:09+00:00

Also:

from __future__ import print_function

Also: replace except A, b with except A as b.

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-01-18 11:10:57+00:00

Dmitry Shachnev Exactly!

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-01-18 11:28:25+00:00

The python-future does not support Python-3.2 because py32 does not support unicode literal. They said Adding support for Python 3.2 to future would likely impose a penalty with performance and/or maintainability,.. (see also python-future FAQ).

I think we need to decide whether drop Python-3.2 or not. If we decided to drop py32, we may not need to be dependent on six/future.

@shimizukawa
Copy link
Member Author

From Georg Brandl on 2014-01-18 11:38:38+00:00

For that it would be nice to know what python-future offers on top of six, and if it's worth using it. If yes, I'm not opposed to requiring Python 3.3.

@shimizukawa
Copy link
Member Author

From Georg Brandl on 2014-01-18 11:40:36+00:00

Independent changes like those Dmitry suggested can of course be made straight away.

@shimizukawa
Copy link
Member Author

From Georg Brandl on 2014-01-18 12:37:40+00:00

Looking at future, these can be made automatically using "futurize --stage1".

@shimizukawa
Copy link
Member Author

From Georg Brandl on 2014-01-18 15:48:28+00:00

I've just finished porting Pygments to single-source, and I have two observations:

  • python-future's conversion tool is nice, but otherwise I prefer six: less magic. future even reimplements the "int" type which is definitely too much compatibility.
  • The u"" literal from Python 3.3+ is not definitely needed; modules with many literals can use from __future__ import unicode_literals while others can use a u() wrapper. For Pygments, I did not use unicode_literals since it pretty much changes all lexers. Therefore I require 3.3+ there.

@shimizukawa
Copy link
Member Author

From Dmitry Shachnev on 2014-01-19 10:27:56+00:00

I have just created https://bitbucket.org/birkenfeld/sphinx/pull-request/208 for the first part of refactoring. Please review it carefully, I may have missed some bugs.

I have a question about tests/etree13. Is it still needed? Can we use xml.etree.ElementTree instead (which is available in Python 2.5+)?

@shimizukawa
Copy link
Member Author

From Georg Brandl on 2014-01-19 10:31:20+00:00

If the tests work with it, yes. Probably they will.

@shimizukawa
Copy link
Member Author

From Dmitry Shachnev on 2014-01-19 10:32:32+00:00

Dropping that will be my next pull request, then.

@shimizukawa
Copy link
Member Author

From Dmitry Shachnev on 2014-01-29 14:59:09+00:00

Re etree13, the tests work with Python 2 but not Python 3, I get lots of failures like this one:

======================================================================
FAIL: test_build_html.test_html(<xml.etree.ElementTree.ElementTree object at 0xb5f2f3ec>, 'subdir/includes.html', ".//a[[False](https://bitbucket.org/href)='../_downloads/img.png']", '')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/dmitry/sphinx-hg/sphinx/build/lib/tests/test_build_html.py", line 302, in check_xpath
    '%r in file %s' % (path, fname))
AssertionError: did not find any node matching xpath ".//a[[False](https://bitbucket.org/href)='../_downloads/img.png']" in file subdir/includes.html

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-04-26 09:18:48+00:00

I got a reason why py3 test has been failed.

Python 3 imports compiled version ElementTree and XMLParser automatically.
On the other hand, in Python 2, ElementTree and cElementTree is divided explicitly.

And compiled XMLParser doesn't have _fixname method then subclass can't override it. http://hg.python.org/cpython/file/9fc4a1ebe652/Modules/_elementtree.c#l3608

I'm going to introduce tests/pycompat.py that has a full copy of the python version XMLParser. I think it will resolve this problem.

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-04-26 09:38:57+00:00

I created a https://bitbucket.org/birkenfeld/sphinx/pull-request/237 to remove tests/etree13. Please review it.

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-04-30 04:11:28+00:00

I created a https://bitbucket.org/birkenfeld/sphinx/pull-request/238 that introduce the six module. Please review it.

(FYI, I declined the https://bitbucket.org/birkenfeld/sphinx/pull-request/237 for py26 and py3.)

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-24 16:29:57+00:00

Merged in shimizukawa/sphinx-use-six (https://bitbucket.org/birkenfeld/sphinx/pull-request/238)

using six package for py2/3 compatibility without 2to3. refs #1350

→ <<cset 80fd0f7>>

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-24 16:29:57+00:00

use six privided functions/classes to support py2/py3 in one source. refs #1350

→ <>

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-24 16:29:57+00:00

use UnicodeMixin for str, unicode to support py2/py3 in one source. refs #1350.

→ <<cset 9dbb6bf>>

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-24 16:29:57+00:00

use six privided text_type() to replace with unicode() to support py2/py3 in one source. refs #1350.

→ <<cset 00eff0b>>

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-24 16:29:57+00:00

provide next() and use native next() to support py2/py3 in one source. refs #1350.

→ <<cset 91b9d75>>

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-24 16:29:57+00:00

wrap iterator with list() to avoid 'dictionary changed size during iteration' on py3. refs #1350.

→ <<cset 49944cf>>

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-24 16:29:57+00:00

use six privided iteritems(),itervalues() to support py2/py3 in one source. refs #1350.

→ <>

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-24 16:29:57+00:00

use six privided functions/classes to support py2/py3 in one source. refs #1350.

→ <>

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-24 16:29:57+00:00

introduce the six module and reduce sphinx.util.pycompat implementation. refs #1350.

→ <<cset 68290a2>>

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-24 16:29:57+00:00

Merged in shimizukawa/sphinx-use-six (https://bitbucket.org/birkenfeld/sphinx/pull-request/238)

using six package for py2/3 compatibility without 2to3. refs #1350

→ <<cset 80fd0f7>>

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-24 16:37:28+00:00

I created a https://bitbucket.org/birkenfeld/sphinx/pull-request/243 as native support py2/py3 without 2to3. Please review it.

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-27 14:01:42+00:00

Merged in shimizukawa/sphinx-py3-native (https://bitbucket.org/birkenfeld/sphinx/pull-request/243)

native py2/py3 support without 2to3. refs #1350

→ <>

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-27 14:01:42+00:00

fix py2/py3 compat for 'iter.next()/next(iter)' and 'dict.values()/list(dict.values())'. refs #1350.

→ <<cset 5fd8dc8>>

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-27 14:01:42+00:00

use 'next(iter)' instead of 'iter.next()' to support py2/py3 compatibiity. refs #1350.

→ <<cset 071fb45>>

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-27 14:01:42+00:00

wrap py3 iterators with list() for each places that expect a list object. refs #1350.

→ <<cset 2d1549b>>

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-27 14:01:42+00:00

replace ur'' prefix with r'' to support py2/py3 in one source. refs #1350

→ <<cset 6ae3b68>>

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-27 14:01:42+00:00

Merged in shimizukawa/sphinx-py3-native (https://bitbucket.org/birkenfeld/sphinx/pull-request/243)

native py2/py3 support without 2to3. refs #1350

→ <>

@shimizukawa
Copy link
Member Author

From Takayuki Shimizukawa on 2014-05-27 14:23:56+00:00

Pygments-2.0 will drop Python-3.2.
The snowballstemmer package that is referred from sphinx-1.3 (that is merged at https://bitbucket.org/birkenfeld/sphinx/pull-request/214) has not supported Python-3.2.

We decided to drop the Python-3.2.

see also https://bitbucket.org/birkenfeld/sphinx/pull-request/243/native-py2-py3-support-without-2to3-refs

→ <<cset 6746c83>>

shimizukawa added a commit that referenced this issue Mar 11, 2015
shimizukawa added a commit that referenced this issue Mar 11, 2015
shimizukawa added a commit that referenced this issue Mar 11, 2015
shimizukawa added a commit that referenced this issue Mar 11, 2015
shimizukawa added a commit that referenced this issue Mar 11, 2015
using six package for py2/3 compatibility without 2to3. refs #1350
shimizukawa added a commit that referenced this issue Mar 11, 2015
native py2/py3 support without 2to3. refs #1350
shimizukawa added a commit that referenced this issue Mar 11, 2015
…n completed. Closes #1350.

Pygments-2.0 will drop Python-3.2.
The snowballstemmer package that is referred from sphinx-1.3 (that is merged at pull request #214) has not supported Python-3.2.

We decided to drop the Python-3.2.

see also https://bitbucket.org/birkenfeld/sphinx/pull-request/243/native-py2-py3-support-without-2to3-refs
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type:enhancement enhance or introduce a new feature type:proposal a feature suggestion
Projects
None yet
Development

No branches or pull requests

1 participant