Skip to content

Commit

Permalink
Merge pull request #75 from ymyzk/drop-py27-py35-support
Browse files Browse the repository at this point in the history
tox4: Remove support for Python 2.7 and 3.5
  • Loading branch information
ymyzk committed Sep 4, 2021
2 parents 1223231 + 8bd6715 commit 66125d6
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 104 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Expand Up @@ -17,7 +17,7 @@ jobs:
- macos-latest # macOS-10.15
- windows-2016
- windows-latest # windows-2019
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, pypy-2.7, pypy-3.6, pypy-3.7]
python-version: [3.6, 3.7, 3.8, 3.9, pypy-3.6, pypy-3.7]

steps:
- uses: actions/checkout@v1
Expand Down
52 changes: 22 additions & 30 deletions README.md
Expand Up @@ -21,8 +21,7 @@ When running tox on GitHub Actions, tox-gh-actions

## Examples
### Basic Example
The following configuration will create 5 jobs when running the workflow on GitHub Actions.
- On Python 2.7 job, tox runs `py27` environment
The following configuration will create 4 jobs when running the workflow on GitHub Actions.
- On Python 3.6 job, tox runs `py36` environment
- On Python 3.7 job, tox runs `py37` environment
- On Python 3.8 job, tox runs `py38` and `mypy` environments
Expand All @@ -34,11 +33,10 @@ Add `[gh-actions]` section to the same file as tox's configuration.
If you're using `tox.ini`:
```ini
[tox]
envlist = py27, py36, py37, py38, py39, mypy
envlist = py36, py37, py38, py39, mypy

[gh-actions]
python =
2.7: py27
3.6: py36
3.7: py37
3.8: py38, mypy
Expand All @@ -51,11 +49,10 @@ python =
If you're using `setup.cfg`:
```ini
[tox:tox]
envlist = py27, py36, py37, py38, py39, mypy
envlist = py36, py37, py38, py39, mypy

[gh-actions]
python =
2.7: py27
3.6: py36
3.7: py37
3.8: py38, mypy
Expand All @@ -70,11 +67,10 @@ If you're using `pyproject.toml`:
[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py27, py36, py37, py38, py39, mypy
envlist = py36, py37, py38, py39, mypy
[gh-actions]
python =
2.7: py27
3.6: py36
3.7: py37
3.8: py38, mypy
Expand All @@ -98,7 +94,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7, 3.6, 3.7, 3.8, 3.9]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v1
Expand All @@ -117,18 +113,18 @@ jobs:
### Advanced Examples
#### Factor-Conditional Settings: Python Version
The following configuration will create 2 jobs when running the workflow on GitHub Actions.
- On Python 2.7 job, tox runs `py27-django111` environment
- On Python 3.7 job, tox runs `py37-django111` and `py37-django20` environments
- On Python 3.7 job, tox runs `py37-django22` and `py37-django32` environments
- On Python 3.8 job, tox runs `py38-django32` environment

`tox.ini`:
```ini
[tox]
envlist = py27-django{111}, py37-django{111,20}
envlist = py37-django{22,32}, py38-django32

[gh-actions]
python =
2.7: py27
3.7: py37
3.8: py38

[testenv]
...
Expand Down Expand Up @@ -170,15 +166,14 @@ Support of Pyston is experimental and not tested by our CI.
`tox.ini`:
```ini
[tox]
envlist = py27, py38, pypy2, pypy3, pyston38
envlist = py37, py38, pypy3, pyston38

[gh-actions]
python =
2.7: py27
3.7: py37
3.8: py38, mypy
pypy-2.7: pypy2
pypy-3.7: pypy3
pyston-3.8: python38
pyston-3.8: pyston38

[testenv]
...
Expand All @@ -192,14 +187,12 @@ You can also specify without minor versions in the `python` configuration key.
`tox.ini`:
```ini
[tox]
envlist = py2, py3, pypy2, pypy3
envlist = py3, pypy3

[gh-actions]
python =
2: py2
3: py3, mypy
# pypy2 and pypy3 are still supported for backward compatibility
pypy-2: pypy2
# pypy3 are still supported for backward compatibility
pypy-3: pypy3

[testenv]
Expand All @@ -213,9 +206,9 @@ tox-gh-actions gets factors only from the key `3.8`.
#### Factor-Conditional Settings: Environment Variable
You can also use environment variable to decide which environment to run.
The following is an example to install different dependency based on platform.
It will create 12 jobs when running the workflow on GitHub Actions.
- On Python 2.7/ubuntu-latest job, tox runs `py27-linux` environment
- On Python 3.5/ubuntu-latest job, tox runs `py35-linux` environment
It will create 9 jobs when running the workflow on GitHub Actions.
- On Python 3.6/ubuntu-latest job, tox runs `py36-linux` environment
- On Python 3.7/ubuntu-latest job, tox runs `py37-linux` environment
- and so on.

`.github/workflows/<workflow>.yml`:
Expand All @@ -232,7 +225,7 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: [2.7, 3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v1
Expand All @@ -253,14 +246,13 @@ jobs:
`tox.ini`:
```ini
[tox]
envlist = py{27,36,37,38}-{linux,macos,windows}
envlist = py{36,37,38}-{linux,macos,windows}

