From 7c0a44969b75614e81b5326b4bb93251f30c7db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Wed, 23 Feb 2022 13:40:47 +0100 Subject: [PATCH 01/18] Watch included files when serving with Mkdocs --- .gitignore | 2 ++ .yamllint | 1 + mkdocs_include_markdown_plugin/event.py | 20 +++++++++-- mkdocs_include_markdown_plugin/plugin.py | 35 +++++++++++++++++++ setup.cfg | 2 ++ .../test_on_serve/docs/index.md | 3 ++ .../test_on_serve/included.md | 1 + .../test_integration/test_on_serve/mkdocs.yml | 4 +++ .../test_on_serve/test_on_serve.py | 0 tests/{ => test_unit}/test_exclude.py | 0 tests/{ => test_unit}/test_glob_include.py | 0 tests/{ => test_unit}/test_include.py | 0 .../{ => test_unit}/test_include_markdown.py | 0 tests/{ => test_unit}/test_nested_includes.py | 0 tests/{ => test_unit}/test_process.py | 0 15 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 tests/test_integration/test_on_serve/docs/index.md create mode 100644 tests/test_integration/test_on_serve/included.md create mode 100644 tests/test_integration/test_on_serve/mkdocs.yml create mode 100644 tests/test_integration/test_on_serve/test_on_serve.py rename tests/{ => test_unit}/test_exclude.py (100%) rename tests/{ => test_unit}/test_glob_include.py (100%) rename tests/{ => test_unit}/test_include.py (100%) rename tests/{ => test_unit}/test_include_markdown.py (100%) rename tests/{ => test_unit}/test_nested_includes.py (100%) rename tests/{ => test_unit}/test_process.py (100%) diff --git a/.gitignore b/.gitignore index b6e4761..b0668a1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +tests/test_integration/test_on_serve/site + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/.yamllint b/.yamllint index 1a2ec3e..66a91da 100644 --- a/.yamllint +++ b/.yamllint @@ -30,6 +30,7 @@ rules: ignore: | .pre-commit-config.yaml .github + tests/test_integration/test_on_serve/mkdocs.yml line-length: allow-non-breakable-words: true max: 80 diff --git a/mkdocs_include_markdown_plugin/event.py b/mkdocs_include_markdown_plugin/event.py index 2e10176..c82fa3a 100644 --- a/mkdocs_include_markdown_plugin/event.py +++ b/mkdocs_include_markdown_plugin/event.py @@ -60,7 +60,12 @@ } -def get_file_content(markdown, abs_src_path, cumulative_heading_offset=0): +def get_file_content( + markdown, + abs_src_path, + cumulative_heading_offset=0, + build=None, +): page_src_path = Path(abs_src_path) def found_include_tag(match): @@ -106,6 +111,8 @@ def found_include_tag(match): raise FileNotFoundError( f'Any files found using \'{filename}\' at {page_src_path}', ) + else: + build.included_files.extend(file_paths_to_include) # handle options and regex modifiers @@ -157,6 +164,7 @@ def found_include_tag(match): new_text_to_include = get_file_content( new_text_to_include, file_path, + build=build, ) text_to_include += new_text_to_include @@ -219,6 +227,8 @@ def found_include_markdown_tag(match): raise FileNotFoundError( f'Any files found using \'{filename}\' at {page_src_path}', ) + else: + build.included_files.extend(file_paths_to_include) # handle options and regex modifiers @@ -287,6 +297,7 @@ def found_include_markdown_tag(match): new_text_to_include = get_file_content( new_text_to_include, file_path, + build=build, ) # relative URLs rewriting @@ -315,6 +326,7 @@ def found_include_markdown_tag(match): new_text_to_include, file_path, cumulative_heading_offset=cumulative_heading_offset, + build=build, ) if offset_match: @@ -351,4 +363,8 @@ def found_include_markdown_tag(match): def on_page_markdown(markdown, page, **kwargs): - return get_file_content(markdown, page.file.abs_src_path) + return get_file_content( + markdown, + page.file.abs_src_path, + build=kwargs['build'], + ) diff --git a/mkdocs_include_markdown_plugin/plugin.py b/mkdocs_include_markdown_plugin/plugin.py index 0d0daa0..debc01d 100644 --- a/mkdocs_include_markdown_plugin/plugin.py +++ b/mkdocs_include_markdown_plugin/plugin.py @@ -5,6 +5,41 @@ ) +class WatchingFiles: + def __init__(self): + self.prev_included_files = [] + self.included_files = [] + + +SERVER = None +WATCHING_FILES = None + + class IncludeMarkdownPlugin(mkdocs.plugins.BasePlugin): + def _watch_included_files(self): + for filepath in WATCHING_FILES.prev_included_files: + if filepath not in WATCHING_FILES.included_files: + SERVER.unwatch(filepath) + WATCHING_FILES.prev_included_files = WATCHING_FILES.included_files[:] + + for filepath in WATCHING_FILES.included_files: + SERVER.watch(filepath, recursive=False) + WATCHING_FILES.included_files = [] + def on_page_markdown(self, markdown, page, **kwargs): + global WATCHING_FILES + if WATCHING_FILES is None: + WATCHING_FILES = WatchingFiles() + kwargs['build'] = WATCHING_FILES return _on_page_markdown(markdown, page, **kwargs) + + def on_page_content(self, html, *args, **kwargs): + if SERVER: + self._watch_included_files() + return html + + def on_serve(self, server, builder, **kwargs): + global SERVER + if SERVER is None: + SERVER = server + self._watch_included_files() diff --git a/setup.cfg b/setup.cfg index 53845bf..228f9b9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -47,12 +47,14 @@ dev = flake8-print==4.0.0 isort==5.9.1 mdpo==0.3.61 + mkdocs==1.2.3 pre-commit==2.13.0 pytest==6.2.5 pytest-cov==3.0.0 pyupgrade==2.19.4 yamllint==1.26.1 test = + mkdocs==1.2.3 pytest==6.2.5 pytest-cov==3.0.0 diff --git a/tests/test_integration/test_on_serve/docs/index.md b/tests/test_integration/test_on_serve/docs/index.md new file mode 100644 index 0000000..fb7f7dd --- /dev/null +++ b/tests/test_integration/test_on_serve/docs/index.md @@ -0,0 +1,3 @@ +# Title + +{% include-markdown "../included.md" %} diff --git a/tests/test_integration/test_on_serve/included.md b/tests/test_integration/test_on_serve/included.md new file mode 100644 index 0000000..99dc18e --- /dev/null +++ b/tests/test_integration/test_on_serve/included.md @@ -0,0 +1 @@ +This content is included. diff --git a/tests/test_integration/test_on_serve/mkdocs.yml b/tests/test_integration/test_on_serve/mkdocs.yml new file mode 100644 index 0000000..8662b28 --- /dev/null +++ b/tests/test_integration/test_on_serve/mkdocs.yml @@ -0,0 +1,4 @@ +site_name: mkdocs-include-markdown-plugin integration tests + +plugins: + - include-markdown diff --git a/tests/test_integration/test_on_serve/test_on_serve.py b/tests/test_integration/test_on_serve/test_on_serve.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_exclude.py b/tests/test_unit/test_exclude.py similarity index 100% rename from tests/test_exclude.py rename to tests/test_unit/test_exclude.py diff --git a/tests/test_glob_include.py b/tests/test_unit/test_glob_include.py similarity index 100% rename from tests/test_glob_include.py rename to tests/test_unit/test_glob_include.py diff --git a/tests/test_include.py b/tests/test_unit/test_include.py similarity index 100% rename from tests/test_include.py rename to tests/test_unit/test_include.py diff --git a/tests/test_include_markdown.py b/tests/test_unit/test_include_markdown.py similarity index 100% rename from tests/test_include_markdown.py rename to tests/test_unit/test_include_markdown.py diff --git a/tests/test_nested_includes.py b/tests/test_unit/test_nested_includes.py similarity index 100% rename from tests/test_nested_includes.py rename to tests/test_unit/test_nested_includes.py diff --git a/tests/test_process.py b/tests/test_unit/test_process.py similarity index 100% rename from tests/test_process.py rename to tests/test_unit/test_process.py From 7d6a69b13355a0df30a048d170d09f61aa72bf3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Sat, 17 Sep 2022 01:48:02 +0200 Subject: [PATCH 02/18] Update .gitignore --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index 478cd96..4829dcf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -tests/test_integration/test_on_serve/site - # Mkdocs files site/ From a54bf45898b3f2b1cc64957d22a2763904a20a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Sat, 17 Sep 2022 01:49:15 +0200 Subject: [PATCH 03/18] Fix error in code --- mkdocs_include_markdown_plugin/event.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mkdocs_include_markdown_plugin/event.py b/mkdocs_include_markdown_plugin/event.py index 7f7031d..fa0c862 100644 --- a/mkdocs_include_markdown_plugin/event.py +++ b/mkdocs_include_markdown_plugin/event.py @@ -194,6 +194,12 @@ def found_include_tag(match): markdown, directive_match_start, ) + logger.error( + f"No files found including '{raw_filename}'" + f' at {os.path.relpath(page_src_path, docs_dir)}' + f':{lineno}', + ) + return '' else: build.included_files.extend(file_paths_to_include) @@ -427,6 +433,12 @@ def found_include_markdown_tag(match): markdown, directive_match_start, ) + logger.error( + f"No files found including '{raw_filename}' at" + f' {os.path.relpath(page_src_path, docs_dir)}' + f':{lineno}', + ) + return '' else: build.included_files.extend(file_paths_to_include) From a85216a96d8a948a9b8a326b1560701c5d9929fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Sat, 17 Sep 2022 01:50:19 +0200 Subject: [PATCH 04/18] Revert change --- .yamllint | 1 + 1 file changed, 1 insertion(+) diff --git a/.yamllint b/.yamllint index 7fa7df7..5e2fc71 100644 --- a/.yamllint +++ b/.yamllint @@ -26,6 +26,7 @@ rules: ignore: | .github key-duplicates: enable + key-ordering: disable line-length: allow-non-breakable-words: true max: 80 From ce7500f6c973e283bc789537cfb4374c5f385108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Sat, 17 Sep 2022 01:54:09 +0200 Subject: [PATCH 05/18] Fix error --- mkdocs_include_markdown_plugin/event.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkdocs_include_markdown_plugin/event.py b/mkdocs_include_markdown_plugin/event.py index fa0c862..debae9d 100644 --- a/mkdocs_include_markdown_plugin/event.py +++ b/mkdocs_include_markdown_plugin/event.py @@ -200,7 +200,7 @@ def found_include_tag(match): f':{lineno}', ) return '' - else: + elif build is not None: build.included_files.extend(file_paths_to_include) bool_options = { @@ -439,7 +439,7 @@ def found_include_markdown_tag(match): f':{lineno}', ) return '' - else: + elif build is not None: build.included_files.extend(file_paths_to_include) bool_options = { From c460105805242c9825c37172fb29a3cb0d3d0ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Wed, 28 Sep 2022 19:07:48 +0200 Subject: [PATCH 06/18] Bump version --- .bumpversion.cfg | 2 +- mkdocs_include_markdown_plugin/__init__.py | 2 +- mkdocs_include_markdown_plugin/plugin.py | 109 ++++++++++++--------- setup.cfg | 13 +-- 4 files changed, 68 insertions(+), 58 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index c422629..2f99c1d 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.8.1 +current_version = 3.8.2 [bumpversion:file:mkdocs_include_markdown_plugin/__init__.py] diff --git a/mkdocs_include_markdown_plugin/__init__.py b/mkdocs_include_markdown_plugin/__init__.py index 9b44e07..267d781 100644 --- a/mkdocs_include_markdown_plugin/__init__.py +++ b/mkdocs_include_markdown_plugin/__init__.py @@ -1,2 +1,2 @@ __title__ = 'mkdocs_include_markdown_plugin' -__version__ = '3.8.1' +__version__ = '3.8.2' diff --git a/mkdocs_include_markdown_plugin/plugin.py b/mkdocs_include_markdown_plugin/plugin.py index f09f3a3..7cb6173 100644 --- a/mkdocs_include_markdown_plugin/plugin.py +++ b/mkdocs_include_markdown_plugin/plugin.py @@ -6,49 +6,66 @@ ) -class WatchingFiles: - def __init__(self): - self.prev_included_files = [] - self.included_files = [] - - -SERVER = None -WATCHING_FILES = None - - -class IncludeMarkdownPlugin(mkdocs.plugins.BasePlugin): - config_scheme = CONFIG_SCHEME - - def _watch_included_files(self): - for filepath in WATCHING_FILES.prev_included_files: - if filepath not in WATCHING_FILES.included_files: - SERVER.unwatch(filepath) - WATCHING_FILES.prev_included_files = WATCHING_FILES.included_files[:] - - for filepath in WATCHING_FILES.included_files: - SERVER.watch(filepath, recursive=False) - WATCHING_FILES.included_files = [] - - def on_page_content(self, html, *args, **kwargs): - if SERVER: - self._watch_included_files() - return html - - def on_serve(self, server, builder, **kwargs): - global SERVER - if SERVER is None: - SERVER = server - self._watch_included_files() - - def on_page_markdown(self, markdown, page, **kwargs): - global WATCHING_FILES - if WATCHING_FILES is None: - WATCHING_FILES = WatchingFiles() - kwargs['build'] = WATCHING_FILES - return _on_page_markdown( - markdown, - page, - kwargs['config']['docs_dir'], - config=self.config, - build=kwargs['build'], - ) +mkdocs__version_info__ = tuple( + int(num) for num in mkdocs.__version__.split('.') if num.isdigit() +) + +if mkdocs__version_info__ < (1, 4, 0): + class IncludeMarkdownPlugin(mkdocs.plugins.BasePlugin): + config_scheme = CONFIG_SCHEME + + def on_page_markdown(self, markdown, page, **kwargs): + return _on_page_markdown( + markdown, + page, + kwargs['config']['docs_dir'], + config=self.config, + build=None, + ) +else: + + class WatchingFiles: + def __init__(self): + self.prev_included_files = [] + self.included_files = [] + + SERVER = None + WATCHING_FILES = None + + class IncludeMarkdownPlugin(mkdocs.plugins.BasePlugin): + config_scheme = CONFIG_SCHEME + + def _watch_included_files(self): + for filepath in WATCHING_FILES.prev_included_files: + if filepath not in WATCHING_FILES.included_files: + SERVER.unwatch(filepath) + WATCHING_FILES.prev_included_files = ( + WATCHING_FILES.included_files[:] + ) + + for filepath in WATCHING_FILES.included_files: + SERVER.watch(filepath, recursive=False) + WATCHING_FILES.included_files = [] + + def on_page_content(self, html, *args, **kwargs): + if SERVER: + self._watch_included_files() + return html + + def on_serve(self, server, builder, **kwargs): + global SERVER + if SERVER is None: + SERVER = server + self._watch_included_files() + + def on_page_markdown(self, markdown, page, **kwargs): + global WATCHING_FILES + if WATCHING_FILES is None: + WATCHING_FILES = WatchingFiles() + return _on_page_markdown( + markdown, + page, + kwargs['config']['docs_dir'], + config=self.config, + build=WATCHING_FILES, + ) diff --git a/setup.cfg b/setup.cfg index ddcacf9..56656d1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = mkdocs_include_markdown_plugin -version = 3.8.1 +version = 3.8.2 description = Mkdocs Markdown includer plugin. long_description = file: README.md long_description_content_type = text/markdown @@ -42,19 +42,12 @@ mkdocs.plugins = [options.extras_require] dev = bump2version==1.0.1 - flake8==3.9.2 - flake8-implicit-str-concat==0.2.0 - flake8-print==4.0.0 - isort==5.9.1 - mdpo==0.3.61 - mkdocs==1.3.1 + mkdocs==1.4.0 pre-commit==2.13.0 pytest==6.2.5 pytest-cov==3.0.0 - pyupgrade==2.19.4 - yamllint==1.26.1 test = - mkdocs==1.3.1 + mkdocs==1.4.0 pytest==6.2.5 pytest-cov==3.0.0 From 25c8dcbdcc9a7cc555234aac58d1779b2c396d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Wed, 28 Sep 2022 19:32:36 +0200 Subject: [PATCH 07/18] Add tox configuration --- .editorconfig | 2 +- .github/workflows/ci.yml | 22 +++++++++++++++------- mkdocs_include_markdown_plugin/plugin.py | 1 + setup.cfg | 10 ++++------ tox.ini | 18 ++++++++++++++++++ 5 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 tox.ini diff --git a/.editorconfig b/.editorconfig index 077bcf0..6fd1d19 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,7 +7,7 @@ indent_style = space indent_size = 2 trim_trailing_whitespace = true -[*.{py,cfg}] +[*.{py,cfg,ini}] indent_size = 4 [*.{py,md}] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4ec11f..39e2ac0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,23 +27,31 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up Python v${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip coveralls - python -m pip install .[test] - pip list - - name: Test with pytest - run: pytest -svv + python -m pip install --upgrade pip coveralls tox + - name: Pick environment to run + shell: python + run: | + import codecs; import os; import sys + env = f"TOXENV=py3{sys.version_info[0]}\n" + print("Picked:\n{env}for{sys.version}") + with codecs.open(os.environ["GITHUB_ENV"], "a", "utf-8") as file_handler: + file_handler.write(env) + - name: Run tests + run: tox + env: + PYTEST_ADDOPTS: -vv - name: Coveralls run: coveralls env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_SERVICE_NAME: github - name: Test examples - run: pytest -svv tests/_test_examples.py + run: tox -e examples build-sdist: if: startsWith(github.ref, 'refs/tags/') diff --git a/mkdocs_include_markdown_plugin/plugin.py b/mkdocs_include_markdown_plugin/plugin.py index 7cb6173..94e41a9 100644 --- a/mkdocs_include_markdown_plugin/plugin.py +++ b/mkdocs_include_markdown_plugin/plugin.py @@ -58,6 +58,7 @@ def on_serve(self, server, builder, **kwargs): SERVER = server self._watch_included_files() + @mkdocs.plugins.event_priority(-100) def on_page_markdown(self, markdown, page, **kwargs): global WATCHING_FILES if WATCHING_FILES is None: diff --git a/setup.cfg b/setup.cfg index 56656d1..dd15b6d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -43,17 +43,15 @@ mkdocs.plugins = dev = bump2version==1.0.1 mkdocs==1.4.0 - pre-commit==2.13.0 - pytest==6.2.5 + pre-commit + pytest==7.1.3 pytest-cov==3.0.0 + tox test = mkdocs==1.4.0 - pytest==6.2.5 + pytest==7.1.3 pytest-cov==3.0.0 -[tool:pytest] -addopts = --cov=mkdocs_include_markdown_plugin --cov-report=html --cov-config=setup.cfg - [coverage:run] omit = mkdocs_include_markdown_plugin/plugin.py diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..c171984 --- /dev/null +++ b/tox.ini @@ -0,0 +1,18 @@ +[tox] +envlist = py3{7,8,9,10}-mkdocs{131,140} +skip_missing_interpreters = true + +[testenv] +extras = + test +deps = + mkdocs131: mkdocs==1.3.1 + mkdocs140: mkdocs==1.4.0 +commands = pytest --cov=mkdocs_include_markdown_plugin \ + --cov-report=html \ + --cov-config=setup.cfg \ + {posargs} +package = wheel + +[testenv:examples] +commands = pytest tests/_test_examples.py {posargs} From a0db518fb4fd21a7a3ade370b467a2473dd677af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Wed, 28 Sep 2022 19:33:37 +0200 Subject: [PATCH 08/18] Add Python3.6 to envlist --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index c171984..a74a417 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py3{7,8,9,10}-mkdocs{131,140} +envlist = py3{6,7,8,9,10}-mkdocs{131,140} skip_missing_interpreters = true [testenv] From bfa56924fa1b8447f3d0ba6ef0aa3db3e5908a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Wed, 28 Sep 2022 19:35:35 +0200 Subject: [PATCH 09/18] Try fix --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index a74a417..93cae20 100644 --- a/tox.ini +++ b/tox.ini @@ -8,6 +8,7 @@ extras = deps = mkdocs131: mkdocs==1.3.1 mkdocs140: mkdocs==1.4.0 + py36: mkdocs==1.3.1 commands = pytest --cov=mkdocs_include_markdown_plugin \ --cov-report=html \ --cov-config=setup.cfg \ From 24446b1d2ec9d9960406b30d65330dc953d238c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Wed, 28 Sep 2022 19:39:33 +0200 Subject: [PATCH 10/18] Stop testing against Python3.6 in CI --- .github/workflows/ci.yml | 1 - tox.ini | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39e2ac0..2bd342e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,6 @@ jobs: - ubuntu-latest - windows-latest python-version: - - 3.6 - 3.7 - 3.8 - 3.9 diff --git a/tox.ini b/tox.ini index 93cae20..c171984 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py3{6,7,8,9,10}-mkdocs{131,140} +envlist = py3{7,8,9,10}-mkdocs{131,140} skip_missing_interpreters = true [testenv] @@ -8,7 +8,6 @@ extras = deps = mkdocs131: mkdocs==1.3.1 mkdocs140: mkdocs==1.4.0 - py36: mkdocs==1.3.1 commands = pytest --cov=mkdocs_include_markdown_plugin \ --cov-report=html \ --cov-config=setup.cfg \ From 322d2ba3e2830d9788a444d3f43525a550fde577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Wed, 28 Sep 2022 19:40:43 +0200 Subject: [PATCH 11/18] Add MacOS to CI --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2bd342e..cab8b80 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,7 @@ jobs: os: - ubuntu-latest - windows-latest + - macos-latest python-version: - 3.7 - 3.8 From e188fb25430734403e2b34ce0fb00e5214fed5e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Wed, 28 Sep 2022 19:43:52 +0200 Subject: [PATCH 12/18] Add Mkdocs v1.2.4 to tests --- .bumpversion.cfg | 2 +- mkdocs_include_markdown_plugin/__init__.py | 2 +- setup.cfg | 2 +- tox.ini | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 2f99c1d..2796621 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.8.2 +current_version = 3.9.0 [bumpversion:file:mkdocs_include_markdown_plugin/__init__.py] diff --git a/mkdocs_include_markdown_plugin/__init__.py b/mkdocs_include_markdown_plugin/__init__.py index 267d781..cf59bca 100644 --- a/mkdocs_include_markdown_plugin/__init__.py +++ b/mkdocs_include_markdown_plugin/__init__.py @@ -1,2 +1,2 @@ __title__ = 'mkdocs_include_markdown_plugin' -__version__ = '3.8.2' +__version__ = '3.9.0' diff --git a/setup.cfg b/setup.cfg index dd15b6d..acc1eb7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = mkdocs_include_markdown_plugin -version = 3.8.2 +version = 3.9.0 description = Mkdocs Markdown includer plugin. long_description = file: README.md long_description_content_type = text/markdown diff --git a/tox.ini b/tox.ini index c171984..84ea7ac 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,12 @@ [tox] -envlist = py3{7,8,9,10}-mkdocs{131,140} +envlist = py3{7,8,9,10}-mkdocs{124,131,140} skip_missing_interpreters = true [testenv] extras = test deps = + mkdocs124: mkdocs==1.2.4 mkdocs131: mkdocs==1.3.1 mkdocs140: mkdocs==1.4.0 commands = pytest --cov=mkdocs_include_markdown_plugin \ From 24a2a88018e6da8f6ea31ef20ff16a1351f1736e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Wed, 28 Sep 2022 19:47:09 +0200 Subject: [PATCH 13/18] Fix error in CI --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cab8b80..88d1f61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: shell: python run: | import codecs; import os; import sys - env = f"TOXENV=py3{sys.version_info[0]}\n" + env = f"TOXENV=py3{sys.version_info[1]}\n" print("Picked:\n{env}for{sys.version}") with codecs.open(os.environ["GITHUB_ENV"], "a", "utf-8") as file_handler: file_handler.write(env) From ed225fed6d7e3e73f62df0bf294ca1939e952ec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Wed, 28 Sep 2022 20:03:14 +0200 Subject: [PATCH 14/18] Fix error in CI --- .github/workflows/ci.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88d1f61..85b36c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,14 +33,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip coveralls tox - - name: Pick environment to run - shell: python - run: | - import codecs; import os; import sys - env = f"TOXENV=py3{sys.version_info[1]}\n" - print("Picked:\n{env}for{sys.version}") - with codecs.open(os.environ["GITHUB_ENV"], "a", "utf-8") as file_handler: - file_handler.write(env) - name: Run tests run: tox env: From 7de1057b066253845c31b32f1fa123cf8944fec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Wed, 28 Sep 2022 20:10:06 +0200 Subject: [PATCH 15/18] Try to solve problem in CI --- .github/workflows/ci.yml | 2 +- tox.ini | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85b36c5..93aebe3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip coveralls tox + python -m pip install -U pip coveralls tox tox-gh-actions - name: Run tests run: tox env: diff --git a/tox.ini b/tox.ini index 84ea7ac..6a3c36a 100644 --- a/tox.ini +++ b/tox.ini @@ -2,6 +2,13 @@ envlist = py3{7,8,9,10}-mkdocs{124,131,140} skip_missing_interpreters = true +[gh-actions] +python = + 3.7: py37 + 3.8: py38 + 3.9: py39 + 3.10: py310 + [testenv] extras = test From aea9d1b5954039383cc52581c23f5d5649450dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Wed, 28 Sep 2022 20:13:58 +0200 Subject: [PATCH 16/18] Minor change --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93aebe3..a1316ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,8 @@ jobs: test: name: Test runs-on: ${{ matrix.os }} + env: + PYTEST_ADDOPTS: -vv strategy: matrix: os: @@ -35,8 +37,6 @@ jobs: python -m pip install -U pip coveralls tox tox-gh-actions - name: Run tests run: tox - env: - PYTEST_ADDOPTS: -vv - name: Coveralls run: coveralls env: From 58a0a1e883dcf2871c4a732dda28f2fd2590eb35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Wed, 28 Sep 2022 20:14:23 +0200 Subject: [PATCH 17/18] Update actions --- .github/workflows/pre-commit-autoupdate.yml | 2 +- .github/workflows/pre-commit.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-commit-autoupdate.yml b/.github/workflows/pre-commit-autoupdate.yml index 5fb410c..4b3bb4b 100644 --- a/.github/workflows/pre-commit-autoupdate.yml +++ b/.github/workflows/pre-commit-autoupdate.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: 3.x - name: Install pre-commit diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index a4be678..c38ee14 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: 3.x - name: Run pre-commit From 72f5a1ddb3be3e627d86dc583c515c03d6a5961a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Wed, 28 Sep 2022 20:19:14 +0200 Subject: [PATCH 18/18] Update pre-commit hooks --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b7ef0c1..6c01a88 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/asottile/pyupgrade - rev: v2.38.0 + rev: v2.38.2 hooks: - id: pyupgrade args: @@ -15,7 +15,7 @@ repos: - id: double-quote-string-fixer name: double-quote-string-fixer - repo: https://github.com/asottile/add-trailing-comma - rev: v2.2.3 + rev: v2.3.0 hooks: - id: add-trailing-comma name: add-trailing-comma @@ -42,7 +42,7 @@ repos: - --filter-files files: \.py$ - repo: https://github.com/mondeja/mdpo - rev: v1.0.1 + rev: v1.0.3 hooks: - id: md2po2md files: ^README\.md