Skip to content

Commit be5536f

Browse files
committed
Adding note to help with Python 3.
1 parent 17d8245 commit be5536f

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

README.rst

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,20 @@ not fit in memory.
3535
Dependencies
3636
------------
3737

38-
- python 2.6 (or compatible)
38+
- python 2.7+, python 3.3+
3939
- `yajl <http://lloyd.github.com/yajl/>`_
4040

4141
To run the tests you also require:
4242

4343
- make (to run ``make test``)
4444
- nose (debian package == ``python-nose``)
45-
- MiniMockTest (``pip install minimocktest``)
45+
- mock (``pip install mock``)
4646

4747
Install
4848
-------
4949

5050
From within the current directory run::
5151

52-
python setup.py install
53-
54-
- OR Alternatively -
55-
5652
pip install .
5753

5854
To install from pypi::
@@ -65,6 +61,22 @@ Usage
6561
The examples directory contains full featured JSON Parsers built using
6662
``yajl`` and ``yajl-py``. See `examples/README.rst <examples/>`_ for more info.
6763

64+
Notes around strings, python 3, and yajl-py
65+
-------------------------------------------
66+
67+
TLDR; if using python3, yajl-py expects bytes and not strings
68+
69+
Python 3 fixed a whole string of issues with strings. Due to these fixes
70+
somethings taken for granted in python 2 are now explicit in python 3. The
71+
major change that affects yajl-py is related to a decision made within ctypes.
72+
73+
Strings going and coming from the ctypes interface to c-code are now bytes.
74+
Although we can make an explicit decision to decode and encode strings
75+
transparently to latin-1 or utf-8, this is an arbitrary choice. Even
76+
though it can be coded in such a way to make the encoding configurable, the
77+
decision has been made to keep with the decision made by ctypes and hence put
78+
the onus on the developer to decode/encode the input/output as necessary.
79+
6880
Contributions
6981
-------------
7082

doc/source/index.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,25 @@ docstrings:
174174

175175
yajl/index
176176

177+
Notes around strings, python 3, and yajl-py
178+
-------------------------------------------
179+
180+
TLDR; if using python3, yajl-py expects bytes and not strings
181+
182+
Python 3 fixed a whole string of issues with strings. Due to these fixes
183+
somethings taken for granted in python 2 are now explicit in python 3. The
184+
major change that affects yajl-py is related to a decision made within ctypes.
185+
186+
Strings going and coming from the ctypes interface to c-code are now bytes.
187+
Although we can make an explicit decision to decode and encode strings
188+
transparently to latin-1 or utf-8, this is an arbitrary choice. Even
189+
though it can be coded in such a way to make the encoding configurable, the
190+
decision has been made to keep with the decision made by ctypes and hence put
191+
the onus on the developer to decode/encode the input/output as necessary.
192+
177193
Indices and tables
178194
==================
179195

180196
* :ref:`genindex`
181197
* :ref:`modindex`
182198
* :ref:`search`
183-

0 commit comments

Comments
 (0)