summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml28
-rw-r--r--Dockerfile4
-rw-r--r--README.rst1
-rw-r--r--docs/cli.rst2
-rw-r--r--docs/ext/docstrings.py3
-rw-r--r--gitlab/__init__.py7
-rw-r--r--gitlab/config.py3
-rw-r--r--gitlab/tests/test_cli.py7
-rw-r--r--gitlab/tests/test_config.py22
-rw-r--r--gitlab/utils.py4
-rw-r--r--gitlab/v4/cli.py6
-rw-r--r--requirements.txt3
-rw-r--r--setup.py11
-rwxr-xr-xtools/generate_token.py2
-rw-r--r--tox.ini2
15 files changed, 39 insertions, 66 deletions
diff --git a/.travis.yml b/.travis.yml
index b631f21..83d2d33 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,50 +21,32 @@ jobs:
- stage: lint
name: black_lint
dist: bionic
- python: 3.7
+ python: 3.8
script:
- pip3 install -U --pre black
- black --check .
- stage: test
name: cli_func_v4
dist: bionic
- python: 3.7
+ python: 3.8
script:
- pip3 install tox
- tox -e cli_func_v4
- stage: test
name: py_func_v4
dist: bionic
- python: 3.7
+ python: 3.8
script:
- pip3 install tox
- tox -e py_func_v4
- stage: test
name: docs
dist: bionic
- python: 3.7
+ python: 3.8
script:
- pip3 install tox
- tox -e docs
- stage: test
- name: py27
- python: 2.7
- script:
- - pip2 install tox
- - tox -e py27
- - stage: test
- name: py34
- python: 3.4
- script:
- - pip3 install tox
- - tox -e py34
- - stage: test
- name: py35
- python: 3.5
- script:
- - pip3 install tox
- - tox -e py35
- - stage: test
name: py36
python: 3.6
dist: bionic
@@ -81,7 +63,7 @@ jobs:
- stage: test
dist: bionic
name: py38
- python: 3.8-dev
+ python: 3.8
script:
- pip3 install tox
- tox -e py38
diff --git a/Dockerfile b/Dockerfile
index 489a420..1eb7f8b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,10 +1,10 @@
-FROM python:3.7-alpine AS build
+FROM python:3.8-alpine AS build
WORKDIR /opt/python-gitlab
COPY . .
RUN python setup.py bdist_wheel
-FROM python:3.7-alpine
+FROM python:3.8-alpine
WORKDIR /opt/python-gitlab
COPY --from=build /opt/python-gitlab/dist dist/
diff --git a/README.rst b/README.rst
index bb87081..3802bcb 100644
--- a/README.rst
+++ b/README.rst
@@ -32,7 +32,6 @@ Requirements
python-gitlab depends on:
* `python-requests <http://docs.python-requests.org/en/latest/>`_
-* `six <https://six.readthedocs.io/>`_
Install with pip
----------------
diff --git a/docs/cli.rst b/docs/cli.rst
index e87c6d1..3207902 100644
--- a/docs/cli.rst
+++ b/docs/cli.rst
@@ -162,7 +162,7 @@ These options must be defined before the mandatory arguments.
**Notice:**
The `PyYAML package <https://pypi.org/project/PyYAML/>`_ is required to use the yaml output option.
- You need to install it separately using ``pip install PyYAML``
+ You need to install it explicitly using ``pip install python-gitlab[yaml]``
``--fields``, ``-f``
Comma-separated list of fields to display (``yaml`` and ``json`` output
diff --git a/docs/ext/docstrings.py b/docs/ext/docstrings.py
index e42bb60..754da27 100644
--- a/docs/ext/docstrings.py
+++ b/docs/ext/docstrings.py
@@ -3,7 +3,6 @@ import itertools
import os
import jinja2
-import six
import sphinx
import sphinx.ext.napoleon as napoleon
from sphinx.ext.napoleon.docstring import GoogleDocstring
@@ -25,7 +24,7 @@ def setup(app):
conf = napoleon.Config._config_values
- for name, (default, rebuild) in six.iteritems(conf):
+ for name, (default, rebuild) in conf.items():
app.add_config_value(name, default, rebuild)
return {"version": sphinx.__display_version__, "parallel_read_safe": True}
diff --git a/gitlab/__init__.py b/gitlab/__init__.py
index be9e01f..b377023 100644
--- a/gitlab/__init__.py
+++ b/gitlab/__init__.py
@@ -23,7 +23,6 @@ import time
import warnings
import requests
-import six
import gitlab.config
from gitlab.const import * # noqa
@@ -31,7 +30,7 @@ from gitlab.exceptions import * # noqa
from gitlab import utils # noqa
__title__ = "python-gitlab"
-__version__ = "1.15.0"
+__version__ = "2.0.0"
__author__ = "Gauvain Pocentek"
__email__ = "gauvainpocentek@gmail.com"
__license__ = "LGPL3"
@@ -47,8 +46,8 @@ REDIRECT_MSG = (
def _sanitize(value):
if isinstance(value, dict):
- return dict((k, _sanitize(v)) for k, v in six.iteritems(value))
- if isinstance(value, six.string_types):
+ return dict((k, _sanitize(v)) for k, v in value.items())
+ if isinstance(value, str):
return value.replace("/", "%2F")
return value
diff --git a/gitlab/config.py b/gitlab/config.py
index 4b4d6fd..b2c0dbf 100644
--- a/gitlab/config.py
+++ b/gitlab/config.py
@@ -16,8 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
-
-from six.moves import configparser
+import configparser
_DEFAULT_FILES = ["/etc/python-gitlab.cfg", os.path.expanduser("~/.python-gitlab.cfg")]
diff --git a/gitlab/tests/test_cli.py b/gitlab/tests/test_cli.py
index 04a1961..4820103 100644
--- a/gitlab/tests/test_cli.py
+++ b/gitlab/tests/test_cli.py
@@ -20,6 +20,7 @@ import argparse
import os
import tempfile
import unittest
+import io
try:
from contextlib import redirect_stderr # noqa: H302
@@ -34,8 +35,6 @@ except ImportError:
sys.stderr = old_target
-import six
-
from gitlab import cli
import gitlab.v4.cli
@@ -56,7 +55,7 @@ class TestCLI(unittest.TestCase):
self.assertEqual("class", cli.cls_to_what(Class))
def test_die(self):
- fl = six.StringIO()
+ fl = io.StringIO()
with redirect_stderr(fl):
with self.assertRaises(SystemExit) as test:
cli.die("foobar")
@@ -83,7 +82,7 @@ class TestCLI(unittest.TestCase):
self.assertEqual(ret, "content")
os.unlink(temp_path)
- fl = six.StringIO()
+ fl = io.StringIO()
with redirect_stderr(fl):
with self.assertRaises(SystemExit) as exc:
cli._parse_value("@/thisfileprobablydoesntexist")
diff --git a/gitlab/tests/test_config.py b/gitlab/tests/test_config.py
index a43f977..65bd300 100644
--- a/gitlab/tests/test_config.py
+++ b/gitlab/tests/test_config.py
@@ -18,7 +18,7 @@
import unittest
import mock
-import six
+import io
from gitlab import config
@@ -80,16 +80,16 @@ class TestConfigParser(unittest.TestCase):
config.GitlabConfigParser("test")
@mock.patch("os.path.exists")
- @mock.patch("six.moves.builtins.open")
+ @mock.patch("builtins.open")
def test_invalid_id(self, m_open, path_exists):
- fd = six.StringIO(no_default_config)
+ fd = io.StringIO(no_default_config)
fd.close = mock.Mock(return_value=None)
m_open.return_value = fd
path_exists.return_value = True
config.GitlabConfigParser("there")
self.assertRaises(config.GitlabIDError, config.GitlabConfigParser)
- fd = six.StringIO(valid_config)
+ fd = io.StringIO(valid_config)
fd.close = mock.Mock(return_value=None)
m_open.return_value = fd
self.assertRaises(
@@ -97,9 +97,9 @@ class TestConfigParser(unittest.TestCase):
)
@mock.patch("os.path.exists")
- @mock.patch("six.moves.builtins.open")
+ @mock.patch("builtins.open")
def test_invalid_data(self, m_open, path_exists):
- fd = six.StringIO(missing_attr_config)
+ fd = io.StringIO(missing_attr_config)
fd.close = mock.Mock(return_value=None, side_effect=lambda: fd.seek(0))
m_open.return_value = fd
path_exists.return_value = True
@@ -117,9 +117,9 @@ class TestConfigParser(unittest.TestCase):
self.assertEqual("Unsupported per_page number: 200", emgr.exception.args[0])
@mock.patch("os.path.exists")
- @mock.patch("six.moves.builtins.open")
+ @mock.patch("builtins.open")
def test_valid_data(self, m_open, path_exists):
- fd = six.StringIO(valid_config)
+ fd = io.StringIO(valid_config)
fd.close = mock.Mock(return_value=None)
m_open.return_value = fd
path_exists.return_value = True
@@ -133,7 +133,7 @@ class TestConfigParser(unittest.TestCase):
self.assertEqual(True, cp.ssl_verify)
self.assertIsNone(cp.per_page)
- fd = six.StringIO(valid_config)
+ fd = io.StringIO(valid_config)
fd.close = mock.Mock(return_value=None)
m_open.return_value = fd
cp = config.GitlabConfigParser(gitlab_id="two")
@@ -144,7 +144,7 @@ class TestConfigParser(unittest.TestCase):
self.assertEqual(10, cp.timeout)
self.assertEqual(False, cp.ssl_verify)
- fd = six.StringIO(valid_config)
+ fd = io.StringIO(valid_config)
fd.close = mock.Mock(return_value=None)
m_open.return_value = fd
cp = config.GitlabConfigParser(gitlab_id="three")
@@ -156,7 +156,7 @@ class TestConfigParser(unittest.TestCase):
self.assertEqual("/path/to/CA/bundle.crt", cp.ssl_verify)
self.assertEqual(50, cp.per_page)
- fd = six.StringIO(valid_config)
+ fd = io.StringIO(valid_config)
fd.close = mock.Mock(return_value=None)
m_open.return_value = fd
cp = config.GitlabConfigParser(gitlab_id="four")
diff --git a/gitlab/utils.py b/gitlab/utils.py
index 94528e1..0992ed7 100644
--- a/gitlab/utils.py
+++ b/gitlab/utils.py
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import six
+from urllib.parse import urlparse
class _StdoutStream(object):
@@ -52,6 +52,6 @@ def clean_str_id(id):
def sanitized_url(url):
- parsed = six.moves.urllib.parse.urlparse(url)
+ parsed = urlparse(url)
new_path = parsed.path.replace(".", "%2E")
return parsed._replace(path=new_path).geturl()
diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py
index 6fc41ac..a875261 100644
--- a/gitlab/v4/cli.py
+++ b/gitlab/v4/cli.py
@@ -21,8 +21,6 @@ import inspect
import operator
import sys
-import six
-
import gitlab
import gitlab.base
from gitlab import cli
@@ -321,7 +319,7 @@ def extend_parser(parser):
def get_dict(obj, fields):
- if isinstance(obj, six.string_types):
+ if isinstance(obj, str):
return obj
if fields:
@@ -441,7 +439,7 @@ def run(gl, what, action, args, verbose, output, fields):
printer.display_list(data, fields, verbose=verbose)
elif isinstance(data, gitlab.base.RESTObject):
printer.display(get_dict(data, fields), verbose=verbose, obj=data)
- elif isinstance(data, six.string_types):
+ elif isinstance(data, str):
print(data)
elif hasattr(data, "decode"):
print(data.decode())
diff --git a/requirements.txt b/requirements.txt
index 9c3f4d6..d5c2bc9 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1 @@
-requests>=2.4.2
-six
+requests>=2.22.0
diff --git a/setup.py b/setup.py
index 6f52ecc..da02f9f 100644
--- a/setup.py
+++ b/setup.py
@@ -25,7 +25,7 @@ setup(
license="LGPLv3",
url="https://github.com/python-gitlab/python-gitlab",
packages=find_packages(),
- install_requires=["requests>=2.4.2", "six"],
+ install_requires=["requests>=2.22.0"],
entry_points={"console_scripts": ["gitlab = gitlab.cli:main"]},
classifiers=[
"Development Status :: 5 - Production/Stable",
@@ -36,14 +36,13 @@ setup(
"Operating System :: POSIX",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python",
- "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 :: 3.8",
],
- extras_require={"autocompletion": ["argcomplete>=1.10.0,<2"]},
+ extras_require={
+ "autocompletion": ["argcomplete>=1.10.0,<2"],
+ "yaml": ["PyYaml>=5.2"],
+ },
)
diff --git a/tools/generate_token.py b/tools/generate_token.py
index 10ca891..89909bd 100755
--- a/tools/generate_token.py
+++ b/tools/generate_token.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-from six.moves.urllib.parse import urljoin
+from urllib.parse import urljoin
from requests_html import HTMLSession
ENDPOINT = "http://localhost:8080"
diff --git a/tox.ini b/tox.ini
index db28f6e..0aa43f0 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,7 +1,7 @@
[tox]
minversion = 1.6
skipsdist = True
-envlist = py38,py37,py36,py35,py34,py27,pep8,black
+envlist = py38,py37,py36,pep8,black
[testenv]
setenv = VIRTUAL_ENV={envdir}