From e64dcf497896c10ae1549e7ed33d96cdcbc9bf7d Mon Sep 17 00:00:00 2001 From: cclecle Date: Sat, 25 Mar 2023 19:59:20 +0000 Subject: [PATCH] improve project configuration from pychangelogfactory --- .pydevproject | 1 - RUN_changelog.launch | 16 ++++ RUN_complexity.launch | 16 ++++ RUN_mkdocs.launch | 19 +++++ RUN_quality.launch | 16 ++++ RUN_unittest.launch | 16 ++++ helpers/doc_gen.py | 14 +--- mkdocs.yml | 176 +++++++++++++++++++++++------------------- pyproject.toml | 2 +- 9 files changed, 185 insertions(+), 91 deletions(-) create mode 100644 RUN_changelog.launch create mode 100644 RUN_complexity.launch create mode 100644 RUN_mkdocs.launch create mode 100644 RUN_quality.launch create mode 100644 RUN_unittest.launch diff --git a/.pydevproject b/.pydevproject index 831a2ca..8b58396 100644 --- a/.pydevproject +++ b/.pydevproject @@ -6,7 +6,6 @@ python interpreter - /${PROJECT_DIR_NAME}/src /${PROJECT_DIR_NAME} diff --git a/RUN_changelog.launch b/RUN_changelog.launch new file mode 100644 index 0000000..02431f2 --- /dev/null +++ b/RUN_changelog.launch @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/RUN_complexity.launch b/RUN_complexity.launch new file mode 100644 index 0000000..f29538b --- /dev/null +++ b/RUN_complexity.launch @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/RUN_mkdocs.launch b/RUN_mkdocs.launch new file mode 100644 index 0000000..bb142ed --- /dev/null +++ b/RUN_mkdocs.launch @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/RUN_quality.launch b/RUN_quality.launch new file mode 100644 index 0000000..43ae6da --- /dev/null +++ b/RUN_quality.launch @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/RUN_unittest.launch b/RUN_unittest.launch new file mode 100644 index 0000000..78228a9 --- /dev/null +++ b/RUN_unittest.launch @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/helpers/doc_gen.py b/helpers/doc_gen.py index 155db4d..232278e 100644 --- a/helpers/doc_gen.py +++ b/helpers/doc_gen.py @@ -72,9 +72,11 @@ class doc_gen(helper_withresults_base): # little hack here, to enable / disable pdf generation using own class config # => reason is mkdocs seems to try loading the plugin even if we disable it, so we need to # manually process the configuration file. - mkdocsCfg = None with open(cls.project_rootdir_path / "mkdocs.yml", "r") as mkdocsCfgFile: - mkdocsCfg = yaml.load(mkdocsCfgFile, Loader=yaml.SafeLoader) + mkdocsCfg = yaml.load(mkdocsCfgFile, Loader=yaml.Loader) + + if "plugins" in mkdocsCfg: + mkdocsCfg["plugins"] = [_ for _ in mkdocsCfg["plugins"] if (not isinstance(_, dict) or "with-pdf" not in _.keys())] if cls.enable_gen_pdf == True: mkdocsCfg["plugins"].append( @@ -83,19 +85,11 @@ class doc_gen(helper_withresults_base): "cover_subtitle": "User Manual", "cover_logo": str(cls.project_rootdir_path / "docs-static" / "Library.jpg"), "verbose": False, - "media_type": "print", "exclude_pages": ["LICENSE"], "output_path": str(site_path / "pdf" / "manual.pdf"), } } ) - else: - for subelem in mkdocsCfg["plugins"]: - if isinstance(subelem, dict): - if "with-pdf" in subelem.keys(): - mkdocsCfg["plugins"].remove(subelem) - break - with open(cls.project_rootdir_path / "mkdocs.yml", "w") as mkdocsCfgFile: mkdocsCfgFile.write(yaml.dump(mkdocsCfg, Dumper=Dumper, default_flow_style=False, sort_keys=False)) diff --git a/mkdocs.yml b/mkdocs.yml index 71d6d83..438ff03 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,92 +1,110 @@ -# pyChaChaDummyProject (c) by chacha -# -# pyChaChaDummyProject is licensed under a -# Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Unported License. -# -# You should have received a copy of the license along with this -# work. If not, see . - docs_dir: docs site_name: pygitversionhelper site_url: 'https://chacha.ddns.net/mkdocs-web/chacha/pygitversionhelper/latest/' -site_description: pygitversionhelper -site_author: ChaCha +site_description: 'A simple simple git version helper in python.' +site_author: prune repo_url: 'https://chacha.ddns.net/gitea/chacha/pygitversionhelper' use_directory_urls: false -copyright: CC BY-NC-SA 4.0 +copyright: 'CC BY-NC-SA 4.0' theme: name: material features: - - navigation.instant - - navigation.tracking - - navigation.tabs - - navigation.tabs.sticky - - toc.integrate - - navigation.top + - navigation.instant + - navigation.tracking + - navigation.tabs + - navigation.tabs.sticky + - navigation.footer + - toc.integrate + - navigation.top + - navigation.section + - content.code.annotate + - navigation.prune + - toc.follow palette: - - media: '(prefers-color-scheme: dark)' - scheme: slate - toggle: - icon: material/brightness-4 - name: Switch to system preference - - media: (prefers-color-scheme) - toggle: - icon: material/brightness-auto - name: Switch to light mode - - media: '(prefers-color-scheme: light)' - scheme: default - toggle: - icon: material/brightness-7 - name: Switch to dark mode + - media: '(prefers-color-scheme: dark)' + scheme: slate + toggle: + icon: material/brightness-4 + name: Switch to system preference + - media: (prefers-color-scheme) + toggle: + icon: material/brightness-auto + name: Switch to light mode + - media: '(prefers-color-scheme: light)' + scheme: default + toggle: + icon: material/brightness-7 + name: Switch to dark mode plugins: - - search - - markdownextradata - - mermaid2 - - localsearch - - autorefs - - mkdocstrings: - default_handler: python - handlers: - python: - selection: - filters: - - '!^_(?!_init__)' - inherited_members: true - rendering: - show_root_heading: false - show_root_toc_entry: false - show_root_full_path: false - show_if_no_docstring: true - show_signature_annotations: true - show_source: false - heading_level: 2 - group_by_category: true - show_category_heading: true +- search +- markdownextradata +- mermaid2 +- localsearch +- mkdocstrings: + default_handler: python + handlers: + python: + options: + filters: + - '!^_[^_]' + inherited_members: true + show_if_no_docstring: true + show_signature_annotations: true + show_source: false + show_category_heading: true + group_by_category: true + docstring_section_style: spacy + show_root_full_path: false + merge_init_into_class: true + separate_signature: true markdown_extensions: - - def_list - - tables - - attr_list - - abbr - - pymdownx.betterem: - smart_enable: all - - pymdownx.caret - - pymdownx.critic - - pymdownx.details - - pymdownx.inlinehilite - - pymdownx.snippets - - pymdownx.highlight: - anchor_linenums: true - line_spans: __span - pygments_lang_class: true - - pymdownx.keys - - pymdownx.mark - - pymdownx.progressbar - - pymdownx.smartsymbols - - pymdownx.tasklist: - custom_checkbox: true - - pymdownx.tilde - - footnotes - +- def_list +- tables +- attr_list +- abbr +- pymdownx.blocks.admonition: + types: + - new + - settings + - note + - abstract + - info + - tip + - success + - question + - warning + - failure + - danger + - bug + - example + - quote +- pymdownx.blocks.definition +- pymdownx.blocks.details +- pymdownx.blocks.tab +- pymdownx.blocks.html +- pymdownx.betterem: + smart_enable: all +- pymdownx.caret +- pymdownx.critic +- pymdownx.details +- pymdownx.inlinehilite +- pymdownx.snippets +- pymdownx.highlight: + anchor_linenums: true + line_spans: __span + pygments_lang_class: true +- pymdownx.keys +- pymdownx.mark +- pymdownx.progressbar +- pymdownx.smartsymbols +- pymdownx.tasklist: + custom_checkbox: true +- pymdownx.tilde +- footnotes +- pymdownx.superfences +- pymdownx.emoji: + emoji_index: !!python/name:materialx.emoji.twemoji + emoji_generator: !!python/name:materialx.emoji.to_svg extra: branch: master - repository: pygitversionhelper \ No newline at end of file + repository: pygitversionhelper diff --git a/pyproject.toml b/pyproject.toml index 1ba1261..9373d78 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,7 +59,7 @@ coverage-check = ["coverage>=7.0"] complexity-check = ["radon>=5.1"] quality-check = ["pylint>=2.15","pylint-json2html>=0.4","pandas>=1.5"] type-check = ["mypy[reports]>=0.99" ] -doc-gen = ["mkdocs>=1.4.0", "mkdocs-material>=8.5", "mkdocs-localsearch>=0.9.0", "mkdocstrings[python]>=0.19", "mkdocs-with-pdf>=0.9.3","pyyaml>=6.0","pymdown-extensions>=9","mkdocs-markdownextradata-plugin","mkdocs-mermaid2-plugin"] +doc-gen = ["mkdocs>=1.4.0", "mkdocs-material>=8.5","mkdocs-pymdownx-material-extras", "mkdocs-localsearch>=0.9.0", "mkdocstrings[python]>=0.19", "mkdocs-with-pdf>=0.9.3","pyyaml>=6.0","pymdown-extensions>=9","mkdocs-markdownextradata-plugin","mkdocs-mermaid2-plugin"] #[project.scripts] #my-script = "my_package.module:function"