remove dependency on Six
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 63ad16d..5fadc27 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -483,7 +483,7 @@
- name: Python setup
run: |
- python -m pip install --upgrade pip setuptools wheel flake8 six tornado twisted zope.interface
+ python -m pip install --upgrade pip setuptools wheel flake8 tornado twisted zope.interface
python --version
pip --version
diff --git a/build/appveyor/MSVC-appveyor-full.bat b/build/appveyor/MSVC-appveyor-full.bat
index d0f0347..dcdf843 100644
--- a/build/appveyor/MSVC-appveyor-full.bat
+++ b/build/appveyor/MSVC-appveyor-full.bat
@@ -131,7 +131,6 @@
pip.exe ^
install backports.ssl_match_hostname ^
ipaddress ^
- six ^
tornado ^
twisted || EXIT /B
diff --git a/build/docker/ubuntu-focal/Dockerfile b/build/docker/ubuntu-focal/Dockerfile
index a29ec69..84bbee1 100644
--- a/build/docker/ubuntu-focal/Dockerfile
+++ b/build/docker/ubuntu-focal/Dockerfile
@@ -260,7 +260,6 @@
python3-all-dev \
python3-pip \
python3-setuptools \
- python3-six \
python3-tornado \
python3-twisted \
python3-wheel \
diff --git a/build/docker/ubuntu-jammy/Dockerfile b/build/docker/ubuntu-jammy/Dockerfile
index 5fa6e6f..0505bf5 100644
--- a/build/docker/ubuntu-jammy/Dockerfile
+++ b/build/docker/ubuntu-jammy/Dockerfile
@@ -259,7 +259,6 @@
python3-all-dev \
python3-pip \
python3-setuptools \
- python3-six \
python3-tornado \
python3-twisted \
python3-wheel \
diff --git a/contrib/Vagrantfile b/contrib/Vagrantfile
index d4a7b82..a5371dd 100644
--- a/contrib/Vagrantfile
+++ b/contrib/Vagrantfile
@@ -46,7 +46,7 @@
sudo apt-get install -qq ant openjdk-8-jdk maven
# Python dependencies
-sudo apt-get install -qq python-all python-all-dev python-all-dbg python-setuptools python-support python-six python3-six
+sudo apt-get install -qq python-all python-all-dev python-all-dbg python-setuptools python-support
# Ruby dependencies
sudo apt-get install -qq ruby ruby-dev
diff --git a/debian/control b/debian/control
index 1b41991..06c0d48 100644
--- a/debian/control
+++ b/debian/control
@@ -32,7 +32,7 @@
Package: python-thrift
Architecture: any
Section: python
-Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}, python-six
+Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}
Recommends: python-twisted-web, python-backports.ssl-match-hostname, python-ipaddress
Provides: ${python:Provides}
Description: Python bindings for Thrift (Python 2)
@@ -65,7 +65,7 @@
Package: python3-thrift
Architecture: any
Section: python
-Depends: ${python3:Depends}, ${shlibs:Depends}, ${misc:Depends}, python3-six
+Depends: ${python3:Depends}, ${shlibs:Depends}, ${misc:Depends}
Recommends: python3-twisted-web
Provides: ${python:Provides}
Description: Python bindings for Thrift (Python 3)
diff --git a/lib/nodejs/examples/httpServer.py b/lib/nodejs/examples/httpServer.py
index 76e9f4a..bf3ef14 100644
--- a/lib/nodejs/examples/httpServer.py
+++ b/lib/nodejs/examples/httpServer.py
@@ -16,5 +16,5 @@
protoFactory = TJSONProtocol.TJSONProtocolFactory()
port = 9090
server = THttpServer.THttpServer(processor, ("localhost", port), protoFactory)
-print "Python server running on port " + str(port)
+print("Python server running on port " + str(port))
server.serve()
diff --git a/lib/py/setup.py b/lib/py/setup.py
index 3e10f01..066483e 100644
--- a/lib/py/setup.py
+++ b/lib/py/setup.py
@@ -113,7 +113,6 @@
author_email='dev@thrift.apache.org',
url='http://thrift.apache.org',
license='Apache License 2.0',
- install_requires=['six>=1.7.2'],
extras_require={
'ssl': ssl_deps,
'tornado': tornado_deps,
@@ -132,7 +131,6 @@
'Environment :: Console',
'Intended Audience :: Developers',
'Programming Language :: Python',
- 'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Topic :: Software Development :: Libraries',
'Topic :: System :: Networking'
diff --git a/lib/py/src/TSCons.py b/lib/py/src/TSCons.py
index bc67d70..633f67a 100644
--- a/lib/py/src/TSCons.py
+++ b/lib/py/src/TSCons.py
@@ -19,7 +19,6 @@
from os import path
from SCons.Builder import Builder
-from six.moves import map
def scons_env(env, add=''):
diff --git a/lib/py/src/protocol/TProtocol.py b/lib/py/src/protocol/TProtocol.py
index 339a283..bac54ae 100644
--- a/lib/py/src/protocol/TProtocol.py
+++ b/lib/py/src/protocol/TProtocol.py
@@ -21,10 +21,8 @@
from thrift.transport.TTransport import TTransportException
from ..compat import binary_to_str, str_to_binary
-import six
import sys
from itertools import islice
-from six.moves import zip
class TProtocolException(TException):
@@ -373,8 +371,8 @@
def writeContainerMap(self, val, spec):
ktype, kspec, vtype, vspec, _ = spec
self.writeMapBegin(ktype, vtype, len(val))
- for _ in zip(self._write_by_ttype(ktype, six.iterkeys(val), spec, kspec),
- self._write_by_ttype(vtype, six.itervalues(val), spec, vspec)):
+ for _ in zip(self._write_by_ttype(ktype, val.keys(), spec, kspec),
+ self._write_by_ttype(vtype, val.values(), spec, vspec)):
pass
self.writeMapEnd()
diff --git a/lib/py/src/server/THttpServer.py b/lib/py/src/server/THttpServer.py
index 47e817d..21f2c86 100644
--- a/lib/py/src/server/THttpServer.py
+++ b/lib/py/src/server/THttpServer.py
@@ -19,7 +19,7 @@
import ssl
-from six.moves import BaseHTTPServer
+import http.server as BaseHTTPServer
from thrift.Thrift import TMessageType
from thrift.server import TServer
diff --git a/lib/py/src/server/TNonblockingServer.py b/lib/py/src/server/TNonblockingServer.py
index 7694760..a7a40ca 100644
--- a/lib/py/src/server/TNonblockingServer.py
+++ b/lib/py/src/server/TNonblockingServer.py
@@ -32,7 +32,7 @@
import threading
from collections import deque
-from six.moves import queue
+import queue
from thrift.transport import TTransport
from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory
diff --git a/lib/py/src/server/TServer.py b/lib/py/src/server/TServer.py
index 8b2f938..81144f1 100644
--- a/lib/py/src/server/TServer.py
+++ b/lib/py/src/server/TServer.py
@@ -17,7 +17,7 @@
# under the License.
#
-from six.moves import queue
+import queue
import logging
import os
import threading
diff --git a/lib/py/src/transport/THttpClient.py b/lib/py/src/transport/THttpClient.py
index 82ca3d1..d545ce5 100644
--- a/lib/py/src/transport/THttpClient.py
+++ b/lib/py/src/transport/THttpClient.py
@@ -24,11 +24,11 @@
import warnings
import base64
-from six.moves import urllib
-from six.moves import http_client
+import urllib.parse
+import urllib.request
+import http.client
from .TTransport import TTransportBase
-import six
class THttpClient(TTransportBase):
@@ -60,9 +60,9 @@
self.scheme = parsed.scheme
assert self.scheme in ('http', 'https')
if self.scheme == 'http':
- self.port = parsed.port or http_client.HTTP_PORT
+ self.port = parsed.port or http.client.HTTP_PORT
elif self.scheme == 'https':
- self.port = parsed.port or http_client.HTTPS_PORT
+ self.port = parsed.port or http.client.HTTPS_PORT
self.certfile = cert_file
self.keyfile = key_file
self.context = ssl.create_default_context(cafile=cafile) if (cafile and not ssl_context) else ssl_context
@@ -107,10 +107,10 @@
def open(self):
if self.scheme == 'http':
- self.__http = http_client.HTTPConnection(self.host, self.port,
+ self.__http = http.client.HTTPConnection(self.host, self.port,
timeout=self.__timeout)
elif self.scheme == 'https':
- self.__http = http_client.HTTPSConnection(self.host, self.port,
+ self.__http = http.client.HTTPSConnection(self.host, self.port,
key_file=self.keyfile,
cert_file=self.certfile,
timeout=self.__timeout,
@@ -173,7 +173,7 @@
self.__http.putheader('User-Agent', user_agent)
if self.__custom_headers:
- for key, val in six.iteritems(self.__custom_headers):
+ for key, val in self.__custom_headers.items():
self.__http.putheader(key, val)
# Saves the cookie sent by the server in the previous response.