Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.9
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.10

- name: install pandoc
uses: r-lib/actions/setup-pandoc@v2
Expand All @@ -27,7 +27,7 @@ jobs:
pip install tox

- name: Run package benchmarks
run: tox -e py39-bench-packages -- --benchmark-min-rounds 20 --benchmark-json bench-packages.json
run: tox -e py310-bench-packages -- --benchmark-min-rounds 20 --benchmark-json bench-packages.json

# - name: Upload package data
# uses: actions/upload-artifact@v3
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.10'
- uses: pre-commit/[email protected]

tests:
Expand All @@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['pypy-3.9', '3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['pypy-3.10', '3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v4
Expand All @@ -49,7 +49,7 @@ jobs:
run: |
pytest tests/ --cov=markdown_it --cov-report=xml --cov-report=term-missing
- name: Upload to Codecov
if: matrix.python-version == '3.9' && github.repository == 'executablebooks/markdown-it-py'
if: matrix.python-version == '3.10' && github.repository == 'executablebooks/markdown-it-py'
uses: codecov/codecov-action@v5
with:
name: markdown-it-py-pytests
Expand All @@ -63,7 +63,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9']
python-version: ['3.10']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -87,18 +87,18 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.9
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.10'

- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox

- name: Run benchmark
run: tox -e py39-bench-core -- --benchmark-json bench-core.json
run: tox -e py310-bench-core -- --benchmark-json bench-core.json

- name: Upload data
uses: actions/upload-artifact@v4
Expand All @@ -116,10 +116,10 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up Python 3.9
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.10'
- name: install flit
run: |
pip install flit~=3.4
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.9"
python: "3.10"

python:
install:
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@


intersphinx_mapping = {
"python": ("https://docs.python.org/3.9", None),
"python": ("https://docs.python.org/3.10", None),
"mdit-py-plugins": ("https://mdit-py-plugins.readthedocs.io/en/latest/", None),
}

Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This can also be used to run benchmarking tests using [pytest-benchmark](https:/

```shell
>> cd markdown-it-py
tox -e py39-bench-packages -- --benchmark-min-rounds 50
tox -e py310-bench-packages -- --benchmark-min-rounds 50
```

For documentation build tests:
Expand Down
10 changes: 0 additions & 10 deletions markdown_it/_compat.py
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
from __future__ import annotations

from collections.abc import Mapping
import sys
from typing import Any

DATACLASS_KWARGS: Mapping[str, Any]
if sys.version_info >= (3, 10):
DATACLASS_KWARGS = {"slots": True}
else:
DATACLASS_KWARGS = {}
2 changes: 1 addition & 1 deletion markdown_it/_punycode.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

import codecs
from collections.abc import Callable
import re
from typing import Callable

REGEX_SEPARATORS = re.compile(r"[\x2E\u3002\uFF0E\uFF61]")
REGEX_NON_ASCII = re.compile(r"[^\0-\x7E]")
Expand Down
3 changes: 2 additions & 1 deletion markdown_it/parser_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

from __future__ import annotations

from collections.abc import Callable
import logging
from typing import TYPE_CHECKING, Callable
from typing import TYPE_CHECKING

from . import rules_block
from .ruler import Ruler
Expand Down
2 changes: 1 addition & 1 deletion markdown_it/parser_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from __future__ import annotations

from typing import Callable
from collections.abc import Callable

from .ruler import Ruler
from .rules_core import (
Expand Down
3 changes: 2 additions & 1 deletion markdown_it/parser_inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

from __future__ import annotations

from typing import TYPE_CHECKING, Callable
from collections.abc import Callable
from typing import TYPE_CHECKING

from . import rules_inline
from .ruler import Ruler
Expand Down
4 changes: 1 addition & 3 deletions markdown_it/ruler.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ class Ruler
from typing import TYPE_CHECKING, Generic, TypedDict, TypeVar
import warnings

from markdown_it._compat import DATACLASS_KWARGS

from .utils import EnvType

if TYPE_CHECKING:
Expand Down Expand Up @@ -66,7 +64,7 @@ class RuleOptionsType(TypedDict, total=False):
"""A rule function, whose signature is dependent on the state type."""


@dataclass(**DATACLASS_KWARGS)
@dataclass(slots=True)
class Rule(Generic[RuleFuncTv]):
name: str
enabled: bool
Expand Down
3 changes: 1 addition & 2 deletions markdown_it/rules_inline/state_inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Literal

from .._compat import DATACLASS_KWARGS
from ..common.utils import isMdAsciiPunct, isPunctChar, isWhiteSpace
from ..ruler import StateBase
from ..token import Token
Expand All @@ -14,7 +13,7 @@
from markdown_it import MarkdownIt


@dataclass(**DATACLASS_KWARGS)
@dataclass(slots=True)
class Delimiter:
# Char code of the starting marker (number).
marker: int
Expand Down
4 changes: 1 addition & 3 deletions markdown_it/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
from typing import Any, Literal
import warnings

from markdown_it._compat import DATACLASS_KWARGS


def convert_attrs(value: Any) -> Any:
"""Convert Token.attrs set as ``None`` or ``[[key, value], ...]`` to a dict.
Expand All @@ -20,7 +18,7 @@ def convert_attrs(value: Any) -> Any:
return value


@dc.dataclass(**DATACLASS_KWARGS)
@dc.dataclass(slots=True)
class Token:
type: str
"""Type of the token (string, e.g. "paragraph_open")"""
Expand Down
4 changes: 2 additions & 2 deletions markdown_it/utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from __future__ import annotations

from collections.abc import Iterable, MutableMapping
from collections.abc import Callable, Iterable, MutableMapping
from collections.abc import MutableMapping as MutableMappingABC
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, TypedDict, cast
from typing import TYPE_CHECKING, Any, TypedDict, cast

if TYPE_CHECKING:
from typing_extensions import NotRequired
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand All @@ -25,7 +24,7 @@ classifiers = [
"Topic :: Text Processing :: Markup",
]
keywords = ["markdown", "lexer", "parser", "commonmark", "markdown-it"]
requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = [
"mdurl~=0.1",
]
Expand Down
10 changes: 5 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
# then run `tox` or `tox -- {pytest args}`
# run in parallel using `tox -p`
[tox]
envlist = py39
envlist = py310

[testenv]
usedevelop = true

[testenv:py{39,310,311,312,313}]
[testenv:py{310,311,312,313}]
extras =
linkify
testing
commands = pytest {posargs:tests/}

[testenv:py{39,310,311,312,313}-plugins]
[testenv:py{310,311,312,313}-plugins]
extras = testing
changedir = {envtmpdir}
allowlist_externals =
Expand All @@ -27,11 +27,11 @@ commands_pre =
commands =
pytest {posargs}

[testenv:py{39,310,311,312,313}-bench-core]
[testenv:py{310,311,312,313}-bench-core]
extras = benchmarking
commands = pytest benchmarking/bench_core.py {posargs}

[testenv:py{39,310,311,312,313}-bench-packages]
[testenv:py{310,311,312,313}-bench-packages]
extras = benchmarking,compare
commands = pytest benchmarking/bench_packages.py {posargs}

Expand Down