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
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ jobs:
os: macos-latest
- python-version: '3.11'
os: windows-latest
# PyPy 3.9 on Windows fails to build zstandard (hatch dep) due to
# missing distutils.msvc9compiler in cffi on PyPy; no value in testing this combo
- python-version: 'pypy-3.9-v7.x'
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -102,5 +106,5 @@ jobs:
run: |
expected_wheel=(-emkdocs/{templates/sitemap.xml,config/base.py,py.typed,contrib/search/lunr-language/lunr.nl.js,themes/{mkdocs,readthedocs}/{base.html,locales/{de,es}/LC_MESSAGES/messages.mo}})
expected_sdist=("${expected_wheel[@]}" -e{pyproject.toml,hatch_build.py})
test "$(tar -ztf dist/mkdocs-*.tar.gz | grep -F "${expected_sdist[@]}" | tee /dev/stderr | wc -l)" -eq "${#expected_sdist[@]}"
test "$(unzip -l dist/mkdocs-*any.whl | grep -F "${expected_wheel[@]}" | tee /dev/stderr | wc -l)" -eq "${#expected_wheel[@]}"
test "$(tar -ztf dist/mkdocs_ng-*.tar.gz | grep -F "${expected_sdist[@]}" | tee /dev/stderr | wc -l)" -eq "${#expected_sdist[@]}"
Comment thread
shenxianpeng marked this conversation as resolved.
test "$(unzip -l dist/mkdocs_ng-*any.whl | grep -F "${expected_wheel[@]}" | tee /dev/stderr | wc -l)" -eq "${#expected_wheel[@]}"
3 changes: 1 addition & 2 deletions mkdocs/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ def cli():
@cli.command(name="serve")
@click.option('-a', '--dev-addr', help=dev_addr_help, metavar='<IP:PORT>')
@click.option('-o', '--open', 'open_in_browser', help=serve_open_help, is_flag=True)
@click.option('--no-livereload', 'livereload', flag_value=False, help=no_reload_help)
@click.option('--livereload', 'livereload', flag_value=True, default=True, hidden=True)
@click.option('--livereload/--no-livereload', default=True, help='Enable/disable live reloading.')
@click.option('--dirtyreload', 'build_type', flag_value='dirty', hidden=True)
@click.option('--dirty', 'build_type', flag_value='dirty', help=serve_dirty_help)
@click.option('-c', '--clean', 'build_type', flag_value='clean', help=serve_clean_help)
Expand Down
5 changes: 4 additions & 1 deletion mkdocs/config/config_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import string
import sys
import textwrap
import traceback
import types
import warnings
Expand Down Expand Up @@ -1221,6 +1222,8 @@ def run_validation(self, value: object) -> pathspec.gitignore.GitIgnoreSpec:
if not isinstance(value, str):
raise ValidationError(f'Expected a multiline string, but a {type(value)} was given.')
try:
return pathspec.gitignore.GitIgnoreSpec.from_lines(lines=value.splitlines())
return pathspec.gitignore.GitIgnoreSpec.from_lines(
lines=textwrap.dedent(value).splitlines()
)
except ValueError as e:
raise ValidationError(str(e))
2 changes: 1 addition & 1 deletion mkdocs/structure/toc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class _TocToken(TypedDict):
def get_toc(toc_tokens: list[_TocToken]) -> TableOfContents:
toc = [_parse_toc_token(i) for i in toc_tokens]
# For the table of contents, always mark the first element as active
if len(toc):
if toc:
toc[0].active = True # type: ignore[attr-defined]
return TableOfContents(toc)

Expand Down
2 changes: 1 addition & 1 deletion mkdocs/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def example(self, tdir):
with open(pth, 'r', encoding='utf-8') as f:
assert f.read() == 'bar content'
"""
files = {f: '' for f in files} if isinstance(files, (list, tuple)) else files or {}
files = dict.fromkeys(files, '') if isinstance(files, (list, tuple)) else files or {}

kw['prefix'] = 'mkdocs_test-' + kw.get('prefix', '')

Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ artifacts = ["/mkdocs/**/*.mo"]
[tool.hatch.build.targets.sdist]
include = ["/mkdocs"]
[tool.hatch.build.targets.wheel]
packages = ["mkdocs"]
exclude = ["/mkdocs/tests", "*.po", "*.pot", "babel.cfg"]
[tool.hatch.build.hooks.custom]
dependencies = [
Expand Down Expand Up @@ -129,7 +130,7 @@ _coverage = [
]
with-coverage = "test"
[[tool.hatch.envs.test.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3"]
python = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "pypy3"]
type = ["default", "min-req"]
[tool.hatch.envs.test.overrides]
matrix.type.features = [
Expand All @@ -146,7 +147,7 @@ detached = false
[tool.hatch.envs.integration.scripts]
test = "python -m mkdocs.tests.integration"
[[tool.hatch.envs.integration.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3"]
python = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "pypy3"]
type = ["default", "no-babel"]
[tool.hatch.envs.integration.overrides]
matrix.type.features = [
Expand Down
Loading