Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make twine Python 3 only #437

Merged
merged 5 commits into from
Sep 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,7 @@ matrix:
env:
TOXENV: docs
- python: 3.7
- python: 2.7
- python: pypy3.5-6.0
- python: 3.6
- python: 3.5
- python: 3.4
- python: pypy2.7-6.0

install:
- pip install tox codecov
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
=========
Changelog
=========
* :feature:`437`: Twine now requires Python 3.6 or later.
* :bug:`491` Require requests 2.20 or later to avoid reported security
vulnerabilities in earlier releases.
* :release:`1.15.0 <2019-09-17>`
Expand Down
2 changes: 0 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
#
# twine documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 13 11:51:54 2013.
#
Expand Down
10 changes: 5 additions & 5 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ Testing
^^^^^^^

Tests with twine are run using `tox`_, and tested against the following Python
versions: 2.7, 3.4, 3,5, and 3.6. To run these tests locally, you will need to
have these versions of Python installed on your machine.
versions: 3.6 and 3.7. To run these tests locally, you will need to have these
versions of Python installed on your machine.

Either use ``tox`` to build against all supported Python versions (if
you have them installed) or use ``tox -e py{version}`` to test against
a specific version, e.g., ``tox -e py27`` or ``tox -e py34``.
Either use ``tox`` to build against all supported Python versions (if you have
them installed) or use ``tox -e py{version}`` to test against a specific
version, e.g., ``tox -e py36`` or ``tox -e py37``.

Also, always run ``tox -e lint`` before submitting a pull request.

Expand Down
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[bdist_wheel]
universal = 1

[check-manifest]
ignore =
.travis.yml
Expand Down
11 changes: 2 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,11 @@
"Operating System :: POSIX :: Linux",
"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 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],

packages=["twine", "twine.commands"],
Expand All @@ -68,7 +64,7 @@
],
},

python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
python_requires=">=3.6",
install_requires=[
"pkginfo >= 1.4.2",
"readme_renderer >= 21.0",
Expand All @@ -78,9 +74,6 @@
"tqdm >= 4.14",
],
extras_require={
'with-blake2': [
'pyblake2; python_version<"3.6" and platform_python_implementation=="CPython"',
],
'keyring': [
'keyring',
],
Expand Down
2 changes: 0 additions & 2 deletions tests/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import unicode_literals

import pretend

from twine.commands import check
Expand Down
3 changes: 0 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals

import pretend
import pytest

Expand Down
8 changes: 0 additions & 8 deletions tests/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import unicode_literals
import platform
from twine import package, exceptions

import pretend
Expand Down Expand Up @@ -214,12 +212,6 @@ def test_metadata_dictionary(gpg_signature):
'b657a4148d05bd0098c1d6d8cc4e14e766dbe93c3a5ab6723b969da27a87bac0',
)

if platform.python_implementation().lower() == 'pypy':
# pyblake2 refuses to install on PyPy
TWINE_1_5_0_WHEEL_HEXDIGEST = TWINE_1_5_0_WHEEL_HEXDIGEST._replace(
blake2=None,
)


def test_hash_manager():
"""Verify our HashManager works."""
Expand Down
1 change: 0 additions & 1 deletion tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import unicode_literals
import os.path
import textwrap

Expand Down
2 changes: 0 additions & 2 deletions tests/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import unicode_literals

import pretend
import pytest
from requests.exceptions import HTTPError
Expand Down
9 changes: 3 additions & 6 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals

