Skip to content
Snippets Groups Projects
Commit 2adfcd3b authored by Andrey Rakhmatullin's avatar Andrey Rakhmatullin
Browse files

New upstream version 1.3.0

parent 2af3f66c
No related branches found
No related tags found
No related merge requests found
skips:
- B101
[bumpversion]
current_version = 1.2.0
commit = True
tag = True
[bumpversion:file:cssselect/__init__.py]
[run]
branch = True
source = cssselect
[report]
exclude_lines =
pragma: no cover
def __repr__
if sys.version_info
if __name__ == '__main__':
[flake8]
max-line-length = 99
ignore =
W503
E266 # too many leading '#' for block comment
exclude =
.git
.tox
venv*
# pending revision
docs/conf.py
per-file-ignores =
cssselect/__init__.py:F401
# applying pre-commit hooks to the project
e91101b37f82558db84a6b8ee9a6dba1fd2ae0bb
\ No newline at end of file
......@@ -5,32 +5,27 @@ jobs:
checks:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- python-version: 3
env:
TOXENV: black
- python-version: 3
env:
TOXENV: flake8
- python-version: 3
- python-version: 3.13
env:
TOXENV: pylint
- python-version: 3
env:
TOXENV: security
- python-version: 3
- python-version: 3.13 # Keep in sync with .readthedocs.yml
env:
TOXENV: docs
- python-version: 3
- python-version: 3.13
env:
TOXENV: typing
- python-version: 3.13
env:
TOXENV: twinecheck
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
......@@ -40,3 +35,9 @@ jobs:
pip install -U pip
pip install -U tox
tox
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pre-commit/action@v3.0.1
name: Publish
on: [push]
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
publish:
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags/')
environment:
name: pypi
url: https://pypi.org/p/cssselect
permissions:
id-token: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3
python-version: 3.13
- name: Check Tag
id: check-release-tag
- name: Build
run: |
if [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+[.][0-9]+[.][0-9]+(rc[0-9]+|[.]dev[0-9]+)?$ ]]; then
echo ::set-output name=release_tag::true
fi
python -m pip install --upgrade build
python -m build
- name: Publish to PyPI
if: steps.check-release-tag.outputs.release_tag == 'true'
run: |
pip install --upgrade setuptools wheel twine
python setup.py sdist bdist_wheel
export TWINE_USERNAME=__token__
export TWINE_PASSWORD=${{ secrets.PYPI_TOKEN }}
twine upload dist/*
uses: pypa/gh-action-pypi-publish@release/v1
......@@ -5,14 +5,15 @@ jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.10"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
......@@ -23,4 +24,4 @@ jobs:
tox -e py
- name: Upload coverage report
run: bash <(curl -s https://codecov.io/bash)
uses: codecov/codecov-action@v5
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.10
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
version: 2
formats: all
sphinx:
configuration: docs/conf.py
fail_on_warning: true
build:
os: ubuntu-24.04
tools:
# For available versions, see:
# https://docs.readthedocs.io/en/stable/config-file/v2.html#build-tools-python
python: "3.13" # Keep in sync with .github/workflows/checks.yml
python:
install:
- requirements: docs/requirements.txt
- path: .
Changelog
=========
Version 1.3.0
-------------
Released on 2025-03-10.
* Dropped support for Python 3.7-3.8, added support for Python 3.12-3.13 and
PyPy 3.10.
* Removed ``_unicode_safe_getattr()``, deprecated in 1.2.0.
* Added ``pre-commit`` and formatted the code with ``ruff``.
* Many CI additions and improvements.
Version 1.2.0
-------------
......
include AUTHORS CHANGES LICENSE README.rst tox.ini .coveragerc py.typed
include AUTHORS CHANGES LICENSE README.rst tox.ini cssselect/py.typed
recursive-include docs *
recursive-include tests *
prune docs/_build
# -*- coding: utf-8 -*-
"""
CSS Selectors based on XPath
============================
CSS Selectors based on XPath
============================
This module supports selecting XML/HTML elements based on CSS selectors.
See the `CSSSelector` class for details.
This module supports selecting XML/HTML elements based on CSS selectors.
See the `CSSSelector` class for details.
:copyright: (c) 2007-2012 Ian Bicking and contributors.
See AUTHORS for more details.
:license: BSD, see LICENSE for more details.
:copyright: (c) 2007-2012 Ian Bicking and contributors.
See AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from cssselect.parser import (
parse,
Selector,
FunctionalPseudoElement,
Selector,
SelectorError,
SelectorSyntaxError,
parse,
)
from cssselect.xpath import GenericTranslator, HTMLTranslator, ExpressionError
from cssselect.xpath import ExpressionError, GenericTranslator, HTMLTranslator
__all__ = (
"ExpressionError",
"FunctionalPseudoElement",
"GenericTranslator",
"HTMLTranslator",
"parse",
"Selector",
"SelectorError",
"SelectorSyntaxError",
"parse",
)
VERSION = "1.2.0"
VERSION = "1.3.0"
__version__ = VERSION
This diff is collapsed.
This diff is collapsed.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# cssselect documentation build configuration file, created by
# sphinx-quickstart on Tue Mar 27 14:20:34 2012.
......@@ -12,217 +11,210 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os, re
import re
from pathlib import Path
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx',
'sphinx.ext.doctest']
extensions = ["sphinx.ext.autodoc", "sphinx.ext.intersphinx", "sphinx.ext.doctest"]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]
# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = ".rst"
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
master_doc = "index"
# General information about the project.
project = 'cssselect'
copyright = '2012-2017, Simon Sapin, Scrapy developers'
project = "cssselect"
copyright = "2012-2017, Simon Sapin, Scrapy developers"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The full version, including alpha/beta/rc tags.
with open(os.path.join(os.path.dirname(__file__), '..', 'cssselect', '__init__.py')) as init_file:
init_py = init_file.read()
init_py = (Path(__file__).parent.parent / "cssselect" / "__init__.py").read_text()
release = re.search('VERSION = "([^"]+)"', init_py).group(1)
# The short X.Y version.
version = release.rstrip('dev')
version = release.rstrip("dev")
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
exclude_patterns = ["_build"]
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'classic'
html_theme = "sphinx_rtd_theme"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path = ['_static']
# html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'cssselectdoc'
htmlhelp_basename = "cssselectdoc"
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'cssselect.tex', 'cssselect Documentation',
'Simon Sapin', 'manual'),
("index", "cssselect.tex", "cssselect Documentation", "Simon Sapin", "manual"),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'cssselect', 'cssselect Documentation',
['Simon Sapin'], 1)
]
man_pages = [("index", "cssselect", "cssselect Documentation", ["Simon Sapin"], 1)]
# If true, show URL addresses after external links.
#man_show_urls = False
# man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
......@@ -231,23 +223,29 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'cssselect', 'cssselect Documentation',
'Simon Sapin', 'cssselect', 'One line description of project.',
'Miscellaneous'),
(
"index",
"cssselect",
"cssselect Documentation",
"Simon Sapin",
"cssselect",
"One line description of project.",
"Miscellaneous",
),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# texinfo_show_urls = 'footnote'
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'http://docs.python.org/': None}
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
# --- Nitpicking options ------------------------------------------------------
......@@ -255,5 +253,5 @@ intersphinx_mapping = {'http://docs.python.org/': None}
nitpicky = True
nitpick_ignore = [
# explicitly not a part of the public API
('py:class', 'cssselect.parser.Token'),
("py:class", "Token"),
]
......@@ -3,6 +3,7 @@ from doctest import ELLIPSIS, NORMALIZE_WHITESPACE
from sybil import Sybil
from sybil.parsers.doctest import DocTestParser
from sybil.parsers.skip import skip
try:
# sybil 3.0.0+
from sybil.parsers.codeblock import PythonCodeBlockParser
......@@ -13,8 +14,8 @@ except ImportError:
pytest_collect_file = Sybil(
parsers=[
DocTestParser(optionflags=ELLIPSIS | NORMALIZE_WHITESPACE),
PythonCodeBlockParser(future_imports=['print_function']),
PythonCodeBlockParser(future_imports=["print_function"]),
skip,
],
pattern='*.rst',
pattern="*.rst",
).pytest()
sphinx==8.2.3
sphinx-rtd-theme==3.0.2
[MASTER]
persistent=no
[MESSAGES CONTROL]
disable=assignment-from-no-return,
c-extension-no-member,
consider-using-f-string,
consider-using-in,
fixme,
inconsistent-return-statements,
invalid-name,
missing-class-docstring,
missing-function-docstring,
missing-module-docstring,
multiple-imports,
no-else-return,
no-member,
raise-missing-from,
redefined-builtin,
redefined-outer-name,
too-few-public-methods,
too-many-arguments,
too-many-branches,
too-many-function-args,
too-many-lines,
too-many-public-methods,
too-many-statements,
undefined-variable,
unidiomatic-typecheck,
unspecified-encoding,
unused-argument,
unused-import,
[tool.black]
line-length = 99
[tool.bumpversion]
current_version = "1.3.0"
commit = true
tag = true
[[tool.bumpversion.files]]
filename = "cssselect/__init__.py"
[tool.coverage.run]
branch = true
source = ["cssselect"]
[tool.coverage.report]
exclude_also = [
"def __repr__",
"if sys.version_info",
"if __name__ == '__main__':",
"if TYPE_CHECKING:",
]
[tool.pylint.MASTER]
persistent = "no"
extension-pkg-allow-list = ["lxml"]
[tool.pylint."MESSAGES CONTROL"]
enable = [
"useless-suppression",
]
disable = [
"consider-using-f-string",
"fixme",
"invalid-name",
"line-too-long",
"missing-class-docstring",
"missing-function-docstring",
"missing-module-docstring",
"no-member",
"not-callable",
"redefined-builtin",
"redefined-outer-name",
"too-few-public-methods",
"too-many-arguments",
"too-many-branches",
"too-many-function-args",
"too-many-lines",
"too-many-locals",
"too-many-positional-arguments",
"too-many-public-methods",
"too-many-statements",
"unused-argument",
]
[tool.pytest.ini_options]
testpaths = ["tests"]
[tool.ruff.lint]
extend-select = [
# flake8-bugbear
"B",
# flake8-comprehensions
"C4",
# pydocstyle
"D",
# flake8-future-annotations
"FA",
# flynt
"FLY",
# refurb
"FURB",
# isort
"I",
# flake8-implicit-str-concat
"ISC",
# flake8-logging
"LOG",
# Perflint
"PERF",
# pygrep-hooks
"PGH",
# flake8-pie
"PIE",
# pylint
"PL",
# flake8-use-pathlib
"PTH",
# flake8-pyi
"PYI",
# flake8-quotes
"Q",
# flake8-return
"RET",
# flake8-raise
"RSE",
# Ruff-specific rules
"RUF",
# flake8-bandit
"S",
# flake8-simplify
"SIM",
# flake8-slots
"SLOT",
# flake8-debugger
"T10",
# flake8-type-checking
"TC",
# pyupgrade
"UP",
# pycodestyle warnings
"W",
# flake8-2020
"YTT",
]
ignore = [
# Missing docstring in public module
"D100",
# Missing docstring in public class
"D101",
# Missing docstring in public method
"D102",
# Missing docstring in public function
"D103",
# Missing docstring in public package
"D104",
# Missing docstring in magic method
"D105",
# Missing docstring in public nested class
"D106",
# Missing docstring in __init__
"D107",
# One-line docstring should fit on one line with quotes
"D200",
# No blank lines allowed after function docstring
"D202",
# 1 blank line required between summary line and description
"D205",
# Multi-line docstring closing quotes should be on a separate line
"D209",
# First line should end with a period
"D400",
# First line should be in imperative mood; try rephrasing
"D401",
# First line should not be the function's "signature"
"D402",
# First word of the first line should be properly capitalized
"D403",
# Too many return statements
"PLR0911",
# Too many branches
"PLR0912",
# Too many arguments in function definition
"PLR0913",
# Too many statements
"PLR0915",
# Magic value used in comparison
"PLR2004",
# String contains ambiguous {}.
"RUF001",
# Docstring contains ambiguous {}.
"RUF002",
# Comment contains ambiguous {}.
"RUF003",
# Mutable class attributes should be annotated with `typing.ClassVar`
"RUF012",
# Use of `assert` detected
"S101",
# Using lxml to parse untrusted data is known to be vulnerable to XML attacks
"S320",
]
[tool.ruff.lint.pydocstyle]
convention = "pep257"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment