Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop python<=37 support #1270

Closed
wants to merge 4 commits into from
Closed

drop python<=37 support #1270

wants to merge 4 commits into from

Conversation

kloczek
Copy link

@kloczek kloczek commented Mar 17, 2024

Summary

Python 3.7 has been EOSed at 27 Jun 2023 (https://endoflife.date/python)
Filter all code over `pyupgrade --py38'.

Pull Request Check List

  • Do not open pull requests from your main branch – use a separate branch!
    • There's a ton of footguns waiting if you don't heed this warning. You can still go back to your project, create a branch from your main branch, push it, and open the pull request from the new branch.
    • This is not a pre-requisite for your your pull request to be accepted, but you have been warned.
  • Added tests for changed code.
    Our CI fails if coverage is not 100%.
  • New features have been added to our Hypothesis testing strategy.
  • Changes or additions to public APIs are reflected in our type stubs (files ending in .pyi).
    • ...and used in the stub test file tests/typing_example.py.
    • If they've been added to attr/__init__.pyi, they've also been re-imported in attrs/__init__.pyi.
  • Updated documentation for changed code.
    • New functions/classes have to be added to docs/api.rst by hand.
    • Changes to the signature of @attr.s() have to be added by hand too.
    • Changed/added classes/methods/functions have appropriate versionadded, versionchanged, or deprecated directives.
      The next version is the second number in the current release + 1.
      The first number represents the current year.
      So if the current version on PyPI is 22.2.0, the next version is gonna be 22.3.0.
      If the next version is the first in the new year, it'll be 23.1.0.
  • Documentation in .rst and .md files is written using semantic newlines.
  • Changes (and possible deprecations) have news fragments in changelog.d.
  • Consider granting push permissions to the PR branch, so maintainers can fix minor issues themselves without pestering you.

kloczek and others added 2 commits March 17, 2024 21:10
Python 3.7 has been EOSed at 27 Jun 2023 (https://endoflife.date/python)
Filter all code over `pyupgrade --py38'.

Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
@kloczek
Copy link
Author

kloczek commented Mar 17, 2024

pytest look Ok with that PR.

Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-attrs-23.2.0-5.fc36.x86_64/usr/lib64/python3.9/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-attrs-23.2.0-5.fc36.x86_64/usr/lib/python3.9/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.9.18, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/tkloczko/rpmbuild/BUILD/attrs-23.2.0
configfile: pyproject.toml
testpaths: tests
plugins: hypothesis-6.99.6
collected 1319 items

tests/test_3rd_party.py .                                                                                                                                                             [  0%]
tests/test_abc.py ssss                                                                                                                                                                [  0%]
tests/test_annotations.py ....ss...............ss........................                                                                                                             [  3%]
tests/test_cmp.py ..............................................................................                                                                                      [  9%]
tests/test_compat.py ...                                                                                                                                                              [ 10%]
tests/test_config.py ....                                                                                                                                                             [ 10%]
tests/test_converters.py ......................                                                                                                                                       [ 12%]
tests/test_dunders.py ...................................................................................................                                                             [ 19%]
tests/test_filters.py .................................                                                                                                                               [ 22%]
tests/test_funcs.py ...................................................                                                                                                               [ 25%]
tests/test_functional.py ............................................................................................................................................................ [ 37%]
..................................................................................................................................................................................... [ 51%]
...................................................................                                                                                                                   [ 56%]
tests/test_hooks.py ..........                                                                                                                                                        [ 57%]
tests/test_import.py .                                                                                                                                                                [ 57%]
tests/test_init_subclass.py ....                                                                                                                                                      [ 57%]
tests/test_make.py .................................................................................................................................................................. [ 69%]
........................................................................................sssssss                                                                                       [ 77%]
tests/test_next_gen.py .................................                                                                                                                              [ 79%]
tests/test_packaging.py ......................                                                                                                                                        [ 81%]
tests/test_pyright.py ss                                                                                                                                                              [ 81%]
tests/test_setattr.py ..................x.................                                                                                                                            [ 84%]
tests/test_slots.py .............s......................................                                                                                                              [ 88%]
tests/test_utils.py ..                                                                                                                                                                [ 88%]
tests/test_validators.py ....................................................................................................................................................         [ 99%]
tests/test_version_info.py ......                                                                                                                                                     [100%]

========================================================================================= XFAILURES =========================================================================================
_____________________________________________________________________________ TestSetAttr.test_slotted_confused _____________________________________________________________________________

self = <tests.test_setattr.TestSetAttr object at 0x7fe47a7914f0>

    @pytest.mark.xfail(raises=attr.exceptions.FrozenAttributeError)
    def test_slotted_confused(self):
        """
        If we have a in-between non-attrs class, setattr reset detection
        should still work, but currently doesn't.

        It works with dict classes because we can look the finished class and
        patch it.  With slotted classes we have to deduce it ourselves.
        """

        @attr.s(slots=True)
        class A:
            x = attr.ib(on_setattr=setters.frozen)

        class B(A):
            pass

        @attr.s(slots=True)
        class C(B):
            x = attr.ib()

>       C(1).x = 2

tests/test_setattr.py:312:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
<attrs generated init tests.test_setattr.TestSetAttr.test_slotted_confused.<locals>.C>:2: in __init__
    self.x = x
../../BUILDROOT/python-attrs-23.2.0-5.fc36.x86_64/usr/lib/python3.9/site-packages/attr/_make.py:1180: in __setattr__
    nval = hook(self, a, val)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

_ = <[AttributeError('x') raised in repr()] C object at 0x7fe479c43100>
__ = Attribute(name='x', default=NOTHING, validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash..., type=None, converter=None, kw_only=False, inherited=False, on_setattr=<function frozen at 0x7fe47b675310>, alias='x')
___ = 1

    def frozen(_, __, ___):
        """
        Prevent an attribute to be modified.

        .. versionadded:: 20.1.0
        """
>       raise FrozenAttributeError()
E       attr.exceptions.FrozenAttributeError

../../BUILDROOT/python-attrs-23.2.0-5.fc36.x86_64/usr/lib/python3.9/site-packages/attr/setters.py:36: FrozenAttributeError
================================================================================== short test summary info ==================================================================================
SKIPPED [2] tests/test_abc.py:17: abc.update_abstractmethods is 3.10+
SKIPPED [2] tests/test_abc.py:39: abc.update_abstractmethods is 3.10+
SKIPPED [2] tests/test_annotations.py:95: Incompatible behavior on older Pythons
SKIPPED [2] tests/test_annotations.py:386: Incompatible behavior on older Pythons
SKIPPED [1] tests/test_make.py:2495: Structural pattern matching is 3.10+
SKIPPED [1] tests/test_make.py:2506: Structural pattern matching is 3.10+
SKIPPED [2] tests/test_make.py:2520: Structural pattern matching is 3.10+
SKIPPED [1] tests/test_make.py:2535: Structural pattern matching is 3.10+
SKIPPED [1] tests/test_make.py:2555: Structural pattern matching is 3.10+
SKIPPED [1] tests/test_make.py:2590: Structural pattern matching is 3.10+
SKIPPED [1] tests/test_pyright.py:42: Requires pyright.
SKIPPED [1] tests/test_pyright.py:93: Requires pyright.
SKIPPED [1] tests/test_slots.py:497: slots without weakref_slot should only work on PyPy
XFAIL tests/test_setattr.py::TestSetAttr::test_slotted_confused
======================================================================= 1300 passed, 18 skipped, 1 xfailed in 24.72s ========================================================================

kloczek and others added 2 commits March 17, 2024 21:21
@kloczek
Copy link
Author

kloczek commented Mar 17, 2024

Looks like pre-commit trashes PR 😋

@hynek
Copy link
Member

hynek commented Mar 18, 2024

As much as I would like to drop 3.7, they're still more than 25% of our downloads:

┌──────────┬─────────┬─────────────┐
│ category │ percent │   downloads │
├──────────┼─────────┼─────────────┤
│ 3.7      │  25.16% │  44,663,698 │
│ 3.10     │  16.84% │  29,892,733 │
│ 3.8      │  15.89% │  28,201,595 │
│ 3.9      │  15.42% │  27,379,333 │
│ 3.11     │  13.07% │  23,195,141 │
│ null     │   5.57% │   9,881,771 │
│ 3.6      │   3.65% │   6,485,109 │
│ 3.12     │   3.38% │   5,992,607 │
│ 2.7      │   0.80% │   1,416,881 │
│ 3.5      │   0.23% │     403,964 │
│ 3.13     │   0.01% │      18,882 │
│ 3.4      │   0.00% │       2,202 │
│ 3.3      │   0.00% │           6 │
│ 3.1      │   0.00% │           3 │
│ Total    │         │ 177,533,925 │
└──────────┴─────────┴─────────────┘

Date range: 2024-02-01 - 2024-02-29

So, until we have a good reason (CI dropping it, it prevents a useful new feature, …), I'll try to keep it aboard. Definitely, for the next release.

@hynek hynek closed this Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants