knoc-plugin-template (0.1.3)

Published 2025-05-28 17:57:21 +00:00 by phil in K-Net/knoc-plugin-template

Installation

PIP_EXTRA_INDEX_URL=https://pypi.org/simple/ pip install --index-url  knoc-plugin-template

You can use pipx instead of pip on some systems like Debian.

About this package

Plugin template for Knoc

Template for Knoc plugins

Entry points

It has 4 standard entry points, defined in pyproject.toml:

  • CLI
  • workflow
  • api
  • settings

CI

It has a Forgejo CI build action, defined in .forgejo/actions/build.yaml.

Usage

Just replace foo by the name of the plugin below.

With fish:

set NAME foo
set PNAME knoc_$NAME
set DNAME (echo $NAME | tr "_" "-")

or with bash:

NAME=foo
PNAME=knoc_$NAME
DNAME=$(echo $NAME | tr "_" "-")

Then:

git clone https://code.philo.ydns.eu/K-Net/knoc-plugin-template.git $DNAME
cd $DNAME
rm -rf .git
mv src/knoc_plugin_template src/$NAME
sed  "s/plugin_template/$NAME/" -i pyproject.toml
sed  "s/knoc-plugin-template/$DNAME/" -i pyproject.toml
sed  "s/plugin_template/$NAME/" -i src/$PNAME/api.py
sed  "s/plugin_template/$NAME/" -i src/$PNAME/cli.py
sed  "s/plugin_template/$NAME/" -i src/$PNAME/settings.py
sed  "s/plugin_template/$NAME/" -i src/$PNAME/workflows.py
uv venv
git init  # Forgejo inits repo with a branch `main`, so it might be a good idea to stick wit this convention
git branch -m master main

Then, with fish:

. .venv/bin/activate.fish
uv sync

Or bash:

. .venv/bin/activate
uv sync
git add --all
git commit -m "Initial commit"

=> The package is ready.

In a knoc development environment:

uv pip install -e ../$DNAME
knoc # Should display the new plugin's CLI tool 

Develop

  • Edit *git commit *git tag (for versioning: git tag -a v0.1.2 -m "...")
  • git push

Deploy

To add the plugin in a production image, add the name to the PLUGIN variable of the CI build tool, and deploy.

Requirements

Requires Python: >=3.13
Details
PyPI
2025-05-28 17:57:21 +00:00
1
4.2 KiB
Assets (1)
Versions (3) View all
0.1.3 2025-05-28
0.1.2 2025-05-28
0.1.1 2025-05-28