Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 980c8b0

Browse files
hynekpre-commit-ci[bot]Tinche
authored
Drop Python 2.7 (#936)
* Drop Python 2.7 The tooling situation around Python 2 has deteriorate to such a degree that upholding compatibility is not tenable anymore for a volunteer-run project. Signed-off-by: Hynek Schlawack <[email protected]> * Add newsfragment * Run Python 3.5 under coverage to make up for Python 2.7 * Wait for py35 in parallel * Remove fullmatch kludge * Remove Python 2-specific code * Revert empty slot test Also disable pyupgrade on that file. Signed-off-by: Hynek Schlawack <[email protected]> * We DO run under 3.5 * Remove __qualname__ workarounds * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update changelog.d/936.breaking.rst Co-authored-by: Tin Tvrtković <[email protected]> * Compare methods using is Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Tin Tvrtković <[email protected]>
1 parent d0c73d8 commit 980c8b0

Some content is hidden

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

44 files changed

+453
-880
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ The official tag is `python-attrs` and helping out in support frees us up to imp
7171

7272
- To run the test suite, all you need is a recent [*tox*].
7373
It will ensure the test suite runs with all dependencies against all Python versions just as it will in our [CI].
74-
If you lack some Python versions, you can can always limit the environments like `tox -e py27,py38`, or make it a non-failure using `tox --skip-missing-interpreters`.
74+
If you lack some Python versions, you can can always limit the environments like `tox -e py38,py39`, or make it a non-failure using `tox --skip-missing-interpreters`.
7575

7676
In that case you should look into [*asdf*](https://asdf-vm.com) or [*pyenv*](https://github.com/pyenv/pyenv), which make it very easy to install many different Python versions in parallel.
7777
- Write [good test docstrings](https://jml.io/pages/test-docstrings.html).

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
fail-fast: false
2525
matrix:
26-
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "pypy-2.7", "pypy-3.7", "pypy-3.8"]
26+
python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "pypy-3.7", "pypy-3.8"]
2727

2828
steps:
2929
- uses: actions/checkout@v3

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,20 @@ repos:
88
hooks:
99
- id: black
1010

11+
- repo: https://github.com/asottile/pyupgrade
12+
rev: v2.31.1
13+
hooks:
14+
- id: pyupgrade
15+
args: [--py3-plus, --keep-percent-format]
16+
exclude: "tests/test_slots.py"
17+
1118
- repo: https://github.com/PyCQA/isort
1219
rev: 5.10.1
1320
hooks:
1421
- id: isort
1522
additional_dependencies: [toml]
1623
files: \.py$
24+
language_version: python3.10 # needed for match
1725

1826
- repo: https://github.com/PyCQA/flake8
1927
rev: 4.0.1

README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ Project Information
117117
its documentation lives at `Read the Docs <https://www.attrs.org/>`_,
118118
the code on `GitHub <https://github.com/python-attrs/attrs>`_,
119119
and the latest release on `PyPI <https://pypi.org/project/attrs/>`_.
120-
It’s rigorously tested on Python 2.7, 3.5+, and PyPy.
120+
It’s rigorously tested on Python 3.5+ and PyPy.
121+
The last version with Python 2.7 support is `21.4.0 <https://pypi.org/project/attrs/21.4.0/>`_.
121122

122123
We collect information on **third-party extensions** in our `wiki <https://github.com/python-attrs/attrs/wiki/Extensions-to-attrs>`_.
123124
Feel free to browse and add your own!

changelog.d/936.breaking.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Python 2.7 is not supported anymore.
2+
3+
Dealing with Python 2.7 tooling has become too difficult for a volunteer-run project.
4+
5+
We have supported Python 2 more than 2 years after it was officially discontinued and feel that we have paid our dues.
6+
All version up to 21.4.0 from December 2021 remain fully functional, of course.

conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# SPDX-License-Identifier: MIT
22

3-
from __future__ import absolute_import, division, print_function
43

54
from hypothesis import HealthCheck, settings
65

docs/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ Full Table of Contents
8989
:maxdepth: 1
9090

9191
license
92-
python-2
9392
changelog
9493

9594

docs/python-2.rst

Lines changed: 0 additions & 25 deletions
This file was deleted.

docs/why.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Whether they're relevant to *you* depends on your circumstances:
2020
There is a long list of features that were sacrificed for the sake of simplicity and while the most obvious ones are validators, converters, :ref:`equality customization <custom-comparison>`, or :doc:`extensibility <extending>` in general, it permeates throughout all APIs.
2121

2222
On the other hand, Data Classes currently do not offer any significant feature that ``attrs`` doesn't already have.
23-
- ``attrs`` supports all mainstream Python versions, including CPython 2.7 and PyPy.
23+
- ``attrs`` supports all mainstream Python versions including PyPy.
2424
- ``attrs`` doesn't force type annotations on you if you don't like them.
2525
- But since it **also** supports typing, it's the best way to embrace type hints *gradually*, too.
2626
- While Data Classes are implementing features from ``attrs`` every now and then, their presence is dependent on the Python version, not the package version.

setup.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
"License :: OSI Approved :: MIT License",
3333
"Operating System :: OS Independent",
3434
"Programming Language :: Python",
35-
"Programming Language :: Python :: 2",
36-
"Programming Language :: Python :: 2.7",
3735
"Programming Language :: Python :: 3",
3836
"Programming Language :: Python :: 3.5",
3937
"Programming Language :: Python :: 3.6",
@@ -56,7 +54,6 @@
5654
"hypothesis",
5755
"pympler",
5856
"pytest>=4.3.0", # 4.3.0 dropped last use of `convert`
59-
"six",
6057
],
6158
}
6259
if (
@@ -143,7 +140,7 @@ def find_meta(meta):
143140
long_description_content_type="text/x-rst",
144141
packages=PACKAGES,
145142
package_dir={"": "src"},
146-
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
143+
python_requires=">=3.5",
147144
zip_safe=False,
148145
classifiers=CLASSIFIERS,
149146
install_requires=INSTALL_REQUIRES,

0 commit comments

Comments
 (0)