From ebcb65de16fae2c12dc9eef2f29d41b96e0b0811 Mon Sep 17 00:00:00 2001 From: patrick devlin Date: Tue, 5 Dec 2023 18:53:48 -0500 Subject: [PATCH 1/4] Fix section case (#127) * disable slugify default lowercase option * removing version update in pyproject.toml --- CHANGELOG.md | 6 ++++++ mkdocs_multirepo_plugin/plugin.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec33aa8..d63d29d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.6.4 + +### Prs in Release + +- [Fix section case](https://github.com/jdoiro3/mkdocs-multirepo-plugin/pull/124) + ## 0.6.3 ### Prs in Release diff --git a/mkdocs_multirepo_plugin/plugin.py b/mkdocs_multirepo_plugin/plugin.py index d3b0696..e5eeee4 100644 --- a/mkdocs_multirepo_plugin/plugin.py +++ b/mkdocs_multirepo_plugin/plugin.py @@ -212,7 +212,7 @@ def handle_repos_import(self, config: Config, repos: List[RepoConfig]) -> Config raise ImportSyntaxError( "import_url should only contain the url with plugin accepted params. You included '!import'." ) - section_slug = slugify(repo.section) + section_slug = slugify(text=repo.section, lowercase=False) path = repo.section_path repo_name = f"{path}/{section_slug}" if path is not None else section_slug # mkdocs config values edit_uri and repo_url aren't set From e913aa9362faa425d72eeb35ff2f1cf174b98c26 Mon Sep 17 00:00:00 2001 From: jdoiro3 Date: Tue, 5 Dec 2023 19:05:59 -0500 Subject: [PATCH 2/4] let users know that version isn't releases yet --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d63d29d..3401870 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.6.4 +## 0.7 (Not Releases) ### Prs in Release From 5f5da14ed496cd78bf0c6b31f5da705fb4a45479 Mon Sep 17 00:00:00 2001 From: jdoiro3 Date: Tue, 5 Dec 2023 19:10:35 -0500 Subject: [PATCH 3/4] fixed executables and update changelog so users know version isn't released --- .github/workflows/deploy.yml | 2 +- README.md | 2 +- mkdocs_multirepo_plugin/plugin.py | 4 +++- mkdocs_multirepo_plugin/scripts/mv_docs_up.sh | 0 .../scripts/sparse_clone_old.sh | 0 tests/unittests.py | 24 +++++++++++-------- 6 files changed, 19 insertions(+), 13 deletions(-) mode change 100644 => 100755 mkdocs_multirepo_plugin/scripts/mv_docs_up.sh mode change 100644 => 100755 mkdocs_multirepo_plugin/scripts/sparse_clone_old.sh diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7ab118f..82819b9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -37,7 +37,7 @@ jobs: echo "run-integration-tests = ${{ github.event.inputs.run-integration-tests }}" echo "generate-gh-release = ${{ github.event.inputs.generate-gh-release }}" echo "release-to-pypi-override = ${{ github.event.inputs.elease-to-pypi-override }}" - + unit-tests: name: Unit Tests runs-on: ubuntu-latest diff --git a/README.md b/README.md index aedeec7..d9fea55 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ The plugin introduces the *!import* statement in your config's *nav* section. Yo - **config={filename}.yml**: Tells *multirepo* the name of the config file, containing configuration for the plugin. The default value is also `mkdocs.yml`. This config file can live within the docs directory *or* in the parent directory. - **extra_imports=["{filename | path | glob}"]**: Use this if you want to import additional directories or files along with the docs. - **keep_docs_dir={True | False}**: If set the docs directory will not be removed when importing docs (i.e., `section/page.md` becomes `section/docs/page.md`) - + ```yaml diff --git a/mkdocs_multirepo_plugin/plugin.py b/mkdocs_multirepo_plugin/plugin.py index e5eeee4..bda458f 100644 --- a/mkdocs_multirepo_plugin/plugin.py +++ b/mkdocs_multirepo_plugin/plugin.py @@ -324,7 +324,9 @@ def on_files(self, files: Files, config: Config) -> Files: repo_config_path = repo.config_path for f in repo_files: if f.src_path == repo_config_path: - log.info(f"Multirepo plugin is not copying config file: {f.src_path}") + log.info( + f"Multirepo plugin is not copying config file: {f.src_path}" + ) else: # the file needs to know about the repo it belongs to f.repo = repo diff --git a/mkdocs_multirepo_plugin/scripts/mv_docs_up.sh b/mkdocs_multirepo_plugin/scripts/mv_docs_up.sh old mode 100644 new mode 100755 diff --git a/mkdocs_multirepo_plugin/scripts/sparse_clone_old.sh b/mkdocs_multirepo_plugin/scripts/sparse_clone_old.sh old mode 100644 new mode 100755 diff --git a/tests/unittests.py b/tests/unittests.py index c6ea875..b919abc 100644 --- a/tests/unittests.py +++ b/tests/unittests.py @@ -6,9 +6,9 @@ import unittest from pathlib import Path from shutil import copy -from parameterized import parameterized from aiofiles import tempfile +from parameterized import parameterized from mkdocs_multirepo_plugin import structure, util @@ -389,15 +389,19 @@ async def test_extra_imports(self): for file in expected_files + expected_src_files: self.assertFileExists(file) - @parameterized.expand([ - (True, False, True), # keep_docs_dir is set, global setting ignored - (True, True, True), - (False, False, False), - (False, True, False), - (None, False, False), # keep_docs_dir is not set, global setting overrides - (None, True, True), - ]) - async def test_keep_docs_dir(self, keep_docs_dir, global_keep_docs_dir, expected_docs_exist): + @parameterized.expand( + [ + (True, False, True), # keep_docs_dir is set, global setting ignored + (True, True, True), + (False, False, False), + (False, True, False), + (None, False, False), # keep_docs_dir is not set, global setting overrides + (None, True, True), + ] + ) + async def test_keep_docs_dir( + self, keep_docs_dir, global_keep_docs_dir, expected_docs_exist + ): async with tempfile.TemporaryDirectory() as temp_dir: temp_dir_path = pathlib.Path(temp_dir) docsRepo = structure.DocsRepo( From 3ce10854592f70537fced28bc86b74b41628f4c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20F=C3=B6rderer?= <40258682+Spacetown@users.noreply.github.com> Date: Fri, 19 Jan 2024 14:39:51 +0100 Subject: [PATCH 4/4] Remove deprecation warning (#131) * Remove usage of _filter_files According to the logs this function is deprecated and also filtering of files can have an impact to some projects. By default it's not possible to add dot directories, dot files or the folder templates to the documentation. INFO - DeprecationWarning: warning_filter doesn't do anything since MkDocs 1.2 and will be removed soon. All messages on the `mkdocs` logger get counted automatically. File "xxx/.venv/lib/python3.9/site-packages/mkdocs_multirepo_plugin/util.py", line 10, in from mkdocs.utils import warning_filter File "xxx/.venv/lib/python3.9/site-packages/mkdocs/utils/__init__.py", line 453, in __getattr__ warnings.warn( * Remove usage of warning_filter According to the logs this function is deprecated (a NOP). * Update CHANGELOG.md * Update pyproject.toml * Update CHANGELOG.md Co-authored-by: Joseph Doiron <57968347+jdoiro3@users.noreply.github.com> * Update CHANGELOG.md Co-authored-by: Joseph Doiron <57968347+jdoiro3@users.noreply.github.com> * Update pyproject.toml Co-authored-by: Joseph Doiron <57968347+jdoiro3@users.noreply.github.com> * CHANGELOG.md aktualisieren Co-authored-by: Joseph Doiron <57968347+jdoiro3@users.noreply.github.com> * Update CHANGELOG.md as requested --------- Co-authored-by: Michael Foerderer (F29233) Co-authored-by: Joseph Doiron <57968347+jdoiro3@users.noreply.github.com> --- CHANGELOG.md | 4 ++-- mkdocs_multirepo_plugin/structure.py | 11 +---------- mkdocs_multirepo_plugin/util.py | 4 +--- pyproject.toml | 2 +- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3401870..a6d64a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ -## 0.7 (Not Releases) +## 0.7.0 ### Prs in Release - - [Fix section case](https://github.com/jdoiro3/mkdocs-multirepo-plugin/pull/124) +- [Remove deprecation warning](https://github.com/jdoiro3/mkdocs-multirepo-plugin/pull/131) ## 0.6.3 diff --git a/mkdocs_multirepo_plugin/structure.py b/mkdocs_multirepo_plugin/structure.py index 8a81603..11dce15 100644 --- a/mkdocs_multirepo_plugin/structure.py +++ b/mkdocs_multirepo_plugin/structure.py @@ -7,7 +7,7 @@ from typing import Callable, Dict, List, Optional, Tuple, Union from mkdocs.config import Config -from mkdocs.structure.files import File, Files, _filter_paths, _sort_files +from mkdocs.structure.files import File, Files, _sort_files from mkdocs.utils import yaml_load from slugify import slugify @@ -433,25 +433,16 @@ async def batch_import( def get_files(config: Config, repo: DocsRepo) -> Files: """Walk the `docs_dir` and return a Files collection.""" files = [] - exclude = [".*", "/templates"] for source_dir, dirnames, filenames in os.walk(repo.location, followlinks=True): relative_dir = os.path.relpath(source_dir, repo.temp_dir) for dirname in list(dirnames): path = os.path.normpath(os.path.join(relative_dir, dirname)) - # Skip any excluded directories - if _filter_paths(basename=dirname, path=path, is_dir=True, exclude=exclude): - dirnames.remove(dirname) dirnames.sort() for filename in _sort_files(filenames): path = os.path.normpath(os.path.join(relative_dir, filename)) - # Skip any excluded files - if _filter_paths( - basename=filename, path=path, is_dir=False, exclude=exclude - ): - continue # Skip README.md if an index file also exists in dir if filename == "README.md" and "index.md" in filenames: log.warning( diff --git a/mkdocs_multirepo_plugin/util.py b/mkdocs_multirepo_plugin/util.py index 24be6e9..6d5e1db 100644 --- a/mkdocs_multirepo_plugin/util.py +++ b/mkdocs_multirepo_plugin/util.py @@ -7,14 +7,12 @@ from sys import platform, version_info from typing import Any, Dict -from mkdocs.utils import warning_filter - # used for getting Git version GitVersion = namedtuple("GitVersion", "major minor") LINUX_LIKE_PLATFORMS = ["linux", "linux2", "darwin"] +# This is a global variable imported by other modules log = logging.getLogger("mkdocs.plugins." + __name__) -log.addFilter(warning_filter) class ImportDocsException(Exception): diff --git a/pyproject.toml b/pyproject.toml index 0af96d2..bbcd94a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "mkdocs-multirepo-plugin" -version = "0.6.3" +version = "0.7.0" description = "Build documentation in multiple repos into one site." authors = ["jdoiro3 "] license = "MIT"