remove ujson
MODIFY
.travis.yml
.travis.yml
@@ -8,7 +8,7 @@ python:
- pypy
- pypy3
install:
- - pip install pytest flake8 check-manifest Cython ujson
+ - pip install pytest flake8 check-manifest Cython
script:
- ./run-tests.sh
- docker run --rm -v "$(pwd):/data" quay.io/pypa/manylinux1_x86_64 bash -c "/data/.travis_build_wheel.sh $TRAVIS_PYTHON_VERSION"

MODIFY
appveyor.yml
appveyor.yml
@@ -12,7 +12,7 @@ environment:
- PYTHON: "C:\\Python36-x64"
install:
- - "%PYTHON%\\python.exe -m pip install pytest flake8 check-manifest Cython wheel ujson"
+ - "%PYTHON%\\python.exe -m pip install pytest flake8 check-manifest Cython wheel"
build: off

MODIFY
fastavro/_read.pyx
fastavro/_read.pyx
@@ -12,9 +12,6 @@ import datetime
from decimal import localcontext, Decimal
from uuid import UUID
-try:
- import ujson as json
-except ImportError:
import json
from ._six import (

MODIFY
fastavro/_read_py.py
fastavro/_read_py.py
@@ -12,6 +12,8 @@ import datetime
from decimal import localcontext, Decimal
from uuid import UUID
+import json
+
from .six import (
MemoryIO, xrange, btou, iteritems, is_str, str2ints, fstint
)
@@ -27,11 +29,6 @@ from .const import (
MLS_PER_SECOND, DAYS_SHIFT
)
-try:
- import ujson as json
-except ImportError:
- import json
-
MASK = 0xFF
AVRO_TYPES = set([
'boolean',

MODIFY
fastavro/_schema.pyx
fastavro/_schema.pyx
from os import path
-try:
- import ujson as json
-except ImportError:
import json
from ._schema_common import PRIMITIVES, SCHEMA_DEFS, UnknownType

MODIFY
fastavro/_schema_py.py
fastavro/_schema_py.py
from os import path
-try:
- import ujson as json
-except ImportError:
import json
from ._schema_common import PRIMITIVES, SCHEMA_DEFS, UnknownType

MODIFY
fastavro/_six.pyx
fastavro/_six.pyx
@@ -8,13 +8,6 @@ import sys
from sys import stdout
from struct import unpack
-_HAS_UJSON = False
-
-try:
- import ujson as json
-
- _HAS_UJSON = True
-except ImportError:
import json
_encoding = 'UTF-8'
@@ -29,11 +22,6 @@ if sys.version_info >= (3, 0):
return bytes(n, encoding)
def py3_json_dump(obj, indent):
- if _HAS_UJSON:
- if indent is None:
- indent = 0
- json.dump(obj, stdout, indent=indent)
- else:
json.dump(obj, stdout, indent=indent)
def py3_iterkeys(obj):
@@ -73,9 +61,6 @@ else: # Python 2x
kwargs = {}
if indent is not None:
kwargs['indent'] = indent
- if _HAS_UJSON:
- json.dump(obj, stdout, **kwargs)
- else:
json.dump(obj, stdout, encoding=_outenc, **kwargs)
def py2_iterkeys(obj):

MODIFY
fastavro/_write.pyx
fastavro/_write.pyx
# http://svn.apache.org/viewvc/avro/trunk/lang/py/src/avro/ which is under
# Apache 2.0 license (http://www.apache.org/licenses/LICENSE-2.0)
-try:
- import ujson as json
-except ImportError:
import json
import datetime

MODIFY
fastavro/_write_py.py
fastavro/_write_py.py
# http://svn.apache.org/viewvc/avro/trunk/lang/py/src/avro/ which is under
# Apache 2.0 license (http://www.apache.org/licenses/LICENSE-2.0)
-try:
- import ujson as json
-except ImportError:
import json
import datetime

MODIFY
fastavro/six.py
fastavro/six.py
@@ -8,13 +8,6 @@ import sys
from sys import stdout
from struct import unpack
-_HAS_UJSON = False
-
-try:
- import ujson as json
-
- _HAS_UJSON = True
-except ImportError:
import json
_encoding = 'UTF-8'
@@ -29,11 +22,6 @@ if sys.version_info >= (3, 0):
return bytes(n, encoding)
def py3_json_dump(obj, indent):
- if _HAS_UJSON:
- if indent is None:
- indent = 0
- json.dump(obj, stdout, indent=indent)
- else:
json.dump(obj, stdout, indent=indent)
def py3_iterkeys(obj):
@@ -73,9 +61,6 @@ else: # Python 2x
kwargs = {}
if indent is not None:
kwargs['indent'] = indent
- if _HAS_UJSON:
- json.dump(obj, stdout, **kwargs)
- else:
json.dump(obj, stdout, encoding=_outenc, **kwargs)
def py2_iterkeys(obj):

MODIFY
setup.py
setup.py
@@ -78,7 +78,6 @@ setup(
install_requires=install_requires,
extras_require={
'snappy': ['python-snappy'],
- 'ujson': ['ujson'],
},
tests_require=['pytest', 'flake8', 'check-manifest'],
setup_requires=setup_requires

DELETE
t
-#!/usr/bin/env python
-
-import fastavro
-from avro.datafile import DataFileWriter
-from avro.io import DatumWriter
-import avro.schema
-try:
- import ujson as json
-except ImportError:
- import json
-
-
-def main(argv=None):
- import sys
- from argparse import ArgumentParser
-
- argv = argv or sys.argv
-
- parser = ArgumentParser(description='')
- parser.add_argument('type', choices=['fast', 'avro'], default='fast')
- parser.add_argument('--no-debug', '-nd', action='store_false',
- dest='debug', default=True)
- parser.add_argument('--both', '-b', action='store_true', default=False)
- args = parser.parse_args(argv[1:])
-
-
- reader = fastavro.reader(open('tests/avro-files/weather.avro', 'rb'))
- records = [
- {
- 'station': 'station1',
- 'time': 7,
- 'temp': 38,
- }
- ]
-
- schema = reader.schema
- schema.pop('doc')
-
- if args.both or args.type == 'fast':
- with open('w-fast.avro', 'wb') as out:
- if args.debug:
- import pdb; pdb.set_trace()
- fastavro.write(out, schema, records)
- elif args.both or args.type == 'avro':
- schema = avro.schema.parse(json.dumps(schema))
- with open('w-avro.avro', 'wb') as out:
- if args.debug:
- import pdb; pdb.set_trace()
- writer = DataFileWriter(out, DatumWriter(), schema)
- for record in records:
- writer.append(record)
- writer.close()
-
-
-if __name__ == '__main__':
- main()

MODIFY
tests/test_main_module.py
tests/test_main_module.py
from os.path import join, abspath, dirname
import pytest
-import fastavro
from fastavro.__main__ import main
data_dir = join(abspath(dirname(__file__)), 'avro-files')
@@ -15,25 +14,7 @@ def test_codecs():
assert 'null' in ret_val
-def test_dump_with_ujson():
- import ujson as ujson
- fastavro.six._HAS_UJSON = True
- fastavro.six.json = ujson
-
- # without pretty option
- argv = ['fastavro', join(data_dir, 'weather.avro')]
- main(argv)
-
- # with pretty option
- argv = ['fastavro', '-p', join(data_dir, 'weather.avro')]
- main(argv)
-
-
-def test_dump_with_standard_json():
- import json as stdjson
- fastavro.six._HAS_UJSON = False
- fastavro.six.json = stdjson
-
+def test_dump():
# without pretty option
argv = ['fastavro', join(data_dir, 'weather.avro')]
main(argv)

MODIFY
tox.ini
tox.ini
@@ -5,7 +5,6 @@ envlist = py27,py34,py35,py36,pypy,pypy3,packaging
deps =
pytest
flake8
- ujson
commands = ./run-tests.sh
[testenv:packaging]

remove ujson