[gh-actions]
python =
2.7: py27
3.8: py38, mypy
pypy-2.7: pypy2
pypy-3.7: pypy3
3.6: py36
3.7: py37
3.8: py38

[gh-actions:env]
PLATFORM =
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Expand Up @@ -3,16 +3,15 @@ requires = [
# For PEP 517 and PEP 518 support
# https://pip.pypa.io/en/stable/cli/pip/#pep-517-and-518-support
# setuptools_scm v6 requires setuptools >= 45
"setuptools >= 40.8.0",
# Needs setuptools_scm v5 for Python <3.6
"setuptools_scm[toml] >= 5, <7",
"setuptools >= 45",
"setuptools_scm[toml] >= 6, <7",
"wheel",
]
build-backend = 'setuptools.build_meta'

[tool.black]
# py39 is not supported yet
target-version = ["py27", "py35", "py36", "py37", "py38"]
target-version = ["py36", "py37", "py38"]

[tool.coverage.paths]
# For combining source file paths correctly
Expand Down
19 changes: 6 additions & 13 deletions setup.cfg
Expand Up @@ -24,10 +24,8 @@ classifiers =
Topic :: Software Development :: Testing
Topic :: Software Development :: Libraries
Topic :: Utilities
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Expand All @@ -40,14 +38,11 @@ packages = find:
package_dir =
=src
zip_safe = True
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
python_requires = >=3.6
install_requires =
tox >=3.12, <4
typing; python_version<"3.5"
setup_requires =
# This is for backward compatibility
# Needs setuptools_scm v5 for Python <3.6
setuptools_scm[toml] >=5, <7
setuptools_scm[toml] >=6, <7

[options.packages.find]
where = src
Expand All @@ -58,12 +53,12 @@ tox =

[options.extras_require]
testing =
black; platform_python_implementation=='CPython' and python_version>='3.6'
black; platform_python_implementation=='CPython'
flake8 >=3, <4
pytest >=4, <6
pytest-cov >=2, <3
pytest-mock >=2, <3
pytest-randomly >=3; python_version>='3.5'
pytest-randomly >=3

[options.package_data]
tox_gh_actions =
Expand All @@ -79,12 +74,10 @@ skip_missing_interpreters = true
envlist =
black
flake8
{py27,py35,py36,py37,py38,py39,pypy2,pypy3}-tox{312,315,latest}
{py36,py37,py38,py39,pypy2,pypy3}-tox{312,315,latest}

[gh-actions]
python =
2.7: py27, flake8
3.5: py35
3.6: py36
3.7: py37
3.8: py38, black, flake8
Expand Down
2 changes: 0 additions & 2 deletions src/tox_gh_actions/plugin.py
Expand Up @@ -116,9 +116,7 @@ def get_python_version_keys():
"""Get Python version in string for getting factors from gh-action's config
Examples:
- CPython 2.7.z => [2.7, 2]
- CPython 3.8.z => [3.8, 3]
- PyPy 2.7 (v7.3.z) => [pypy-2.7, pypy-2, pypy2]
- PyPy 3.6 (v7.3.z) => [pypy-3.6, pypy-3, pypy3]
- Pyston based on Python CPython 3.8.8 (v2.2) => [pyston-3.8, pyston-3]
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/tox.ini
@@ -1,10 +1,10 @@
[tox]
envlist = py27, py39, unused
envlist = py38, py39, unused
skipsdist = True

[gh-actions]
python =
2.7: py27
3.8: py38
3.9: py39

[testenv]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_integration.py
Expand Up @@ -26,7 +26,7 @@ def test_integration():
expected_envs_map = defaultdict(
list,
[
((2, 7), ["py27"]),
((3, 8), ["py38"]),
((3, 9), ["py39"]),
],
)
Expand Down

0 comments on commit 66125d6

Please sign in to comment.