Skip to content

Commit

Permalink
Merge pull request #593 from launchableinc/drop-python-3.5
Browse files Browse the repository at this point in the history
Drop python 3.5
  • Loading branch information
Konboi authored Jul 31, 2023
2 parents d36dc17 + 6d678d0 commit 733ad78
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8, 3.9, "3.10"]
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04, windows-latest]
python-version: [3.5, 3.6, 3.7, 3.8, 3.9, "3.10"]
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.5.10
3.6.15
8 changes: 4 additions & 4 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ url = "https://pypi.org/simple"
verify_ssl = true

[requires]
python_version = "3.5"
python_version = "3.6"

[dev-packages]
flake8 = "*"
setuptools = ">=30.3.0"
setuptools-scm = "*"
wheel = "*"
# The last flake8 version that supports Python 3.5 specifies "pycodestyle >=
# 2.7.0, < 2.8.0". The latest autopep8 specifies "pycodestyle >= 2.8.0". This
# conflict cannot be resolved. Pin the version to resolve this.
# The last flake8 version that supports Python 3.6 specifies "pycodestyle >=
# 2.9.0, < 2.10.0". ref: https://github.com/PyCQA/flake8/pull/1633
# The latest autopep8 specifies "pycodestyle >= 2.10.0". This conflict cannot be resolved. Pin the version to resolve this.
autopep8 = "<=1.5.7"
importlib-metadata = "<5.0"
isort = "*"
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ pip install pipenv==2021.5.29
pipenv install --dev
```

Note that you will need to use 2021.5.29 as the Python version is fixed at 3.5,
and the Pipenv beyond that version won't support Python 3.5 or below.

If you mess up your local pipenv, `pipenv --rm` will revert the operation above.

In order to automatically format files with autopep8, this repository contains a
configuration for [pre-commit](https://pre-commit.com). Install the hook with
`pipenv run pre-commit install`.
Expand Down Expand Up @@ -65,7 +60,7 @@ You can install the `launchable` command from either source or [pypi](https://py

## Prerequisite

- \>= Python 3.5
- \>= Python 3.6
- \>= Java 8

## Install from source
Expand Down
8 changes: 2 additions & 6 deletions launchable/commands/stats/test_sessions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from typing import List
from typing import Any, Dict, List

import click

Expand Down Expand Up @@ -31,11 +31,7 @@ def test_sessions(
days: int,
flavor: List[str] = [],
):
# We originally wanted to write it like `params: Dict[str, Any]`, but python 3.5 does not support it,
# so we gave an empty list in the 'flavor' key to give a type hint.
# If we don't write this, `pip run type` will assume it is Dict[str, int],
# and the check will not pass.
params = {'days': days, 'flavor': []}
params: Dict[str, Any] = {'days': days, 'flavor': []}
flavors = []
for f in normalize_key_value_types(flavor):
flavors.append('%s=%s' % (f[0], f[1]))
Expand Down
6 changes: 3 additions & 3 deletions launchable/commands/verify.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import platform
import re
import sys
import subprocess
import sys
from typing import List

import click
Expand Down Expand Up @@ -101,8 +101,8 @@ def verify():
# Level 2 check: versions. This is more fragile than just reporting the number, so we move
# this out here

if compare_version([int(x) for x in platform.python_version().split('.')], [3, 5]) < 0:
raise click.UsageError(click.style("Python 3.5 or later is required", fg="red"))
if compare_version([int(x) for x in platform.python_version().split('.')], [3, 6]) < 0:
raise click.UsageError(click.style("Python 3.6 or later is required", fg="red"))

if check_java_version(java) < 0:
raise click.UsageError(click.style("Java 8 or later is required", fg="red"))
Expand Down
17 changes: 1 addition & 16 deletions launchable/utils/key_value_type.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
from typing import List, Sequence, Tuple
from typing import List, Tuple


def normalize_key_value_types(kv_types_raw: List[str]) -> List[Tuple[str, str]]:
"""Normalize key/value list, because the type of the key/value list specified in the command line flags differs depending
on the version of the click.
TODO: handle extraction of key/value tuple to dict in better way for >=click8.0 that returns tuple of tuples as tuple
of str
E.G.
<click8.0:
`launchable record session --build aaa --flavor os=ubuntu --flavor python=3.5`
is parsed as build=aaa, flavor=(("os", "ubuntu"), ("python", "3.5"))
>=click8.0:
`launchable record session --build aaa --flavor os=ubuntu --flavor python=3.8`
is parsed as build=aaa, flavor=("('os', 'ubuntu')", "('python', '3.8')")
"""
kvs = []
for kv in kv_types_raw:
if isinstance(kv, str):
k, v = kv.replace("(", "").replace(")", "").replace("'", "").split(",")
kvs.append((k.strip(), v.strip()))
elif isinstance(kv, Sequence):
kvs.append((kv[0], kv[1]))

return kvs
7 changes: 1 addition & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,16 @@ classifiers =
[options]
packages = find:
install_requires =
click~=7.0;python_version<'3.6'
click>=8.0,<8.1;python_version=='3.6'
click>=8.1;python_version>'3.6'
requests>=2.25;python_version>='3.6'
# requests dropped python 3.5 support since v2.26
requests>=2.25,<2.26;python_version<'3.6'
urllib3>=1.26
junitparser>=2.0.0
setuptools
more_itertools>=7.1.0;python_version>='3.6'
# more_itertools dropped python 3.5 support since v8.6
more_itertools>=7.1.0,<8.6;python_version<'3.6'
python-dateutil
tabulate
python_requires = >=3.5
python_requires = >=3.6
setup_requires =
setuptools-scm

Expand Down
5 changes: 0 additions & 5 deletions tests/utils/test_key_value_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,5 @@

class NormalizeKeyValueTest(TestCase):
def test_normalize_key_value_types(self):
# <click8.0
result = normalize_key_value_types((("os", "ubuntu"), ("python", "3.5")))
self.assertEqual(result, [("os", "ubuntu"), ("python", "3.5")])

# >=click8.0
result = normalize_key_value_types(("('os', 'ubuntu')", "('python', '3.8')"))
self.assertEqual(result, [("os", "ubuntu"), ("python", "3.8")])

0 comments on commit 733ad78

Please sign in to comment.