Skip to content

Commit

Permalink
Merge 068bc95 into ff77daa
Browse files Browse the repository at this point in the history
  • Loading branch information
penguinolog committed Sep 4, 2018
2 parents ff77daa + 068bc95 commit 1bea8e9
Show file tree
Hide file tree
Showing 30 changed files with 438 additions and 1,594 deletions.
10 changes: 2 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ sudo: false
language: python
os: linux
python:
- 2.7
- 3.4
- 3.5
- 3.6
- &mainstream_python 3.7-dev
- &mainstream_python 2.7
- &pypy pypy
- pypy3.5
install:
- &upgrade_python_toolset pip install --upgrade pip setuptools wheel
- pip install tox-travis
Expand Down Expand Up @@ -49,8 +44,7 @@ jobs:
- docker
install:
- *upgrade_python_toolset
script:
- ./tools/run_docker.sh "threaded"
script: []
before_deploy:
- pip install -r build_requirements.txt
- python setup.py bdist_wheel
Expand Down
8 changes: 2 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,9 @@ Pros:
::

Python 2.7
Python 3.4
Python 3.5
Python 3.6
Python 3.7
PyPy
PyPy3 3.5+
Jyton 2.7

.. note:: Update to version 2.0+ for usage with python 3.4+. This version is for legacy python and no new features are planned.

Decorators:

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
six >=1.10.0
futures>=3.1 ; python_version == "2.7"
typing >= 3.6 ; python_version < "3.8"
62 changes: 3 additions & 59 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,11 @@
import collections
from distutils.command import build_ext
import distutils.errors
import glob
import os.path
import shutil
import sys

try:
from Cython.Build import cythonize
import gevent
except ImportError:
gevent = cythonize = None

import setuptools

PY3 = sys.version_info[:2] > (2, 7) # type: bool

with open(
os.path.join(
os.path.dirname(__file__),
Expand All @@ -50,35 +40,7 @@
long_description = f.read()


def _extension(modpath):
"""Make setuptools.Extension."""
return setuptools.Extension(modpath, [modpath.replace('.', '/') + '.py'])


requires_optimization = [
_extension('threaded._class_decorator'),
_extension('threaded._base_threaded'),
_extension('threaded._py3_helpers'),
_extension('threaded._threaded3'),
_extension('threaded._base_gthreadpooled'),
_extension('threaded._gthreadpooled3'),
]

if 'win32' != sys.platform:
requires_optimization.append(
_extension('threaded.__init__')
)

ext_modules = cythonize(
requires_optimization,
compiler_directives=dict(
always_allow_keywords=True,
binding=True,
embedsignature=True,
overflowcheck=True,
language_level=3,
)
) if cythonize is not None and PY3 else []
ext_modules = []


class BuildFailed(Exception):
Expand Down Expand Up @@ -176,8 +138,6 @@ def get_simple_vars_from_src(src):
ast.Str, ast.Num,
ast.List, ast.Set, ast.Dict, ast.Tuple
)
if PY3:
ast_data += (ast.Bytes, ast.NameConstant,)

tree = ast.parse(src)

Expand Down Expand Up @@ -221,11 +181,6 @@ def get_simple_vars_from_src(src):

'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',

'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
Expand Down Expand Up @@ -255,7 +210,7 @@ def get_simple_vars_from_src(src):
long_description=long_description,
classifiers=classifiers,
keywords=keywords,
python_requires='>=2.7.5,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
python_requires='>=2.7.5,<3.0',
# While setuptools cannot deal with pre-installed incompatible versions,
# setting a lower bound is not harmful - it makes error messages cleaner. DO
# NOT set an upper bound on setuptools, as that will lead to uninstallable
Expand All @@ -266,26 +221,15 @@ def get_simple_vars_from_src(src):
"!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2,"
"!=36.2.0",
extras_require={
':python_version == "2.7"': [
'futures>=3.1',
],
'gevent': [
'gevent >= 1.2.2'
],
},
install_requires=required,
package_data={
'threaded': [
os.path.basename(filename)
for filename in glob.glob(os.path.join('threaded', '*.pyi'))
] + [
'py.typed'
],
'threaded': ['py.typed'],
},
)
if PY3 and cythonize is not None:
setup_args['ext_modules'] = ext_modules
setup_args['cmdclass'] = dict(build_ext=AllowFailRepair)

try:
setuptools.setup(**setup_args)
Expand Down
17 changes: 6 additions & 11 deletions test/test_gevent_threadpooled.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,14 @@
except ImportError:
gevent = None

import six

import threaded

if six.PY3:
from os import cpu_count
else:
try:
from multiprocessing import cpu_count
except ImportError:
def cpu_count():
"""Fake CPU count."""
return 1
try:
from multiprocessing import cpu_count
except ImportError:
def cpu_count():
"""Fake CPU count."""
return 1


@unittest.skipIf(gevent is None, 'No gevent')
Expand Down
17 changes: 6 additions & 11 deletions test/test_pooled.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,14 @@
import threading
import unittest

import six

import threaded

if six.PY3:
from os import cpu_count
else:
try:
from multiprocessing import cpu_count
except ImportError:
def cpu_count():
"""Fake CPU count."""
return 1
try:
from multiprocessing import cpu_count
except ImportError:
def cpu_count():
"""Fake CPU count."""
return 1


class TestThreadPooled(unittest.TestCase):
Expand Down
111 changes: 0 additions & 111 deletions test/test_pooled_async.py

This file was deleted.

11 changes: 3 additions & 8 deletions test/test_threaded.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,11 @@

import unittest

import six

import threaded

# pylint: disable=import-error
if six.PY2:
# noinspection PyUnresolvedReferences
import mock
else:
from unittest import mock

# noinspection PyUnresolvedReferences
import mock


class ThreadedTest(unittest.TestCase):
Expand Down

0 comments on commit 1bea8e9

Please sign in to comment.