From 52fad9e6fdefea8848fe57986b3280252e35316b Mon Sep 17 00:00:00 2001 From: Eric Bouchut Date: Mon, 28 Oct 2024 13:48:07 +0100 Subject: [PATCH 1/5] =?UTF-8?q?=E2=9E=96=20Remove=20plugin=20mkdocs-transl?= =?UTF-8?q?ate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No longer needed --- dev-requirements.in | 1 - 1 file changed, 1 deletion(-) diff --git a/dev-requirements.in b/dev-requirements.in index 70af3818..e69de29b 100644 --- a/dev-requirements.in +++ b/dev-requirements.in @@ -1 +0,0 @@ -mkdocs-translate From 1d972826fa42acc887143931cdd83535c64ae16b Mon Sep 17 00:00:00 2001 From: Eric Bouchut Date: Tue, 29 Oct 2024 10:40:49 +0100 Subject: [PATCH 2/5] =?UTF-8?q?=E2=9E=95=20Add=20plugin=20mkdocs-unused-fi?= =?UTF-8?q?les?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We can now check for files that are not used in Markdown files CHECK_UNUSED_FILES=true mkdocs build -s See: https://github.com/wilhelmer/mkdocs-unused-files --- README.md | 11 +++++++++++ docs/trio-docs.pdf | Bin mkdocs.yml | 16 ++++++++++++++++ requirements.in | 1 + requirements.txt | 15 ++++++++------- 5 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 docs/trio-docs.pdf diff --git a/README.md b/README.md index fb638a8c..f4977753 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,17 @@ MKDOCS_EXPORTER_PDF=true mkdocs build ``` The PDF file is generated in`site/trio-docs.pdf`. + +### Find Unused Files + +To find unused (orphaned) files in the project: + +```shell +CHECK_UNUSED_FILES=true mkdocs build -s +``` + +> [!INFO] +> We use the [`mkdocs-unused-files`](https://github.com/wilhelmer/mkdocs-unused-files) plugin. ## Contribute diff --git a/docs/trio-docs.pdf b/docs/trio-docs.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/mkdocs.yml b/mkdocs.yml index b86929f9..daf1c1d3 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -86,6 +86,22 @@ plugins: icon: material-file-download-outline enabled: !!python/name:mkdocs_exporter.formats.pdf.buttons.download.enabled attributes: !!python/name:mkdocs_exporter.formats.pdf.buttons.download.attributes + - unused_files: + enabled: !ENV [CHECK_UNUSED_FILES, False] + strict: true + excluded_files: + - back.html.j2 + - background.png + - CNAME + - .DS_Store + - extra.css + - favicon.ico + - front.html.j2 + - .keep + - mathjax.js + - mkdocs-exporter.js + - pdf.scss + - primary_color.css - search extra_css: diff --git a/requirements.in b/requirements.in index b412d4b0..105df929 100644 --- a/requirements.in +++ b/requirements.in @@ -5,3 +5,4 @@ mkdocs-include-markdown-plugin>=6.0.4 mkdocs-exclude>=1.0.2 mkdocs-open-in-new-tab==1.0.6 mkdocs-macros-plugin>=1.0.4 +mkdocs-unused-files>=0.2.0 diff --git a/requirements.txt b/requirements.txt index 36cc9c6d..bf56543c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,33 +6,34 @@ charset-normalizer==3.4.0 click==8.1.7 colorama==0.4.6 ghp-import==2.1.0 -greenlet==3.0.3 +greenlet==3.1.1 hjson==3.1.0 idna==3.10 Jinja2==3.1.4 libsass==0.23.0 lxml==5.3.0 Markdown==3.7 -MarkupSafe==3.0.1 +MarkupSafe==3.0.2 mergedeep==1.3.4 mkdocs==1.6.1 mkdocs-exclude==1.0.2 mkdocs-exporter==6.1.1 mkdocs-get-deps==0.2.0 -mkdocs-include-markdown-plugin==6.2.2 -mkdocs-macros-plugin==1.3.5 -mkdocs-material==9.5.40 +mkdocs-include-markdown-plugin==7.0.0 +mkdocs-macros-plugin==1.3.7 +mkdocs-material==9.5.42 mkdocs-material-extensions==1.3.1 mkdocs-open-in-new-tab==1.0.6 +mkdocs-unused-files==0.2.0 packaging==24.1 paginate==0.5.7 pathspec==0.12.1 platformdirs==4.3.6 -playwright==1.47.0 +playwright==1.48.0 pyee==12.0.0 Pygments==2.18.0 pymdown-extensions==10.11.2 -pypdf==5.0.1 +pypdf==5.1.0 python-dateutil==2.9.0.post0 PyYAML==6.0.2 pyyaml_env_tag==0.1 From 1dbc03d9e4fe233657cb7a6fb100d409d3833aca Mon Sep 17 00:00:00 2001 From: Eric Bouchut Date: Tue, 29 Oct 2024 17:10:18 +0100 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=91=B7=20Add=20a=20CI=20GitHub=20work?= =?UTF-8?q?flow=20to=20check=20for=20unused=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..dfacc248 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,43 @@ +name: CI + +# Controls when the action will run. +on: + # Remark: uncomment one section only + # Remark: Next 1 line requires manual action, Click on action tab, then publish + # workflow_dispatch + # Remark: Next 5 lines triggers the workflow on push events for the main branch + push: + branches: + - dev + paths-ignore: + - "README.md" + +jobs: + ci: + runs-on: ubuntu-latest + if: github.repository_owner == 'nightscout' + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.x + + - name: Create, Activate and share a Python Virtual Env + run: | + python -m venv venv + source venv/bin/activate + # Persist venv related variables across the steps below + # See: https://stackoverflow.com/a/74669486/386517 + echo "PATH=$PATH" >> "$GITHUB_ENV" + echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> "$GITHUB_ENV" + + - name: Install Python Dependencies + run: pip install -r requirements.txt + + - name: Check for unused files + run: CHECK_UNUSED_FILES=true mkdocs build -s From b252c1c16ac4360b70e33f68e1469039249a5580 Mon Sep 17 00:00:00 2001 From: Eric Bouchut Date: Sat, 2 Nov 2024 21:31:53 +0100 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=93=8C=20Pin=20project=20package=20de?= =?UTF-8?q?pendencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 104 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 96 insertions(+), 8 deletions(-) diff --git a/requirements.txt b/requirements.txt index bf56543c..f3f46586 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,49 +1,137 @@ +# +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: +# +# pip-compile +# babel==2.16.0 + # via mkdocs-material beautifulsoup4==4.12.3 + # via + # mkdocs-exporter + # mkdocs-unused-files bracex==2.5.post1 + # via wcmatch certifi==2024.8.30 + # via requests charset-normalizer==3.4.0 + # via requests click==8.1.7 + # via mkdocs colorama==0.4.6 + # via mkdocs-material ghp-import==2.1.0 + # via mkdocs greenlet==3.1.1 + # via playwright hjson==3.1.0 + # via + # mkdocs-macros-plugin + # super-collections idna==3.10 -Jinja2==3.1.4 + # via requests +jinja2==3.1.4 + # via + # mkdocs + # mkdocs-macros-plugin + # mkdocs-material libsass==0.23.0 + # via mkdocs-exporter lxml==5.3.0 -Markdown==3.7 -MarkupSafe==3.0.2 + # via mkdocs-exporter +markdown==3.7 + # via + # mkdocs + # mkdocs-material + # pymdown-extensions +markupsafe==3.0.2 + # via + # jinja2 + # mkdocs mergedeep==1.3.4 + # via + # mkdocs + # mkdocs-get-deps mkdocs==1.6.1 + # via + # -r requirements.in + # mkdocs-exclude + # mkdocs-exporter + # mkdocs-include-markdown-plugin + # mkdocs-macros-plugin + # mkdocs-material + # mkdocs-open-in-new-tab + # mkdocs-unused-files mkdocs-exclude==1.0.2 + # via -r requirements.in mkdocs-exporter==6.1.1 + # via -r requirements.in mkdocs-get-deps==0.2.0 + # via mkdocs mkdocs-include-markdown-plugin==7.0.0 + # via -r requirements.in mkdocs-macros-plugin==1.3.7 + # via -r requirements.in mkdocs-material==9.5.42 + # via -r requirements.in mkdocs-material-extensions==1.3.1 + # via mkdocs-material mkdocs-open-in-new-tab==1.0.6 + # via -r requirements.in mkdocs-unused-files==0.2.0 + # via -r requirements.in packaging==24.1 + # via + # mkdocs + # mkdocs-macros-plugin paginate==0.5.7 + # via mkdocs-material pathspec==0.12.1 + # via + # mkdocs + # mkdocs-macros-plugin platformdirs==4.3.6 + # via mkdocs-get-deps playwright==1.48.0 + # via mkdocs-exporter pyee==12.0.0 -Pygments==2.18.0 + # via playwright +pygments==2.18.0 + # via mkdocs-material pymdown-extensions==10.11.2 + # via mkdocs-material pypdf==5.1.0 + # via mkdocs-exporter python-dateutil==2.9.0.post0 -PyYAML==6.0.2 -pyyaml_env_tag==0.1 + # via + # ghp-import + # mkdocs-macros-plugin +pyyaml==6.0.2 + # via + # mkdocs + # mkdocs-get-deps + # mkdocs-macros-plugin + # pymdown-extensions + # pyyaml-env-tag +pyyaml-env-tag==0.1 + # via mkdocs regex==2024.9.11 + # via mkdocs-material requests==2.32.3 + # via mkdocs-material six==1.16.0 + # via python-dateutil soupsieve==2.6 -super_collections==0.5.3 + # via beautifulsoup4 +super-collections==0.5.3 + # via mkdocs-macros-plugin termcolor==2.5.0 -typing_extensions==4.12.2 + # via mkdocs-macros-plugin +typing-extensions==4.12.2 + # via pyee urllib3==2.2.3 + # via requests watchdog==5.0.3 + # via mkdocs wcmatch==10.0 + # via mkdocs-include-markdown-plugin From a2d02a0803971c8627f3066fcd1382e727a85a6a Mon Sep 17 00:00:00 2001 From: Eric Bouchut Date: Wed, 13 Nov 2024 11:28:44 +0100 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=94=A7=20Mkdocs-unused-file=20now=20i?= =?UTF-8?q?gnores=20trio-docs.pdf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mkdocs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/mkdocs.yml b/mkdocs.yml index daf1c1d3..ca46a5fb 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -102,6 +102,7 @@ plugins: - mkdocs-exporter.js - pdf.scss - primary_color.css + - trio-docs.pdf - search extra_css: