From 05ede6609ea82ea6055e96461200fd6d0c1ab7e9 Mon Sep 17 00:00:00 2001 From: Wolfgang Fahl Date: Wed, 31 Jul 2024 11:21:14 +0200 Subject: [PATCH] release commit --- .github/workflows/build.yml | 7 +- .github/workflows/upload-to-pypi.yml | 2 +- README.md | 12 +- pyproject.toml | 12 +- scripts/doc | 157 ++++++++++++++------------- scripts/release | 8 ++ scripts/test | 8 +- 7 files changed, 105 insertions(+), 101 deletions(-) create mode 100755 scripts/release diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9fb4430..565326a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.10','3.11', "3.12"] + python-version: [ '3.10', '3.11', '3.12' ] steps: - uses: actions/checkout@v4 @@ -35,9 +35,6 @@ jobs: - name: install run: | scripts/install -# pip install sphinx -# pip install sphinx_rtd_theme -# scripts/doc - name: Cache Sqlite id: cache-sqlite @@ -59,7 +56,7 @@ jobs: - name: Run tests # Run tox using the version of Python in `PATH` - run: tox -e py + run: scripts/test - name: Run Ruff run: ruff check --output-format=github . diff --git a/.github/workflows/upload-to-pypi.yml b/.github/workflows/upload-to-pypi.yml index fd27cfa..3589887 100644 --- a/.github/workflows/upload-to-pypi.yml +++ b/.github/workflows/upload-to-pypi.yml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.x' - name: Install dependencies diff --git a/README.md b/README.md index 2b066ff..a42ceee 100644 --- a/README.md +++ b/README.md @@ -2,19 +2,17 @@ CEUR make python implementation for https://ceur-ws.org/ -[![Join the discussion at https://github.com/WolfgangFahl/pyCEURMake/discussions](https://img.shields.io/github/discussions/WolfgangFahl/pyCEURMake)](https://github.com/WolfgangFahl/pyCEURMake/discussions) -[![pypi](https://img.shields.io/pypi/pyversions/pyCEURMake)](https://pypi.org/project/pyCEURMake/) +[![Join the discussion at https://github.com/WolfgangFahl/pyCEURMake/discussions](https://img.shields.io/github/discussions/WolfgangFahl/pyCEURMake)](https://github.com/WolfgangFahl/pyCEURMake/discussions) +[![pypi](https://img.shields.io/pypi/pyversions/pyCEURmake)](https://pypi.org/project/pyCEURmake/) [![Github Actions Build](https://github.com/WolfgangFahl/pyCEURmake/actions/workflows/build.yml/badge.svg)](https://github.com/WolfgangFahl/pyCEURmake/actions/workflows/build.yml) -[![PyPI Status](https://img.shields.io/pypi/v/pyCEURMake.svg)](https://pypi.python.org/pypi/pyCEURMake/) +[![PyPI Status](https://img.shields.io/pypi/v/pyCEURmake.svg)](https://pypi.python.org/pypi/pyCEURmake/) [![GitHub issues](https://img.shields.io/github/issues/WolfgangFahl/pyCEURmake.svg)](https://github.com/WolfgangFahl/pyCEURmake/issues) [![GitHub closed issues](https://img.shields.io/github/issues-closed/WolfgangFahl/pyCEURmake.svg)](https://github.com/WolfgangFahl/pyCEURmake/issues/?q=is%3Aissue+is%3Aclosed) -[![License](https://img.shields.io/github/license/WolfgangFahl/pyCEURMake.svg)](https://www.apache.org/licenses/LICENSE-2.0) +[![API Docs](https://img.shields.io/badge/API-Documentation-blue)](https://WolfgangFahl.github.io/pyCEURmake/) +:[![License](https://img.shields.io/github/license/WolfgangFahl/pyCEURmake.svg)](https://www.apache.org/licenses/LICENSE-2.0) ## Docs and Tutorials [Wiki](https://wiki.bitplan.com/index.php/PyCEURmake) ## Demos [CEUR-Volume Browser at RWTH Aachen i5](http://cvb.wikidata.dbis.rwth-aachen.de/) - - - diff --git a/pyproject.toml b/pyproject.toml index fe94d67..10162a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ name = "pyCEURmake" authors = [ {name = "Tim Holzheim", email = "tim.holzheim@rwth-aachen.de"}, {name = "Wolfgang Fahl", email = "wf@bitplan.com"} - + ] maintainers = [ { name = "Wolfgang Fahl", email = "wf@bitplan.com" }, @@ -45,7 +45,7 @@ dependencies = [ # https://pypi.org/project/neo4j/ 'neo4j', # https://github.com/WolfgangFahl/nicegui_widgets - 'ngwidgets>=0.15.2', + 'ngwidgets>=0.16.4', # https://pypi.org/project/sqlmodel/ 'sqlmodel>=0.0.16', # https://pypi.org/project/wdgrid/ @@ -89,9 +89,11 @@ test = [ ] [tool.hatch.build.targets.wheel] -packages = [ - "ceurws", -] +only-include = ["ceurws"] + +[tool.hatch.build.targets.wheel.sources] +"ngwidgets" = "ceurws" + [project.scripts] ceur-ws = "ceurws.ceur_ws_web_cmd:main" diff --git a/scripts/doc b/scripts/doc index 0c339ff..dfbc1c6 100755 --- a/scripts/doc +++ b/scripts/doc @@ -1,83 +1,88 @@ #!/bin/bash -# WF 2020-01-31 +# create docs for a configurable project +# WF 2024-07-30 - updated -# -# check whether the given command is installed -# -checkinstalled() { - local l_cmd="$1" - which $l_cmd > /dev/null - if [ $? -ne 0 ] - then - echo "$l_cmd need to be installed" 1>&2 - exit 1 - fi -} +# Extract project name from pyproject.toml +PROJECT_NAME=$(grep "\[project\]" pyproject.toml -A1 | grep name | cut -d '=' -f2 | tr -d ' "') +PACKAGE_NAME=$(grep "\[tool.hatch.build.targets.wheel.sources\]" pyproject.toml -A1 | tail -1 | cut -d '=' -f2 | tr -d ' "') -fixconf() { - local l_year="$1" - local l_author="$2" - conf=conf.py - # fix sys path - # https://stackoverflow.com/questions/10324393/sphinx-build-fail-autodoc-cant-import-find-module - grep "# sys.path" $conf - if [ $? -eq 0 ] - then - tmpconf=/tmp/conf$$.py - cat $conf | awk -v author="$l_author" -v year="$l_year" ' - BEGIN { - quote="\x27" - squote="\047" - } - /# import os/ { next } - /# import sys/ { next } - /copyright/ { - printf "copyright = %s%s, %s%s\n",squote,year,author,squote - next - } - /author/ { - printf "author = %s%s%s\n",squote,author,squote - next - } - /html_theme = / { - # html_theme = 'alabaster' - printf "html_theme = %ssphinx_rtd_theme%s\n",squote,squote - printf "master_doc = %sindex%s\n",squote,squote - next - } - # add sphinx_rtd extension - /extensions = / { - print $0 - printf "\t%ssphinx_rtd_theme%s,\n",squote,squote - printf "\t%ssphinx.ext.napoleon%s,\n",squote,squote - next - } - /# sys.path/ { - print("#https://stackoverflow.com/a/44980548/1497139") - print("import os") - print("import sys") - print("import sphinx_rtd_theme") - printf("basepath=os.path.abspath(%s../..%s)\n",squote,squote) - printf("print(%sadding basepath %%s%s %% (basepath))\n",squote,squote) - print("sys.path.insert(0, basepath)") - printf("print(%ssys.path is now: %%s%s %% (sys.path))\n",squote,squote) - next - } - { print}' > $tmpconf - #diff $tmpconf $conf - mv $tmpconf $conf - echo "$src/conf.py has been fixed" - fi + +# Function to print usage information +print_usage() { + echo "Usage: $0 [OPTIONS]" + echo "Options:" + echo " -pr, --project NAME Set the project name (default: $PROJECT_NAME)" + echo " -pa, --package NAME Set the package name (default: $PACKAGE_NAME)" + echo " -d, --deploy Deploy the documentation after building" + echo " -h, --help Display this help message" } -src=docs/source -checkinstalled sphinx-apidoc -sphinx-apidoc --full -f -o $src . -cd $src +# Parse command line arguments +DEPLOY=false +while [[ "$#" -gt 0 ]]; do + case $1 in + -pr|--project) PROJECT_NAME="$2"; shift ;; + -pa|--package) PACKAGE_NAME="$2"; shift ;; + -d|--deploy) DEPLOY=true ;; + -h|--help) print_usage; exit 0 ;; + *) echo "Unknown parameter: $1"; print_usage; exit 1 ;; + esac + shift +done + +# Ensure we're in the correct directory +if [[ ! -d "$PACKAGE_NAME" ]]; then + echo "Error: $PACKAGE_NAME package directory not found. Are you in the correct directory?" + exit 1 +fi + +# Check if mkdocs is installed +if ! command -v mkdocs &> /dev/null; then + pip install mkdocs mkdocs-material mkdocstrings[python] +fi + +# Create or update mkdocs.yml +cat << EOF > mkdocs.yml +site_name: $PROJECT_NAME API Documentation +theme: + name: material +plugins: + - search + - mkdocstrings: + handlers: + python: + setup_commands: + - import sys + - import os + - sys.path.insert(0, os.path.abspath(".")) + selection: + docstring_style: google + rendering: + show_source: true +nav: + - API: index.md +EOF + +# Create or update index.md +index_md=docs/index.md +mkdir -p docs +cat << EOF > $index_md +# $PROJECT_NAME API Documentation + +::: $PACKAGE_NAME + options: + show_submodules: true +EOF -fixconf 2020 "Wolfgang Fahl" -make clean html -if [ "$GHACTIONS" != "ACTIVE" ] -then - open _build/html/index.html +# Ignore DeprecationWarnings during build +export PYTHONWARNINGS="ignore::DeprecationWarning" + +# Build the documentation +mkdocs build --config-file ./mkdocs.yml + +# Deploy if requested +if [ "$DEPLOY" = true ]; then + mkdocs gh-deploy --force --config-file ./mkdocs.yml fi + +echo "Documentation process completed for $PROJECT_NAME." diff --git a/scripts/release b/scripts/release new file mode 100755 index 0000000..13b9f3f --- /dev/null +++ b/scripts/release @@ -0,0 +1,8 @@ +#!/bin/bash +# WF 2024-07-31 +# prepare a release +scripts/doc -d + +# Commit with a message that includes the current ISO timestamp +git commit -a -m "release commit" +git push diff --git a/scripts/test b/scripts/test index 0ff9309..f1f631e 100755 --- a/scripts/test +++ b/scripts/test @@ -1,9 +1,3 @@ #!/bin/bash # WF 2020-06-03 -#python3 -m unittest discover -pip list | egrep "^green " -if [ $? -ne 0 ] -then - pip install green -fi -green \ No newline at end of file +tox -e py