diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a511ad88..29a6afa6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,7 +52,7 @@ jobs: - name: Notebook check run: | pip install notebook>=5.2.2 - python Otherfiles/notebook_check.py + python Otherfiles/notebook_run.py if: matrix.python-version == env.TEST_PYTHON_VERSION && matrix.os == env.TEST_OS - name: Other tests run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f948a5f..a8f3dace 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `__trapezoidal_numeric_integral__` function updated - Diagrams updated - Document modified +- Document build system updated - `AUTHORS.md` updated - `README.md` modified - Test system modified diff --git a/Otherfiles/RELEASE.md b/Otherfiles/RELEASE.md index 058c3b4d..1589ab29 100644 --- a/Otherfiles/RELEASE.md +++ b/Otherfiles/RELEASE.md @@ -1,7 +1,7 @@ # PyCM Release Instructions -**Last Update: 2024-07-02** +**Last Update: 2024-07-19** 1. Create the `release` branch under `dev` 2. Update all version tags @@ -18,7 +18,7 @@ 4. Update `.github/ISSUE_TEMPLATE/bug_report.yml` 1. Add new version tag to `PyCM version` dropbox options 5. Update Document - 1. Run `Otherfiles/doc_run.bat` + 1. Run `Otherfiles/notebook_run.py` 6. Create a PR from `release` to `dev` 1. Title: `Version x.x` (Example: `Version 0.1`) 2. Tag all related issues diff --git a/Otherfiles/doc_run.bat b/Otherfiles/doc_run.bat deleted file mode 100644 index 224b9ea6..00000000 --- a/Otherfiles/doc_run.bat +++ /dev/null @@ -1,17 +0,0 @@ -@echo off -call python -m art text "Doc Run Script" -call python setup.py install -for %%f in (Document\*.ipynb) do ( -echo %%f is running! -call python -m nbconvert %%f --execute --clear-output --log-level=ERROR -if ERRORLEVEL 1 (echo %%f Failed! & exit /b 0) else (echo %%f Done!) -echo -------------------------- -) - -copy Document\Document_files\cm1.csv Otherfiles\test.csv -copy Document\Document_files\cm1.html Otherfiles\test.html -copy Document\Document_files\cm1.obj Otherfiles\test.obj -copy Document\Document_files\cm1.pycm Otherfiles\test.pycm -copy Document\Document_files\cp.comp Otherfiles\test.comp - -call python Otherfiles\version_check.py diff --git a/Otherfiles/notebook_check.py b/Otherfiles/notebook_check.py deleted file mode 100644 index a8f8ae75..00000000 --- a/Otherfiles/notebook_check.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -"""Notebook-check script.""" -import os -import nbformat -from nbconvert.preprocessors import ExecutePreprocessor -from art import tprint - -NOTEBOOKS_LIST = [ - "Document", - "Distance", - "Example1", - "Example2", - "Example3", - "Example4", - "Example5", - "Example6", - "Example7", - "Example8"] - -EXTENSION = ".ipynb" - -if __name__ == "__main__": - tprint("PYCM", "bulbhead") - tprint("Document", "bulbhead") - print("Processing ...") - for index, notebook in enumerate(NOTEBOOKS_LIST): - ep = ExecutePreprocessor(timeout=6000, kernel_name='python3') - path = os.path.join("Document", notebook) - with open(path + EXTENSION, "r", encoding="utf-8") as f: - nb = nbformat.read(f, as_version=4) - ep.preprocess(nb, {'metadata': {'path': 'Document/'}}) - with open(path + EXTENSION, 'w', encoding='utf-8') as f: - nbformat.write(nb, f) - print("{0}.{1} [OK]".format(str(index + 1), notebook)) diff --git a/Otherfiles/notebook_run.py b/Otherfiles/notebook_run.py new file mode 100644 index 00000000..4244dfdd --- /dev/null +++ b/Otherfiles/notebook_run.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +"""Notebook-run script.""" +import os +import shutil +import pycm +import nbformat +from nbconvert.preprocessors import ExecutePreprocessor +from art import tprint + +NOTEBOOKS_LIST = [ + "Document", + "Distance", + "Example1", + "Example2", + "Example3", + "Example4", + "Example5", + "Example6", + "Example7", + "Example8"] + +COPY_DICT = {os.path.join("Document", "Document_files", "cm1.csv"): os.path.join("Otherfiles", "test.csv"), + os.path.join("Document", "Document_files", "cm1.html"): os.path.join("Otherfiles", "test.html"), + os.path.join("Document", "Document_files", "cm1.obj"): os.path.join("Otherfiles", "test.obj"), + os.path.join("Document", "Document_files", "cm1.pycm"): os.path.join("Otherfiles", "test.pycm"), + os.path.join("Document", "Document_files", "cp.comp"): os.path.join("Otherfiles", "test.comp"), + } + +EXTENSION = ".ipynb" + +if __name__ == "__main__": + tprint("PYCM", "bulbhead") + tprint("v{0}".format(pycm.__version__), "bulbhead") + tprint("Notebook Run", "amc3line") + print("Processing ...") + for index, notebook in enumerate(NOTEBOOKS_LIST): + ep = ExecutePreprocessor(timeout=6000, kernel_name='python3') + path = os.path.join("Document", notebook) + with open(path + EXTENSION, "r", encoding="utf-8") as f: + nb = nbformat.read(f, as_version=4) + ep.preprocess(nb, {'metadata': {'path': 'Document/'}}) + with open(path + EXTENSION, 'w', encoding='utf-8') as f: + nbformat.write(nb, f) + print("\t{0}.{1} [OK]".format(str(index + 1), notebook)) + print("\nCopying ...") + for index, item in enumerate(sorted(COPY_DICT)): + shutil.copy(item, COPY_DICT[item]) + print("\t{0}.{1} --> {2} [OK]".format(index + 1, item, COPY_DICT[item]))