import sys
import os.path
import textwrap
Expand Down Expand Up @@ -333,7 +330,7 @@ def keyring_no_backends(monkeypatch):
has no backends for the system, the backend will be a
fail.Keyring, which raises RuntimeError on get_password.
"""
class FailKeyring(object):
class FailKeyring:
@staticmethod
def get_password(system, username):
raise RuntimeError("fail!")
Expand All @@ -347,7 +344,7 @@ def keyring_no_backends_get_credential(monkeypatch):
has no backends for the system, the backend will be a
fail.Keyring, which raises RuntimeError on get_password.
"""
class FailKeyring(object):
class FailKeyring:
@staticmethod
def get_credential(system, username):
raise RuntimeError("fail!")
Expand All @@ -371,7 +368,7 @@ def test_get_password_runtime_error_suppressed(


def test_no_positional_on_method():
class T(object):
class T:
@utils.no_positional(allow_self=True)
def __init__(self, foo=False):
self.foo = foo
Expand Down
12 changes: 5 additions & 7 deletions tests/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import unicode_literals

from twine import wheel

import pytest
Expand All @@ -32,11 +30,11 @@ def test_version_parsing(example_wheel):

def test_find_metadata_files():
names = [
b'package/lib/__init__.py',
b'package/lib/version.py',
b'package/METADATA.txt',
b'package/METADATA.json',
b'package/METADATA',
'package/lib/__init__.py',
'package/lib/version.py',
'package/METADATA.txt',
'package/METADATA.json',
'package/METADATA',
]
expected = [
['package', 'METADATA'],
Expand Down
5 changes: 2 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
[tox]
minversion = 2.4
envlist = lint,docs,py37,py27,pypy3,py36,py35,py34,pypy
envlist = lint,docs,py37,py36

[testenv]
deps =
coverage
pretend
pytest
extras =
with-blake2
commands =
coverage run --source twine -m pytest {posargs:tests}
coverage report -m
Expand All @@ -25,6 +23,7 @@ commands =
twine check dist/*

[testenv:release]
basepython = python3
deps =
wheel
commands =
Expand Down
2 changes: 0 additions & 2 deletions twine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import, division, print_function

__all__ = (
"__title__", "__summary__", "__uri__", "__version__", "__author__",
"__email__", "__license__", "__copyright__",
Expand Down
5 changes: 1 addition & 4 deletions twine/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# Copyright 2013 Donald Stufft
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -12,9 +12,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals

import sys

import requests
Expand Down
3 changes: 0 additions & 3 deletions twine/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals

import argparse
import pkg_resources
import setuptools
Expand Down
3 changes: 0 additions & 3 deletions twine/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals

import glob
import os.path

Expand Down
5 changes: 1 addition & 4 deletions twine/commands/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals

import argparse
import cgi
import re
Expand Down Expand Up @@ -45,7 +42,7 @@
)


class _WarningStream(object):
class _WarningStream:
def __init__(self):
self.output = StringIO()

Expand Down
6 changes: 2 additions & 4 deletions twine/commands/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import, unicode_literals, print_function

import argparse
import os.path

Expand All @@ -24,12 +22,12 @@
def register(register_settings, package):
repository_url = register_settings.repository_config['repository']

print("Registering package to {}".format(repository_url))
print(f"Registering package to {repository_url}")
repository = register_settings.create_repository()

if not os.path.exists(package):
raise exceptions.PackageNotFound(
'"{}" does not exist on the file system.'.format(package)
f'"{package}" does not exist on the file system.'
)

resp = repository.register(
Expand Down
7 changes: 2 additions & 5 deletions twine/commands/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals

import argparse
import os.path

Expand All @@ -28,7 +25,7 @@ def skip_upload(response, skip_existing, package):
filename = package.basefilename
msg_400 = (
# Old PyPI message:
'A file named "{}" already exists for'.format(filename),
f'A file named "{filename}" already exists for',
# Warehouse message:
'File already exists',
# Nexus Repository OSS message:
Expand Down Expand Up @@ -60,7 +57,7 @@ def upload(upload_settings, dists):
upload_settings.check_repository_url()
repository_url = upload_settings.repository_config['repository']

print("Uploading distributions to {}".format(repository_url))
print(f"Uploading distributions to {repository_url}")

repository = upload_settings.create_repository()
uploaded_packages = []
Expand Down
Loading