Skip to content

Commit b85542c

Browse files
authored
Drop support of running under Python 2.7 (#2382)
1 parent 3c57468 commit b85542c

File tree

148 files changed

+1271
-2077
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+1271
-2077
lines changed

.github/CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Contributing to ``virtualenv``
1+
# Contributing to `virtualenv`
22

3-
Thank you for your interest in contributing to virtualenv! There are many ways to contribute, and we appreciate all of them.
4-
As a reminder, all contributors are expected to follow the [PSF Code of Conduct][coc].
3+
Thank you for your interest in contributing to virtualenv! There are many ways to contribute, and we appreciate all of
4+
them. As a reminder, all contributors are expected to follow the [PSF Code of Conduct][coc].
55

66
[coc]: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md
77

88
## Development Documentation
99

1010
Our [development documentation](https://virtualenv.pypa.io/en/latest/development.html#development) contains details on
11-
how to get started with contributing to ``virtualenv``, and details of our development processes.
11+
how to get started with contributing to `virtualenv`, and details of our development processes.

.github/ISSUE_TEMPLATE/bug-report.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ Describe what's the expected behaviour and what you're observing.
55
**Environment**
66

77
Provide at least:
8+
89
- OS:
9-
- ``pip list`` of the host python where ``virtualenv`` is installed:
10+
- `pip list` of the host python where `virtualenv` is installed:
1011

1112
```console
1213

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: ''
4+
title: ""
55
labels: bug
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
**Issue**
@@ -14,8 +13,9 @@ Describe what's the expected behaviour and what you're observing.
1413
**Environment**
1514

1615
Provide at least:
16+
1717
- OS:
18-
- ``pip list`` of the host python where ``virtualenv`` is installed:
18+
- `pip list` of the host python where `virtualenv` is installed:
1919

2020
```console
2121

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Ref: https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
2-
blank_issues_enabled: true # default
2+
blank_issues_enabled: true # default
33
contact_links:
4-
- name: '💬 pypa/virtualenv @ Discord'
5-
url: https://discord.gg/pypa
6-
about: Chat with the devs
7-
- name: 🤷💻🤦 Discourse
8-
url: https://discuss.python.org/c/packaging
9-
about: |
10-
Please ask typical Q&A here: general ideas for Python packaging, questions about structuring projects and so on
11-
- name: 📝 PSF Code of Conduct
12-
url: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md
13-
about: ❤ Be nice to other members of the community. ☮ Behave.
4+
- name: "💬 pypa/virtualenv @ Discord"
5+
url: https://discord.gg/pypa
6+
about: Chat with the devs
7+
- name: 🤷💻🤦 Discourse
8+
url: https://discuss.python.org/c/packaging
9+
about: |
10+
Please ask typical Q&A here: general ideas for Python packaging, questions about structuring projects and so on
11+
- name: 📝 PSF Code of Conduct
12+
url: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md
13+
about: ❤ Be nice to other members of the community. ☮ Behave.
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
---
22
name: Feature request
33
about: Suggest an enhancement for this project
4-
title: ''
4+
title: ""
55
labels: enhancement
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
**What's the problem this feature will solve?**
10+
1111
<!-- What are you trying to do, that you are unable to achieve with virtualenv as it currently stands? -->
1212

1313
**Describe the solution you'd like**
14+
1415
<!-- Clear and concise description of what you want to happen. -->
1516

1617
<!-- Provide examples of real world use cases that this would enable and how it solves the problem described above. -->
1718

1819
**Alternative Solutions**
20+
1921
<!-- Have you tried to workaround the problem using virtualenv or other tools? Or a different approach to solving this issue? Please elaborate here. -->
2022

2123
**Additional context**
24+
2225
<!-- Add any other context, links, etc. about the feature here. -->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
### Thanks for contributing, make sure you address all the checklists (for details on how see
2+
23
[development documentation](https://virtualenv.pypa.io/en/latest/development.html#development))!
34

4-
- [ ] ran the linter to address style issues (``tox -e fix_lint``)
5+
- [ ] ran the linter to address style issues (`tox -e fix_lint`)
56
- [ ] wrote descriptive pull request text
67
- [ ] ensured there are test(s) validating the fix
7-
- [ ] added news fragment in ``docs/changelog`` folder
8+
- [ ] added news fragment in `docs/changelog` folder
89
- [ ] updated/extended the documentation

.github/SECURITY.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
## Supported Versions
44

5-
| Version | Supported |
6-
| ----------- | ------------------ |
7-
| 20.15.1 + | :white_check_mark: |
8-
| < 20.15.1 | :x: |
5+
| Version | Supported |
6+
| --------- | ------------------ |
7+
| 20.15.1 + | :white_check_mark: |
8+
| < 20.15.1 | :x: |
99

1010
## Reporting a Vulnerability
1111

.github/workflows/check.yml

Lines changed: 37 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
jobs:
13-
lint:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/checkout@v3
17-
- uses: actions/setup-python@v4
18-
with:
19-
python-version: "3.10"
20-
- uses: pre-commit/action@v3.0.0
2113
test:
2214
name: test ${{ matrix.py }} - ${{ matrix.os }}
2315
runs-on: ${{ matrix.os }}
@@ -30,18 +22,19 @@ jobs:
3022
- "3.8"
3123
- "3.7"
3224
- "3.6"
33-
- "3.5"
25+
- pypy-3.9-v7.3.9
26+
- pypy-3.8-v7.3.9
27+
- pypy-3.7-v7.3.9
3428
- pypy-3.6-v7.3.3
35-
- pypy-3.7-v7.3.7
36-
- pypy-3.8-v7.3.7
37-
- "2.7"
38-
- pypy-2.7
3929
os:
4030
- ubuntu-20.04
41-
- macos-10.15
31+
- macos-12
4232
- windows-2022
33+
exclude:
34+
- { os: macos-12, py: "pypy-3.6-v7.3.3" } # PyPy 3.6 does not support macOS 11/12
4335
include:
44-
- { os: macos-10.15, py: brew@py3 }
36+
- { os: macos-12, py: "brew@3.9" }
37+
- { os: macos-12, py: "brew@3.8" }
4538
steps:
4639
- name: Install OS dependencies
4740
run: |
@@ -54,7 +47,7 @@ jobs:
5447
${{ runner.os == 'Linux' && 'tar -zxf nushell.tar.gz' || true }} && \
5548
${{ runner.os == 'Linux' && 'sudo cp nu /usr/bin' || true }} && \
5649
${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \
57-
${{ runner.os == 'macOS' && 'brew update && brew install fish tcsh nushell' || true }} && \
50+
${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true }} && \
5851
exit 0 || true;
5952
done
6053
exit 1
@@ -63,40 +56,38 @@ jobs:
6356
uses: actions/setup-python@v4
6457
with:
6558
python-version: "3.10"
66-
- name: Install tox
67-
run: python -m pip install tox
68-
- uses: actions/checkout@v3
69-
with:
70-
fetch-depth: 0
71-
- name: Use local virtualenv for tox
72-
run: python -m pip install .
7359
- name: Install Python 2 for cross test
7460
uses: actions/setup-python@v4
7561
with:
7662
python-version: "2.7"
63+
- name: Setup brew python for test ${{ matrix.py }}
64+
if: startsWith(matrix.py,'brew@')
65+
run: |
66+
set -e
67+
PY=$(echo '${{ matrix.py }}' | cut -c 6-)
68+
brew upgrade python@$PY || brew install python@$PY
69+
echo "/usr/local/opt/python@$PY/libexec/bin" >>"${GITHUB_PATH}"
70+
shell: bash
7771
- name: Setup python for test ${{ matrix.py }}
78-
if: "!( startsWith(matrix.py,'brew@py') || endsWith(matrix.py, '-dev') )"
72+
if: "!( startsWith(matrix.py,'brew@') || endsWith(matrix.py, '-dev') )"
7973
uses: actions/setup-python@v4
8074
with:
8175
python-version: ${{ matrix.py }}
82-
- name: Setup brew python for test ${{ matrix.py }}
83-
if: startsWith(matrix.py,'brew@py')
84-
run: |
85-
import subprocess; import codecs; import os
86-
subprocess.check_call(["bash", "-c", "brew upgrade python@3 || brew install python@3"])
87-
with codecs.open(os.environ["GITHUB_PATH"], "a", "utf-8") as file_handler:
88-
file_handler.write("/usr/local/opt/python@3")
89-
shell: python
9076
- name: Pick environment to run
9177
run: |
92-
import platform; import os; import sys; import codecs
93-
cpy = platform.python_implementation() == "CPython"
94-
base =("{}{}{}" if cpy else "{}{}").format("py" if cpy else "pypy", *sys.version_info[0:2])
95-
env = "TOXENV={}\n".format(base)
96-
print("Picked:\n{}for{}".format(env, sys.version))
97-
with codecs.open(os.environ["GITHUB_ENV"], "a", "utf-8") as file_handler:
98-
file_handler.write(env)
78+
import os; import platform; import sys; from pathlib import Path
79+
env = f'TOXENV=py{"" if platform.python_implementation() == "CPython" else "py"}3{sys.version_info.minor}'
80+
print(f"Picked: {env} for {sys.version} based of {sys.executable}")
81+
with Path(os.environ["GITHUB_ENV"]).open("ta") as file_handler:
82+
file_handler.write(env)
9983
shell: python
84+
- uses: actions/checkout@v3
85+
with:
86+
fetch-depth: 0
87+
- name: Install tox
88+
run: python -m pip install tox
89+
- name: Use local virtualenv for tox
90+
run: python -m pip install .
10091
- name: Setup test suite
10192
run: tox -vv --notest
10293
- name: Run test suite
@@ -106,7 +97,9 @@ jobs:
10697
CI_RUN: "yes"
10798
DIFF_AGAINST: HEAD
10899
- name: Rename coverage report file
109-
run: import os; import sys; os.rename(".tox/.coverage.{}".format(os.environ['TOXENV']), ".tox/.coverage.{}-{}".format(os.environ['TOXENV'], sys.platform))
100+
run: |
101+
import os; import sys
102+
os.rename(f".tox/.coverage.{os.environ['TOXENV']}", f".tox/.coverage.{os.environ['TOXENV']}-{sys.platform}")
110103
shell: python
111104
- name: Upload coverage data
112105
uses: actions/upload-artifact@v3
@@ -116,7 +109,7 @@ jobs:
116109

117110
coverage:
118111
name: Combine coverage
119-
runs-on: ubuntu-latest
112+
runs-on: ubuntu-22.04
120113
needs: test
121114
steps:
122115
- uses: actions/checkout@v3
@@ -153,7 +146,7 @@ jobs:
153146
fail-fast: false
154147
matrix:
155148
os:
156-
- ubuntu-20.04
149+
- ubuntu-22.04
157150
- windows-2022
158151
tox_env:
159152
- dev
@@ -181,8 +174,8 @@ jobs:
181174

182175
publish:
183176
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
184-
needs: [check, coverage, lint]
185-
runs-on: ubuntu-20.04
177+
needs: [check, coverage]
178+
runs-on: ubuntu-22.04
186179
steps:
187180
- name: Setup python to build package
188181
uses: actions/setup-python@v4

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ repos:
2020
hooks:
2121
- id: isort
2222
- repo: https://github.com/psf/black
23-
rev: 22.3.0
23+
rev: 22.6.0
2424
hooks:
2525
- id: black
2626
args: [--safe]
2727
- repo: https://github.com/asottile/blacken-docs
2828
rev: v1.12.1
2929
hooks:
3030
- id: blacken-docs
31-
additional_dependencies: [black==21.12b0]
31+
additional_dependencies: [black==22.6.0]
3232
- repo: https://github.com/pre-commit/pygrep-hooks
3333
rev: v1.9.0
3434
hooks:

docs/changelog/2382.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Drop support for running under Python 2 (still can generate Python 2 environments) - by :user:`gaborbernat`.

0 commit comments

Comments
 (0)