Skip to content

Commit

Permalink
release commit
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Jul 31, 2024
1 parent 494c36e commit 3399546
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/upload-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
# 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
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
[![Github Actions Build](https://github.com/WolfgangFahl/py-3rdparty-mediawiki/actions/workflows/build.yml/badge.svg)](https://github.com/WolfgangFahl/py-3rdparty-mediawiki/actions/workflows/build.yml)
[![GitHub issues](https://img.shields.io/github/issues/WolfgangFahl/py-3rdparty-mediawiki.svg)](https://github.com/WolfgangFahl/py-3rdparty-mediawiki/issues)
[![GitHub closed issues](https://img.shields.io/github/issues-closed/WolfgangFahl/py-3rdparty-mediawiki.svg)](https://github.com/WolfgangFahl/py-3rdparty-mediawiki/issues/?q=is%3Aissue+is%3Aclosed)
[![GitHub](https://img.shields.io/github/license/WolfgangFahl/py-3rdparty-mediawiki.svg)](https://www.apache.org/licenses/LICENSE-2.0)
[![PyPI Status](https://img.shields.io/pypi/v/py-3rdparty-mediawiki.svg)](https://pypi.python.org/pypi/py-3rdparty-mediawiki/)
[![API Docs](https://img.shields.io/badge/API-Documentation-blue)](https://WolfgangFahl.github.io/py-3rdparty-mediawiki/)
[![License](https://img.shields.io/github/license/WolfgangFahl/py-3rdparty-mediawiki.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)

## Links
Expand Down
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ test = [
]

[tool.hatch.build.targets.wheel]
packages = [
"wikibot3rd",
]
only-include = ["wikibot3rd"]

[tool.hatch.build.targets.wheel.sources]
"wikibot3rd" = "wikibot3rd"


[project.scripts]
wikibackup = "wikibot3rd.wikipush:mainBackup"
Expand Down
100 changes: 86 additions & 14 deletions scripts/doc
Original file line number Diff line number Diff line change
@@ -1,16 +1,88 @@
#!/bin/bash
# WF 2020-01-31
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
# 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"
}
checkinstalled sphinx-apidoc
sphinx-apidoc -f -o docs/source . wikibot/crypt wikibot/wikibot wikibot/smw
cd docs
make clean html
open build/html/index.html

# 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."
9 changes: 5 additions & 4 deletions scripts/release
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash
# WF 2020-03-26
# create a release see https://packaging.python.org/tutorials/packaging-projects/
rm -rf dist
scripts/doc
python3 setup.py sdist bdist_wheel
python3 -m twine upload -u __token__ --repository-url https://upload.pypi.org/legacy/ dist/*
scripts/doc -d

# Commit with a message that includes the current ISO timestamp
git commit -a -m "release commit"
git push

0 comments on commit 3399546

Please sign in to comment.