Skip to content

Commit

Permalink
Drop support for Python 3.5
Browse files Browse the repository at this point in the history
Allows dropping dependency on pyblake2, as it is now available in
hashlib.

Allows using f-strings instead of simple string formatting.

Allows for future use of type hinting.

PyPy3 is Python 3.5, so that support has been removed as well.
  • Loading branch information
jdufresne committed Jun 12, 2019
1 parent 94b8cef commit 06663c5
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 38 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ matrix:
env:
TOXENV: docs
- python: 3.7
- python: pypy3.5-6.0
- python: 3.6
- python: 3.5

install:
- pip install tox codecov
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: 3,5, 3.6, and 3.7. 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
7 changes: 1 addition & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"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",
],

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

python_requires=">=3.5",
python_requires=">=3.6",
install_requires=[
"pkginfo >= 1.4.2",
"readme_renderer >= 21.0",
Expand All @@ -76,9 +74,6 @@
"tqdm >= 4.14",
],
extras_require={
'with-blake2': [
'pyblake2; python_version<"3.6" and platform_python_implementation=="CPython"',
],
'keyring': [
'keyring',
],
Expand Down
7 changes: 0 additions & 7 deletions tests/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +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.
import platform
from twine import package

import pretend
Expand Down Expand Up @@ -171,12 +170,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
4 changes: 1 addition & 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,pypy3,py36,py35
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 Down
4 changes: 2 additions & 2 deletions twine/commands/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,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
4 changes: 2 additions & 2 deletions twine/commands/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,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 @@ -57,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()

Expand Down
11 changes: 2 additions & 9 deletions twine/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,11 @@
import io
import os
import subprocess
from hashlib import blake2b

import pkginfo
import pkg_resources

try:
from hashlib import blake2b
except ImportError:
try:
from pyblake2 import blake2b
except ImportError:
blake2b = None

from twine.wheel import Wheel
from twine.wininst import WinInst
from twine import exceptions
Expand Down Expand Up @@ -159,7 +152,7 @@ def add_gpg_signature(self, signature_filepath, signature_filename):
self.gpg_signature = (signature_filename, gpg.read())

def sign(self, sign_with, identity):
print("Signing {}".format(self.basefilename))
print(f"Signing {self.basefilename}")
gpg_args = (sign_with, "--detach-sign")
if identity:
gpg_args += ("--local-user", identity)
Expand Down
4 changes: 2 additions & 2 deletions twine/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def register(self, package):
"protocol_version": "1",
})

print("Registering {}".format(package.basefilename))
print(f"Registering {package.basefilename}")

data_to_send = self._convert_data_to_list_of_tuples(data)
encoder = MultipartEncoder(data_to_send)
Expand All @@ -130,7 +130,7 @@ def _upload(self, package):

data_to_send = self._convert_data_to_list_of_tuples(data)

print("Uploading {}".format(package.basefilename))
print(f"Uploading {package.basefilename}")

with open(package.filename, "rb") as fp:
data_to_send.append((
Expand Down

0 comments on commit 06663c5

Please sign in to comment.