diff options
Diffstat (limited to 'docs/python3.txt')
-rw-r--r-- | docs/python3.txt | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/docs/python3.txt b/docs/python3.txt index 2f6cde4a..1e019951 100644 --- a/docs/python3.txt +++ b/docs/python3.txt @@ -1,18 +1,19 @@ ===================================================== -Supporting both Python 2 and Python 3 with Distribute +Supporting both Python 2 and Python 3 with Setuptools ===================================================== -Starting with version 0.6.2, Distribute supports Python 3. Installing and -using distribute for Python 3 code works exactly the same as for Python 2 -code, but Distribute also helps you to support Python 2 and Python 3 from +Starting with Distribute version 0.6.2 and Setuptools 0.7, the Setuptools +project supported Python 3. Installing and +using setuptools for Python 3 code works exactly the same as for Python 2 +code, but Setuptools also helps you to support Python 2 and Python 3 from the same source code by letting you run 2to3 on the code as a part of the build process, by setting the keyword parameter ``use_2to3`` to True. -Distribute as help during porting +Setuptools as help during porting ================================= -Distribute can make the porting process much easier by automatically running +Setuptools can make the porting process much easier by automatically running 2to3 as a part of the test running. To do this you need to configure the setup.py so that you can run the unit tests with ``python setup.py test``. @@ -24,10 +25,10 @@ The test command will now first run the build command during which the code will be converted with 2to3, and the tests will then be run from the build directory, as opposed from the source directory as is normally done. -Distribute will convert all Python files, and also all doctests in Python +Setuptools will convert all Python files, and also all doctests in Python files. However, if you have doctests located in separate text files, these will not automatically be converted. By adding them to the -``convert_2to3_doctests`` keyword parameter Distrubute will convert them as +``convert_2to3_doctests`` keyword parameter Setuptools will convert them as well. By default, the conversion uses all fixers in the ``lib2to3.fixers`` package. @@ -86,12 +87,14 @@ Advanced features If you don't want to run the 2to3 conversion on the doctests in Python files, you can turn that off by setting ``setuptools.use_2to3_on_doctests = False``. -Note on compatibility with setuptools -===================================== +Note on compatibility with older versions of setuptools +======================================================= -Setuptools do not know about the new keyword parameters to support Python 3. +Setuptools earlier than 0.7 does not know about the new keyword parameters to +support Python 3. As a result it will warn about the unknown keyword parameters if you use -setuptools instead of Distribute under Python 2. This is not an error, and +those versions of setuptools instead of Distribute under Python 2. This output +is not an error, and install process will continue as normal, but if you want to get rid of that error this is easy. Simply conditionally add the new parameters into an extra dict and pass that dict into setup():: @@ -117,5 +120,5 @@ dict and pass that dict into setup():: **extra ) -This way the parameters will only be used under Python 3, where you have to -use Distribute. +This way the parameters will only be used under Python 3, where Distribute or +Setuptools 0.7 or later is required. |