mirror of https://github.com/scrapy/scrapy.git
typos
parent
851df8770f
commit
1f69909ae4
|
|
@ -1,6 +1,6 @@
|
|||
## Porting Scrapy to Python 3
|
||||
|
||||
Scrapy is being ported to Python 3 using single-codebase approach. The goal is to make Scrapy work in Python 2.7 and 3.3+. [six](https://bitbucket.org/gutworth/six/src) library is used to smooth differences between Python 2.x and 3.x.
|
||||
Scrapy is being ported to Python 3 using the _single-codebase_ approach. The goal is to make Scrapy work in both Python 2.7 and 3.3+ using the [six](https://bitbucket.org/gutworth/six/src) library to smooth differences between Python 2.x and 3.x.
|
||||
|
||||
Tests for Python 2.7 and 3.3 are executed on Travis CI after each commit. Not all Scrapy tests pass in Python 3, so there is a [py3-ignores.txt](https://github.com/scrapy/scrapy/blob/master/tests/py3-ignores.txt) file with a list of tests excluded in Python 3. It also acts as a TODO list.
|
||||
|
||||
|
|
@ -10,10 +10,10 @@ See also: [Contributing to Scrapy](http://doc.scrapy.org/en/master/contributing.
|
|||
|
||||
When porting, please try follow these rules:
|
||||
|
||||
* Use a single codebase for Python 2.x and 3.x using six library;
|
||||
* Use a single codebase for Python 2.x and 3.x using six library.
|
||||
* All URLs should be "native strings" - bytes in Python 2.x and unicode in Python 3.x.
|
||||
* HTTP headers are bytes in Scrapy (both keys and values). This decision have its downsides and is not set in stone, but we needed a decision to move forward.
|
||||
* Don't rely only on existing tests to make the port; Scrapy test coverage is good but not perfect. Even if tests are passing don't consider a related module ported - please don't uncomment it from `py3-ignores.txt` without carefully reading the source code of a tested module and a source code of the test itself. Porting a module to Python 3 often require writing extra tests.
|
||||
* Try make sure your pull requests are focused and don't contain unrelated changes. If you've ported several modules it is better to make several pull requests. Reviewing Python 3 porting changes is hard because we can't rely only on tests - one have to check all the related modules; it is much easier to review and merge a small pull request.
|
||||
* HTTP headers are bytes in Scrapy (both keys and values). This decision has its upsides and downsides and is not set in stone, but we needed a decision to move forward.
|
||||
* Don't rely only on existing tests to make the port; Scrapy test coverage is good but not perfect. Even if tests are passing don't consider a related module ported - please don't uncomment it from `py3-ignores.txt` without carefully reading the source code of a tested module and the source code of the test itself. Porting a module to Python 3 often requires writing extra tests.
|
||||
* Try to make sure your pull requests are focused and don't contain unrelated changes. If you've ported several modules it is better to make several pull requests. Reviewing Python 3 porting changes is hard because we can't rely only on tests - one has to check all the related modules; it is much easier to review and merge a small pull request.
|
||||
* It is OK not to port deprecated Scrapy features to Python 3 and skip the related tests for Python 3.
|
||||
* It is OK to make a feature optional if it depends on a part of Twisted which is not ported yet. Of course, contributing to Twisted is welcome. See also: [[PY3: Twisted Dependencies]].
|
||||
|
|
|
|||
Loading…
Reference in New Issue