From 80fa77f757c095c012448303436c381374d49f38 Mon Sep 17 00:00:00 2001 From: Mark Parker Date: Tue, 19 Sep 2023 18:24:53 +0200 Subject: [PATCH] add pypi release workflow --- .github/workflows/release.yml | 83 ++++++++++++++++++++++++++++++++++ docs/sync-vs-async-commands.md | 2 +- pyproject.toml | 7 ++- 3 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0bb4681 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,83 @@ +name: Publish to PyPI and Create Release + +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v2 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install poetry + poetry install + + - name: Version bump + id: version + run: | + if [[ "v$(poetry version --short)" == "$(git describe --tags --always --abbrev=0)" ]]; then + poetry version patch + git add pyproject.toml + git config --global user.email "mark@parker-programs.com" + git config --global user.name "MarkParker5" + git commit -m "Version bump v$(poetry version --short)" + git push + echo Version bumped to $(poetry version --short) + fi + echo Using version $(poetry version --short) + echo VERSION="v$(poetry version --short)" >> $GITHUB_OUTPUT + + - name: Build distribution + id: build + run: | + poetry build + echo FILE="$(ls dist/*.whl -U | head -1)" >> $GITHUB_OUTPUT + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + + - name: Create tag + uses: rickstaa/action-create-tag@v1 + with: + tag: ${{ steps.version.outputs.VERSION }} + + - name: Generate changelog + id: changelog + run: | + changelog=$(git log --pretty=format:"- %s" "${{ steps.version.outputs.VERSION }}..HEAD") + + - name: Create GitHub Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} + with: + tag_name: ${{ steps.version.outputs.VERSION }} + release_name: Release ${{ steps.version.outputs.VERSION }} + body: ${{ steps.changelog.outputs.changelog }} + draft: false + prerelease: false + + - name: Upload .whl file + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ steps.build.outputs.FILE }} + asset_name: ${{ steps.build.outputs.FILE }} + asset_content_type: application/zip diff --git a/docs/sync-vs-async-commands.md b/docs/sync-vs-async-commands.md index 7671688..14401ee 100644 --- a/docs/sync-vs-async-commands.md +++ b/docs/sync-vs-async-commands.md @@ -77,7 +77,7 @@ def hello_command() -> Response: All commands in Stark are inherently asynchronous. If you declare a command as synchronous, Stark converts it to asynchronous using [asyncer.asyncify](https://asyncer.tiangolo.com/). -By default, Stark concurrently manages two vital processes: speech transcription and response handling. It also has to execute commands, adding temporary processes that last as long as the command. All these processes share a single main thread. If one process blocks the thread for an extended period (e.g., with `requests.get` or `time.sleep`), it can halt the entire application. Stark includes the `BlockageDetector` to monitor the main thread and alert you if it's blocked for longer than a specified duration (default is 1 second). Additionally, every command is timed to help identify any that might be causing blockages. +By default, Stark concurrently manages two vital processes: speech transcription and response handling. It also has to execute commands, adding temporary processes that last as long as the command. All these processes share a single main thread. If one process blocks the thread for an extended period (e.g., with `requests.get` or `time.sleep`), it can halt the entire application. Stark includes the `BlockageDetector` to monitor the main thread and alert you if it's blocked for longer than a specified duration (default is 1 second). For commands that might cause blockages, declaring them using def is advised. Stark will then wrap these commands with asyncer.asyncify, spawning separate background threads for each process. diff --git a/pyproject.toml b/pyproject.toml index 44607b0..f86a2d8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,10 +2,15 @@ name = "stark" version = "4.0.0" description = "" -authors = ["MarkParker5 "] +authors = ["MarkParker5 "] license = "CC BY-NC-SA 4.0" readme = "README.md" packages = [{include = "stark"}] +homepage = "https://pypi.org/project/stark/" +repository = "https://github.com/MarkParker5/STARK" +documentation = "https://stark.markparker.me" +keywords = ["python", "open-source", "natural-language-processing", "framework", "cross-platform", "natural-language", "voice", "voice-commands", "python3", "voice-recognition", "speech-recognition", "speech-to-text", "community-project", "voice-assistant", "voice-interface", "NLP", "machine-learning", "AI", "text-analysis", "stark", "stark-place", "mark parker"] + [tool.poetry.dependencies] python = "^3.10"