Skip to content

Commit

Permalink
Drop support of Python 3.8, support 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Apr 24, 2024
1 parent eec7802 commit d65a4e4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 34 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.11']
python-version: ['3.12']
include:
- os: ubuntu-latest
python-version: '3.7'
python-version: '3.8'
- os: ubuntu-latest
python-version: 'pypy-3.8'
python-version: 'pypy-3.9'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip and setuptools
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ documents (HTML, XML, etc.) that can be read by ElementTree-like parsers
(including cElementTree, lxml, html5lib, etc.)

* Free software: BSD license
* For Python 3.7+, tested on CPython and PyPy
* For Python 3.8+, tested on CPython and PyPy
* Documentation: https://doc.courtbouillon.org/cssselect2
* Changelog: https://github.com/Kozea/cssselect2/releases
* Code, issues, tests: https://github.com/Kozea/cssselect2
Expand Down
26 changes: 1 addition & 25 deletions cssselect2/tree.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,10 @@
import functools
from functools import cached_property
from warnings import warn

from webencodings import ascii_lower

from .compiler import compile_selector_list, split_whitespace

if hasattr(functools, 'cached_property'):
# Python 3.8+
cached_property = functools.cached_property
else:
# Python 3.7
class cached_property: # noqa: N801
# Borrowed from Werkzeug
# https://github.com/mitsuhiko/werkzeug/blob/master/werkzeug/utils.py

def __init__(self, func, name=None, doc=None):
self.__name__ = name or func.__name__
self.__module__ = func.__module__
self.__doc__ = doc or func.__doc__
self.func = func

def __get__(self, obj, type=None, __missing=object()):
if obj is None:
return self
value = obj.__dict__.get(self.__name__, __missing)
if value is __missing:
value = self.func(obj)
obj.__dict__[self.__name__] = value
return value


class ElementWrapper:
"""Wrapper of :class:`xml.etree.ElementTree.Element` for Selector matching.
Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description = 'CSS selectors for Python ElementTree'
keywords = ['css', 'elementtree']
authors = [{name = 'Simon Sapin', email = 'simon.sapin@exyr.org'}]
maintainers = [{name = 'CourtBouillon', email = 'contact@courtbouillon.org'}]
requires-python = '>=3.7'
requires-python = '>=3.8'
readme = {file = 'README.rst', content-type = 'text/x-rst'}
license = {file = 'LICENSE'}
dependencies = ['tinycss2', 'webencodings']
Expand All @@ -20,10 +20,11 @@ classifiers = [
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Internet :: WWW/HTTP',
Expand Down Expand Up @@ -58,4 +59,4 @@ select = ['E', 'W', 'F', 'I', 'N', 'RUF']
ignore = ['RUF001', 'RUF002', 'RUF003']

[tool.ruff.lint.extend-per-file-ignores]
'docs/example.py' = ['I001']
'docs/example.py' = ['I001']

0 comments on commit d65a4e4

Please sign in to comment.