Skip to content

Commit

Permalink
Drop support of running under Python 2.7 (#2382)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat committed Jul 25, 2022
1 parent 3c57468 commit b85542c
Show file tree
Hide file tree
Showing 148 changed files with 1,271 additions and 2,077 deletions.
8 changes: 4 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Contributing to ``virtualenv``
# Contributing to `virtualenv`

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

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

## Development Documentation

Our [development documentation](https://virtualenv.pypa.io/en/latest/development.html#development) contains details on
how to get started with contributing to ``virtualenv``, and details of our development processes.
how to get started with contributing to `virtualenv`, and details of our development processes.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ Describe what's the expected behaviour and what you're observing.
**Environment**

Provide at least:

- OS:
- ``pip list`` of the host python where ``virtualenv`` is installed:
- `pip list` of the host python where `virtualenv` is installed:

```console

Expand Down
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
title: ""
labels: bug
assignees: ''

assignees: ""
---

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

Provide at least:

- OS:
- ``pip list`` of the host python where ``virtualenv`` is installed:
- `pip list` of the host python where `virtualenv` is installed:

```console

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

assignees: ""
---

**What's the problem this feature will solve?**

<!-- What are you trying to do, that you are unable to achieve with virtualenv as it currently stands? -->

**Describe the solution you'd like**

<!-- Clear and concise description of what you want to happen. -->

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

**Alternative Solutions**

<!-- Have you tried to workaround the problem using virtualenv or other tools? Or a different approach to solving this issue? Please elaborate here. -->

**Additional context**

<!-- Add any other context, links, etc. about the feature here. -->
5 changes: 3 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
### Thanks for contributing, make sure you address all the checklists (for details on how see

[development documentation](https://virtualenv.pypa.io/en/latest/development.html#development))!

- [ ] ran the linter to address style issues (``tox -e fix_lint``)
- [ ] ran the linter to address style issues (`tox -e fix_lint`)
- [ ] wrote descriptive pull request text
- [ ] ensured there are test(s) validating the fix
- [ ] added news fragment in ``docs/changelog`` folder
- [ ] added news fragment in `docs/changelog` folder
- [ ] updated/extended the documentation
8 changes: 4 additions & 4 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

## Supported Versions

| Version | Supported |
| ----------- | ------------------ |
| 20.15.1 + | :white_check_mark: |
| < 20.15.1 | :x: |
| Version | Supported |
| --------- | ------------------ |
| 20.15.1 + | :white_check_mark: |
| < 20.15.1 | :x: |

## Reporting a Vulnerability

Expand Down
81 changes: 37 additions & 44 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ concurrency:
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: pre-commit/action@v3.0.0
test:
name: test ${{ matrix.py }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -30,18 +22,19 @@ jobs:
- "3.8"
- "3.7"
- "3.6"
- "3.5"
- pypy-3.9-v7.3.9
- pypy-3.8-v7.3.9
- pypy-3.7-v7.3.9
- pypy-3.6-v7.3.3
- pypy-3.7-v7.3.7
- pypy-3.8-v7.3.7
- "2.7"
- pypy-2.7
os:
- ubuntu-20.04
- macos-10.15
- macos-12
- windows-2022
exclude:
- { os: macos-12, py: "pypy-3.6-v7.3.3" } # PyPy 3.6 does not support macOS 11/12
include:
- { os: macos-10.15, py: brew@py3 }
- { os: macos-12, py: "brew@3.9" }
- { os: macos-12, py: "brew@3.8" }
steps:
- name: Install OS dependencies
run: |
Expand All @@ -54,7 +47,7 @@ jobs:
${{ runner.os == 'Linux' && 'tar -zxf nushell.tar.gz' || true }} && \
${{ runner.os == 'Linux' && 'sudo cp nu /usr/bin' || true }} && \
${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \
${{ runner.os == 'macOS' && 'brew update && brew install fish tcsh nushell' || true }} && \
${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true }} && \
exit 0 || true;
done
exit 1
Expand All @@ -63,40 +56,38 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install tox
run: python -m pip install tox
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use local virtualenv for tox
run: python -m pip install .
- name: Install Python 2 for cross test
uses: actions/setup-python@v4
with:
python-version: "2.7"
- name: Setup brew python for test ${{ matrix.py }}
if: startsWith(matrix.py,'brew@')
run: |
set -e
PY=$(echo '${{ matrix.py }}' | cut -c 6-)
brew upgrade python@$PY || brew install python@$PY
echo "/usr/local/opt/python@$PY/libexec/bin" >>"${GITHUB_PATH}"
shell: bash
- name: Setup python for test ${{ matrix.py }}
if: "!( startsWith(matrix.py,'brew@py') || endsWith(matrix.py, '-dev') )"
if: "!( startsWith(matrix.py,'brew@') || endsWith(matrix.py, '-dev') )"
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.py }}
- name: Setup brew python for test ${{ matrix.py }}
if: startsWith(matrix.py,'brew@py')
run: |
import subprocess; import codecs; import os
subprocess.check_call(["bash", "-c", "brew upgrade python@3 || brew install python@3"])
with codecs.open(os.environ["GITHUB_PATH"], "a", "utf-8") as file_handler:
file_handler.write("/usr/local/opt/python@3")
shell: python
- name: Pick environment to run
run: |
import platform; import os; import sys; import codecs
cpy = platform.python_implementation() == "CPython"
base =("{}{}{}" if cpy else "{}{}").format("py" if cpy else "pypy", *sys.version_info[0:2])
env = "TOXENV={}\n".format(base)
print("Picked:\n{}for{}".format(env, sys.version))
with codecs.open(os.environ["GITHUB_ENV"], "a", "utf-8") as file_handler:
file_handler.write(env)
import os; import platform; import sys; from pathlib import Path
env = f'TOXENV=py{"" if platform.python_implementation() == "CPython" else "py"}3{sys.version_info.minor}'
print(f"Picked: {env} for {sys.version} based of {sys.executable}")
with Path(os.environ["GITHUB_ENV"]).open("ta") as file_handler:
file_handler.write(env)
shell: python
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install tox
run: python -m pip install tox
- name: Use local virtualenv for tox
run: python -m pip install .
- name: Setup test suite
run: tox -vv --notest
- name: Run test suite
Expand All @@ -106,7 +97,9 @@ jobs:
CI_RUN: "yes"
DIFF_AGAINST: HEAD
- name: Rename coverage report file
run: import os; import sys; os.rename(".tox/.coverage.{}".format(os.environ['TOXENV']), ".tox/.coverage.{}-{}".format(os.environ['TOXENV'], sys.platform))
run: |
import os; import sys
os.rename(f".tox/.coverage.{os.environ['TOXENV']}", f".tox/.coverage.{os.environ['TOXENV']}-{sys.platform}")
shell: python
- name: Upload coverage data
uses: actions/upload-artifact@v3
Expand All @@ -116,7 +109,7 @@ jobs:

coverage:
name: Combine coverage
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: test
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -153,7 +146,7 @@ jobs:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- ubuntu-22.04
- windows-2022
tox_env:
- dev
Expand Down Expand Up @@ -181,8 +174,8 @@ jobs:

publish:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [check, coverage, lint]
runs-on: ubuntu-20.04
needs: [check, coverage]
runs-on: ubuntu-22.04
steps:
- name: Setup python to build package
uses: actions/setup-python@v4
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 22.6.0
hooks:
- id: black
args: [--safe]
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
hooks:
- id: blacken-docs
additional_dependencies: [black==21.12b0]
additional_dependencies: [black==22.6.0]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
Expand Down
1 change: 1 addition & 0 deletions docs/changelog/2382.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Drop support for running under Python 2 (still can generate Python 2 environments) - by :user:`gaborbernat`.
3 changes: 2 additions & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ supported on a best effort approach.
CPython is shipped in multiple forms, and each OS repackages it, often applying some customization along the way.
Therefore we cannot say universally that we support all platforms, but rather specify some we test against. In case
of ones not specified here the support is unknown, though likely will work. If you find some cases please open a feature
request on our issue tracker.
request on our issue tracker. Note, as of ``20.16.0`` we no longer support running under Python less than 3.6, however
we still support creating environments for 2.7 and 3.5.

Linux
~~~~~
Expand Down
8 changes: 4 additions & 4 deletions docs/render_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def run(self):
for i in core_result["action_groups"]:
content.append(self._build_table(i["options"], i["title"], i["description"]))
for key, name_to_class in CUSTOM.items():
section = n.section("", ids=["section-{}".format(key)])
section = n.section("", ids=[f"section-{key}"])
title = n.title("", key)
section += title
self.state.document.note_implicit_target(title)
Expand All @@ -44,21 +44,21 @@ def run(self):

for name, class_n in name_to_class.items():
with self._run_parser(class_n, key, name):
cmd = ["--{}".format(key), name]
cmd = [f"--{key}", name]
parser_result = parse_parser(parser_creator(cmd))
opt_group = next(i["options"] for i in parser_result["action_groups"] if i["title"] == key)
results[name] = opt_group
core_names = set.intersection(*list({tuple(i["name"]) for i in v} for v in results.values()))
if core_names:
rows = [i for i in next(iter(results.values())) if tuple(i["name"]) in core_names]
content.append(
self._build_table(rows, title="core", description="options shared across all {}".format(key)),
self._build_table(rows, title="core", description=f"options shared across all {key}"),
)
for name, group in results.items():
rows = [i for i in group if tuple(i["name"]) not in core_names]
if rows:
content.append(
self._build_table(rows, title=name, description="options specific to {} {}".format(key, name)),
self._build_table(rows, title=name, description=f"options specific to {key} {name}"),
)
return content

Expand Down
4 changes: 1 addition & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ install_requires =
distlib>=0.3.1,<1
filelock>=3.2,<4
platformdirs>=2,<3
six>=1.9.0,<2 # keep it >=1.9.0 as it may cause problems on LTS platforms
importlib-metadata>=0.12;python_version<"3.8"
importlib-resources>=1.0;python_version<"3.7"
pathlib2>=2.3.3,<3;python_version < '3.4' and sys.platform != 'win32'
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
package_dir =
=src
Expand Down Expand Up @@ -96,13 +94,13 @@ testing =
coverage>=4
coverage-enable-subprocess>=1
flaky>=3
packaging>=20.0
pytest>=4
pytest-env>=0.6.2
pytest-freezegun>=0.4.1
pytest-mock>=2
pytest-randomly>=1
pytest-timeout>=1
packaging>=20.0;python_version>"3.4"

[options.package_data]
virtualenv.activation.bash = *.sh
Expand Down
6 changes: 2 additions & 4 deletions src/virtualenv/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from __future__ import absolute_import, unicode_literals

from .run import cli_run, session_via_cli
from .version import __version__

__all__ = (
__all__ = [
"__version__",
"cli_run",
"session_via_cli",
)
]

0 comments on commit b85542c

Please sign in to comment.