From 6d6c4b9dbfd28af26fb35d88f477850c35f7e97e Mon Sep 17 00:00:00 2001 From: Wolfgang Fahl Date: Fri, 2 Aug 2024 17:07:16 +0200 Subject: [PATCH] release commit --- .github/workflows/build.yml | 2 +- .github/workflows/upload-to-pypi.yml | 10 ++-- README.md | 11 ++-- docs/index.md | 5 ++ mkdocs.yml | 18 ++++++ profiwiki/version.py | 2 +- pyproject.toml | 9 +-- scripts/doc | 88 ++++++++++++++++++++++++++++ scripts/release | 8 +++ 9 files changed, 137 insertions(+), 16 deletions(-) create mode 100644 docs/index.md create mode 100644 mkdocs.yml create mode 100755 scripts/doc create mode 100755 scripts/release diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 544f8c8..fbfc4a0 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.9, '3.10', '3.11','3.12'] + python-version: [ '3.9', '3.10', '3.11', '3.12' ] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/upload-to-pypi.yml b/.github/workflows/upload-to-pypi.yml index 38a9d60..3589887 100644 --- a/.github/workflows/upload-to-pypi.yml +++ b/.github/workflows/upload-to-pypi.yml @@ -7,10 +7,13 @@ on: jobs: deploy: runs-on: ubuntu-latest + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write steps: - - uses: actions/checkout@v3 + - 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 @@ -22,6 +25,3 @@ jobs: hatch build - name: Publish distribution to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: ${{ secrets.PYPI_USERNAME }} - password: ${{ secrets.PYPI_PASSWORD }} diff --git a/README.md b/README.md index cebb649..b56ef5b 100644 --- a/README.md +++ b/README.md @@ -3,17 +3,18 @@ BITPlan's Professional SemanticMediaWiki [![Join the discussion at https://github.com/BITPlan/ProfiWiki/discussions](https://img.shields.io/github/discussions/BITPlan/ProfiWiki)](https://github.com/BITPlan/ProfiWiki/discussions) [![pypi](https://img.shields.io/pypi/pyversions/ProfiWiki)](https://pypi.org/project/ProfiWiki/) -[![Github Actions Build](https://github.com/BITPlan/ProfiWiki/workflows/Build/badge.svg?branch=main)](https://github.com/BITPlan/ProfiWiki/actions?query=workflow%3ABuild+branch%3Amain) +[![Github Actions Build](https://github.com/BITPlan/ProfiWiki/actions/workflows/build.yml/badge.svg)](https://github.com/BITPlan/ProfiWiki/actions/workflows/build.yml) [![PyPI Status](https://img.shields.io/pypi/v/ProfiWiki.svg)](https://pypi.python.org/pypi/ProfiWiki/) [![GitHub issues](https://img.shields.io/github/issues/BITPlan/ProfiWiki.svg)](https://github.com/BITPlan/ProfiWiki/issues) -[![GitHub issues](https://img.shields.io/github/issues-closed/BITPlan/ProfiWiki.svg)](https://github.com/BITPlan/ProfiWiki/issues/?q=is%3Aissue+is%3Aclosed) -[![GitHub](https://img.shields.io/github/license/BITPlan/ProfiWiki.svg)](https://www.apache.org/licenses/LICENSE-2.0) +[![GitHub closed issues](https://img.shields.io/github/issues-closed/BITPlan/ProfiWiki.svg)](https://github.com/BITPlan/ProfiWiki/issues/?q=is%3Aissue+is%3Aclosed) +[![API Docs](https://img.shields.io/badge/API-Documentation-blue)](https://BITPlan.github.io/ProfiWiki/) +[![License](https://img.shields.io/github/license/BITPlan/ProfiWiki.svg)](https://www.apache.org/licenses/LICENSE-2.0) [![BITPlan](http://wiki.bitplan.com/images/wiki/thumb/3/38/BITPlanLogoFontLessTransparent.png/198px-BITPlanLogoFontLessTransparent.png)](http://www.bitplan.com) [![Mediawiki](https://upload.wikimedia.org/wikipedia/commons/thumb/a/a3/MediaWiki_logo_1.png/128px-MediaWiki_logo_1.png)](https://www.mediawiki.org/wiki/MediaWiki) [![SemanticMediaWiki](http://semantic-mediawiki.org/w/images/7/7c/SMW_logo_142px.png)](http://www.semantic-mediawiki.org/) -Semantic MediaWiki with fully automated install. +Semantic MediaWiki with fully automated install. Will get your Semantic MediaWiki running in a few minutes. ### Documentation @@ -21,5 +22,5 @@ Will get your Semantic MediaWiki running in a few minutes. ### Features * Docker compose based * based on official Mediawiki docker image -### Links +### Links * https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/1218 diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..d926daf --- /dev/null +++ b/docs/index.md @@ -0,0 +1,5 @@ +# ProfiWiki API Documentation + +::: profiwiki + options: + show_submodules: true diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..89392d3 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,18 @@ +site_name: ProfiWiki 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 diff --git a/profiwiki/version.py b/profiwiki/version.py index 630aaf9..08b2bb5 100644 --- a/profiwiki/version.py +++ b/profiwiki/version.py @@ -15,7 +15,7 @@ class Version(object): description = """BITPlan's professional Semantic Mediawiki""" version = profiwiki.__version__ date = "2023-04-01" - updated = "2024-04-19" + updated = "2024-08-02" authors = "Wolfgang Fahl" doc_url = "https://wiki.bitplan.com/index.php/ProfiWiki" chat_url = "https://github.com/BITPlan/ProfiWiki/discussions" diff --git a/pyproject.toml b/pyproject.toml index e3a16cb..2f0629e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ readme = "README.md" license= "Apache-2.0" dependencies = [ #https://pypi.org/project/pymediawikidocker/ - "pymediawikidocker>=0.12.1", + "pymediawikidocker>=0.13.0", #https://pypi.org/project/py-3rdparty-mediawiki/ "py-3rdparty-mediawiki" ] @@ -54,9 +54,10 @@ test = [ ] [tool.hatch.build.targets.wheel] -packages = [ - "profiwiki", -] +only-include = ["profiwiki"] + +[tool.hatch.build.targets.wheel.sources] +"profiwiki" = "profiwiki" [project.scripts] profiwiki = "profiwiki.profiwiki_cmd:main" diff --git a/scripts/doc b/scripts/doc new file mode 100755 index 0000000..dfbc1c6 --- /dev/null +++ b/scripts/doc @@ -0,0 +1,88 @@ +#!/bin/bash +# create docs for a configurable project +# WF 2024-07-30 - updated + +# 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 ' "') + + +# 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" +} + +# 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 + +# 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