diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 0aa7558..b06e790 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -14,7 +14,7 @@ jobs: - python-version: "3.12" env: TOXENV: pylint - - python-version: "3.11" # Keep in sync with .readthedocs.yml + - python-version: "3.12" env: TOXENV: docs - python-version: "3.12" @@ -28,7 +28,7 @@ jobs: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 58c8ad3..ebbb8df 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v4 - name: Set up Python 3.12 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.12" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f170ad9..eb2561d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,7 +37,7 @@ jobs: sudo apt-get install libxml2-dev libxslt-dev - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9f1a2f1..db43480 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/PyCQA/bandit - rev: 1.7.7 + rev: 1.7.8 hooks: - id: bandit args: [-r, -c, .bandit.yml] @@ -9,10 +9,10 @@ repos: hooks: - id: flake8 - repo: https://github.com/psf/black.git - rev: 24.1.1 + rev: 24.2.0 hooks: - id: black - repo: https://github.com/pycqa/isort rev: 5.13.2 hooks: - - id: isort \ No newline at end of file + - id: isort diff --git a/.readthedocs.yml b/.readthedocs.yml index a6f8c79..d4f3908 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -8,7 +8,7 @@ build: tools: # For available versions, see: # https://docs.readthedocs.io/en/stable/config-file/v2.html#build-tools-python - python: "3.11" # Keep in sync with .github/workflows/checks.yml + python: "3.12" # Keep in sync with .github/workflows/checks.yml python: install: - requirements: docs/requirements.txt diff --git a/parsel/csstranslator.py b/parsel/csstranslator.py index ac6af32..80bfc7c 100644 --- a/parsel/csstranslator.py +++ b/parsel/csstranslator.py @@ -95,7 +95,7 @@ def xpath_pseudo_element( method = getattr(self, method_name, None) if not method: raise ExpressionError( - f"The functional pseudo-element ::{pseudo_element.name}() is unknown" # noqa: E231 + f"The functional pseudo-element ::{pseudo_element.name}() is unknown" ) xpath = method(xpath, pseudo_element) else: @@ -105,7 +105,7 @@ def xpath_pseudo_element( method = getattr(self, method_name, None) if not method: raise ExpressionError( - f"The pseudo-element ::{pseudo_element} is unknown" # noqa: E231 + f"The pseudo-element ::{pseudo_element} is unknown" ) xpath = method(xpath) return xpath @@ -116,7 +116,7 @@ def xpath_attr_functional_pseudo_element( """Support selecting attribute values using ::attr() pseudo-element""" if function.argument_types() not in (["STRING"], ["IDENT"]): raise ExpressionError( - f"Expected a single string or ident for ::attr(), got {function.arguments!r}" # noqa: E231 + f"Expected a single string or ident for ::attr(), got {function.arguments!r}" ) return XPathExpr.from_xpath(xpath, attribute=function.arguments[0].value) diff --git a/parsel/selector.py b/parsel/selector.py index dd9c936..2027599 100644 --- a/parsel/selector.py +++ b/parsel/selector.py @@ -30,7 +30,7 @@ from .utils import extract_regex, flatten, iflatten, shorten _SelectorType = TypeVar("_SelectorType", bound="Selector") -_ParserType = Union[etree.XMLParser, etree.HTMLParser] +_ParserType = Union[etree.XMLParser, etree.HTMLParser] # type: ignore[type-arg] # simplified _OutputMethodArg from types-lxml _TostringMethodType = Literal[ "html", diff --git a/parsel/xpathfuncs.py b/parsel/xpathfuncs.py index 7b984c5..7633d10 100644 --- a/parsel/xpathfuncs.py +++ b/parsel/xpathfuncs.py @@ -22,7 +22,7 @@ def set_xpathfunc(fname: str, func: Optional[Callable]) -> None: # type: ignore .. _`in lxml documentation`: https://lxml.de/extensions.html#xpath-extension-functions """ - ns_fns = etree.FunctionNamespace(None) # type: ignore[attr-defined] + ns_fns = etree.FunctionNamespace(None) if func is not None: ns_fns[fname] = func else: diff --git a/pylintrc b/pylintrc index b044a4c..c909c45 100644 --- a/pylintrc +++ b/pylintrc @@ -15,6 +15,7 @@ disable=c-extension-no-member, no-else-return, no-member, parse-error, + protected-access, raise-missing-from, redefined-builtin, too-few-public-methods, diff --git a/setup.py b/setup.py index 1be8413..287583b 100644 --- a/setup.py +++ b/setup.py @@ -13,6 +13,7 @@ version="1.8.1", description="Parsel is a library to extract data from HTML and XML using XPath and CSS selectors", long_description=readme + "\n\n" + history, + long_description_content_type="text/x-rst", author="Scrapy project", author_email="info@scrapy.org", url="https://github.com/scrapy/parsel", diff --git a/tox.ini b/tox.ini index ce003c1..893b8de 100644 --- a/tox.ini +++ b/tox.ini @@ -10,19 +10,19 @@ commands = py.test --cov=parsel --cov-report=xml {posargs:docs parsel tests} [testenv:typing] deps = {[testenv]deps} - types-jmespath==1.0.2.6 - types-lxml==2022.11.8 - types-psutil==5.9.5.6 - types-setuptools==67.2.0.1 + types-jmespath==1.0.2.20240106 + types-lxml==2024.2.9 + types-psutil==5.9.5.20240311 + types-setuptools==69.1.0.20240310 py==1.11.0 - mypy==1.0.0 + mypy==1.9.0 commands = mypy {posargs:parsel tests} --strict [testenv:pylint] deps = {[testenv]deps} - pylint==3.0.0 + pylint==3.1.0 commands = pylint docs parsel tests setup.py @@ -43,8 +43,8 @@ commands = [testenv:twinecheck] basepython = python3 deps = - twine==4.0.2 - build==0.10.0 + twine==5.0.0 + build==1.1.1 commands = python -m build --sdist twine check dist/*