roboherd 0.1.13__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. roboherd-0.1.13/.gitignore +5 -0
  2. roboherd-0.1.13/.woodpecker/create_release.yml +15 -0
  3. roboherd-0.1.13/.woodpecker/publish_docker.yml +33 -0
  4. roboherd-0.1.13/.woodpecker/publish_pypi.yml +13 -0
  5. roboherd-0.1.13/.woodpecker/test.yml +38 -0
  6. roboherd-0.1.13/.woodpecker/website.yml +17 -0
  7. roboherd-0.1.13/CHANGES.md +72 -0
  8. roboherd-0.1.13/PKG-INFO +95 -0
  9. roboherd-0.1.13/README.md +68 -0
  10. roboherd-0.1.13/cattle_grid.toml +6 -0
  11. roboherd-0.1.13/docs/annotations.md +1 -0
  12. roboherd-0.1.13/docs/assets/bull-horns.png +0 -0
  13. roboherd-0.1.13/docs/assets/mastodon.png +0 -0
  14. roboherd-0.1.13/docs/cli.md +18 -0
  15. roboherd-0.1.13/docs/cow.md +1 -0
  16. roboherd-0.1.13/docs/herd.md +1 -0
  17. roboherd-0.1.13/docs/index.md +394 -0
  18. roboherd-0.1.13/docs/main.md +3 -0
  19. roboherd-0.1.13/docs/util.md +1 -0
  20. roboherd-0.1.13/features/basic_bot.feature +21 -0
  21. roboherd-0.1.13/features/environment.py +5 -0
  22. roboherd-0.1.13/features/steps/import.py +2 -0
  23. roboherd-0.1.13/mkdocs.yml +72 -0
  24. roboherd-0.1.13/pyproject.toml +66 -0
  25. roboherd-0.1.13/resources/docker/Dockerfile +10 -0
  26. roboherd-0.1.13/resources/docker/build.sh +11 -0
  27. roboherd-0.1.13/roboherd/__init__.py +25 -0
  28. roboherd-0.1.13/roboherd/__main__.py +145 -0
  29. roboherd-0.1.13/roboherd/annotations/__init__.py +43 -0
  30. roboherd-0.1.13/roboherd/annotations/bovine.py +67 -0
  31. roboherd-0.1.13/roboherd/annotations/common.py +43 -0
  32. roboherd-0.1.13/roboherd/cow/__init__.py +237 -0
  33. roboherd-0.1.13/roboherd/cow/const.py +6 -0
  34. roboherd-0.1.13/roboherd/cow/handlers.py +54 -0
  35. roboherd-0.1.13/roboherd/cow/profile.py +127 -0
  36. roboherd-0.1.13/roboherd/cow/test_handlers.py +76 -0
  37. roboherd-0.1.13/roboherd/cow/test_init.py +52 -0
  38. roboherd-0.1.13/roboherd/cow/test_profile.py +81 -0
  39. roboherd-0.1.13/roboherd/cow/test_util.py +17 -0
  40. roboherd-0.1.13/roboherd/cow/types.py +67 -0
  41. roboherd-0.1.13/roboherd/cow/util.py +26 -0
  42. roboherd-0.1.13/roboherd/examples/__init__.py +0 -0
  43. roboherd-0.1.13/roboherd/examples/dev_null.py +10 -0
  44. roboherd-0.1.13/roboherd/examples/json_echo.py +51 -0
  45. roboherd-0.1.13/roboherd/examples/meta.py +5 -0
  46. roboherd-0.1.13/roboherd/examples/moocow.py +37 -0
  47. roboherd-0.1.13/roboherd/examples/number.py +67 -0
  48. roboherd-0.1.13/roboherd/examples/rooster.py +17 -0
  49. roboherd-0.1.13/roboherd/examples/scarecrow.py +23 -0
  50. roboherd-0.1.13/roboherd/herd/__init__.py +111 -0
  51. roboherd-0.1.13/roboherd/herd/builder.py +21 -0
  52. roboherd-0.1.13/roboherd/herd/manager/__init__.py +47 -0
  53. roboherd-0.1.13/roboherd/herd/manager/config.py +85 -0
  54. roboherd-0.1.13/roboherd/herd/manager/load.py +15 -0
  55. roboherd-0.1.13/roboherd/herd/manager/test_config.py +83 -0
  56. roboherd-0.1.13/roboherd/herd/manager/test_load.py +19 -0
  57. roboherd-0.1.13/roboherd/herd/manager/test_manager.py +42 -0
  58. roboherd-0.1.13/roboherd/herd/processor.py +42 -0
  59. roboherd-0.1.13/roboherd/herd/scheduler.py +65 -0
  60. roboherd-0.1.13/roboherd/herd/test_herd.py +37 -0
  61. roboherd-0.1.13/roboherd/herd/test_scheduler.py +17 -0
  62. roboherd-0.1.13/roboherd/herd/types.py +12 -0
  63. roboherd-0.1.13/roboherd/py.typed +0 -0
  64. roboherd-0.1.13/roboherd/register.py +41 -0
  65. roboherd-0.1.13/roboherd/test_validators.py +10 -0
  66. roboherd-0.1.13/roboherd/testing/__init__.py +0 -0
  67. roboherd-0.1.13/roboherd/testing/steps/__init__.py +1 -0
  68. roboherd-0.1.13/roboherd/testing/steps/robocow.py +51 -0
  69. roboherd-0.1.13/roboherd/util.py +66 -0
  70. roboherd-0.1.13/roboherd/validators.py +6 -0
  71. roboherd-0.1.13/roboherd/version.py +1 -0
  72. roboherd-0.1.13/uv.lock +3047 -0
@@ -0,0 +1,5 @@
1
+ herd.toml
2
+ roboherd.toml
3
+ *.whl
4
+ tmp
5
+ bovine_jsonld_cache.sqlite
@@ -0,0 +1,15 @@
1
+ when:
2
+ branch: [main]
3
+ event: [push]
4
+
5
+ depends_on: ["test"]
6
+
7
+ steps:
8
+ create_release:
9
+ image: helgekr/release_helper
10
+ pull: true
11
+ environment:
12
+ CODEBERG_TOKEN: { from_secret: codeberg_token }
13
+ CODEBERG_OWNER: bovine
14
+ CODEBERG_REPO: roboherd
15
+ CONNECTION_STRING: { from_secret: caddle_drive_connection_string }
@@ -0,0 +1,33 @@
1
+ when:
2
+ - event: tag
3
+ branch: main
4
+
5
+ matrix:
6
+ PYTHON_VERSION: [3.13]
7
+
8
+ depends_on: ["publish_pypi"]
9
+
10
+ steps:
11
+ sleep:
12
+ image: ghcr.io/astral-sh/uv:python3.11-alpine
13
+ commands:
14
+ - sleep 120
15
+ publish_docker_latest:
16
+ image: woodpeckerci/plugin-docker-buildx:6.0.2
17
+ settings:
18
+ platforms: linux/amd64,linux/arm64
19
+ repo: helgekr/roboherd
20
+ username:
21
+ from_secret: docker_username
22
+ password:
23
+ from_secret: docker_password
24
+ dockerfile: resources/docker/Dockerfile
25
+ tags:
26
+ - latest
27
+ - ${CI_COMMIT_TAG}
28
+ - ${CI_COMMIT_TAG}-python${PYTHON_VERSION}
29
+ build_args:
30
+ tag: "${CI_COMMIT_TAG}"
31
+ python_tag: "${PYTHON_VERSION}"
32
+ when:
33
+ - matrix: { PYTHON_VERSION: 3.13 }
@@ -0,0 +1,13 @@
1
+ when:
2
+ - event: tag
3
+ branch: main
4
+ steps:
5
+ publish_pypi:
6
+ image: ghcr.io/astral-sh/uv:python3.11-alpine
7
+ commands:
8
+ - uv sync --frozen
9
+ - uv build
10
+ - uv publish --token $PYPI_API_KEY
11
+ environment:
12
+ PYPI_API_KEY:
13
+ from_secret: pypi_api_key
@@ -0,0 +1,38 @@
1
+ when:
2
+ - branch: [main]
3
+ event: [pull_request, push]
4
+
5
+ matrix:
6
+ extras: ["--all-extras", ""]
7
+
8
+ steps:
9
+ build:
10
+ image: ghcr.io/astral-sh/uv:python3.11-alpine
11
+ commands:
12
+ - uv sync ${extras}
13
+ test_format:
14
+ image: ghcr.io/astral-sh/uv:python3.11-alpine
15
+ commands:
16
+ - uv run ruff format --check .
17
+ - uv run ruff check .
18
+ when:
19
+ - matrix: { extras: "--all-extras" }
20
+ test_pytest:
21
+ image: ghcr.io/astral-sh/uv:python3.11-alpine
22
+ commands:
23
+ - uv run pytest roboherd
24
+ test_typing:
25
+ image: ghcr.io/astral-sh/uv:python3.11-alpine
26
+ commands:
27
+ - apk add libstdc++ libgcc
28
+ - uv run pyright roboherd
29
+ when:
30
+ - matrix: { extras: "--all-extras" }
31
+ build_docs:
32
+ image: ghcr.io/astral-sh/uv:python3.11-alpine
33
+ commands:
34
+ - cp CHANGES.md docs/CHANGES.md
35
+ - uv sync --group docs
36
+ - uv run mkdocs build
37
+ when:
38
+ - matrix: { extras: "--all-extras" }
@@ -0,0 +1,17 @@
1
+ when:
2
+ branch: main
3
+ event: push
4
+
5
+ steps:
6
+ build:
7
+ image: ghcr.io/astral-sh/uv:python3.11-alpine
8
+ commands:
9
+ - uv sync --all-extras --group docs
10
+ - cp CHANGES.md docs/CHANGES.md
11
+ - uv run mkdocs build
12
+ deploy:
13
+ image: codeberg.org/xfix/plugin-codeberg-pages-deploy:1
14
+ settings:
15
+ folder: site
16
+ ssh_key:
17
+ from_secret: deploy_ssh_key
@@ -0,0 +1,72 @@
1
+ # Changes to roboherd
2
+
3
+ ## 0.1.13
4
+
5
+ * add basic setup for bdd
6
+ * use optional dependencies for `roboherd[amqp]` and `roboherd[mqtt]`
7
+
8
+ ## 0.1.12
9
+
10
+ - Add ability to set description by markdown
11
+ - Add py.typed [roboherd#54](https://codeberg.org/bovine/roboherd/issues/54)
12
+ - Fix typo [roboherd#55](https://codeberg.org/bovine/roboherd/issues/55)
13
+
14
+ ## 0.1.11
15
+
16
+ - Add `--version` flag [roboherd#50](https://codeberg.org/bovine/roboherd/issues/50)
17
+ - Repair passing build_args to docker buildx [roboherd#51](https://codeberg.org/bovine/roboherd/issues/51)
18
+
19
+ ## 0.1.10
20
+
21
+ - Add check command [roboherd#48](https://codeberg.org/bovine/roboherd/issues/48)
22
+
23
+ ## 0.1.9
24
+
25
+ - Ensure roboherd terminates on connection close [roboherd#1](https://codeberg.org/bovine/roboherd/issues/1)
26
+ - Make doc links clickable [roboherd#44](https://codeberg.org/bovine/roboherd/issues/44)
27
+ - Document how to work with cattle_grid in `README.md`
28
+
29
+ ## 0.1.8 ([Milestone](https://codeberg.org/bovine/roboherd/milestone/11129))
30
+
31
+ - Add ConfigOverrides model [roboherd#43](https://codeberg.org/bovine/roboherd/issues/43)
32
+ - Allow to skip startup [roboherd#41](https://codeberg.org/bovine/roboherd/issues/41)
33
+
34
+ ## 0.1.7 ([Milestone](https://codeberg.org/bovine/roboherd/milestone/10741))
35
+
36
+ - Repair docker file [roboherd#38](https://codeberg.org/bovine/roboherd/issues/38)
37
+ - Simplify imports and creating a RoboCow [roboherd#39](https://codeberg.org/bovine/roboherd/issues/39)
38
+
39
+ ## 0.1.6 ([Milestone](https://codeberg.org/bovine/roboherd/milestone/10694))
40
+
41
+ - Comment on python path [roboherd#34](https://codeberg.org/bovine/roboherd/issues/34)
42
+ - Enable direct posting of markdown [roboherd#35](https://codeberg.org/bovine/roboherd/issues/35)
43
+
44
+ ## 0.1.5 ([Milestone](https://codeberg.org/bovine/roboherd/milestone/10581))
45
+
46
+ - Allow overriding the base_url [roboherd#12](https://codeberg.org/bovine/roboherd/issues/12)
47
+ - Separate out the internal state of a RoboCow
48
+ - If no preferredUsername is set and handle is updated, send Update Service [roboherd#33](https://codeberg.org/bovine/roboherd/issues/33)
49
+ - Add an icon property [roboherd#10](https://codeberg.org/bovine/roboherd/issues/10)
50
+ - Added a logo [roboherd#32](https://codeberg.org/bovine/roboherd/issues/32)
51
+ - Add PublishActivity annotation [roboherd#30](https://codeberg.org/bovine/roboherd/issues/30)
52
+
53
+ ## 0.1.4 ([Milestone](https://codeberg.org/bovine/roboherd/milestone/10442))
54
+
55
+ - Type check the project
56
+ - No longer require bovine [roboherd#26](https://codeberg.org/bovine/roboherd/issues/26)
57
+ - Fixed typo in Dockerfile [roboherd#28](https://codeberg.org/bovine/roboherd/issues/28)
58
+
59
+ ## 0.1.3 ([Milestone](https://codeberg.org/bovine/roboherd/milestone/10441))
60
+
61
+ - Add information about developement [roboherd#24](https://codeberg.org/bovine/roboherd/issues/24)
62
+ - Repair docker build [roboherd#23](https://codeberg.org/bovine/roboherd/issues/23)
63
+
64
+ ## 0.1.1 ([Milestone](https://codeberg.org/bovine/roboherd/milestone/10245))
65
+
66
+ - Document environment variable overrides [roboherd#16](https://codeberg.org/bovine/roboherd/issues/16)
67
+ - Add minimal password length (6 characters) for roboherd register
68
+ - Finish documentation [roboherd#6](https://codeberg.org/bovine/roboherd/issues/6)
69
+ - Add a roboherd register command
70
+ - Repair bovine annotations [roboherd#11](https://codeberg.org/bovine/roboherd/issues/11)
71
+ - Enable setting the type of the actor [roboherd#9](https://codeberg.org/bovine/roboherd/issues/9)
72
+ - Enable setting PropertyValues for the cow actor [roboherd#4](https://codeberg.org/bovine/roboherd/issues/4)
@@ -0,0 +1,95 @@
1
+ Metadata-Version: 2.4
2
+ Name: roboherd
3
+ Version: 0.1.13
4
+ Summary: A Fediverse bot framework
5
+ Project-URL: Documentation, https://bovine.codeberg.page/roboherd/
6
+ Project-URL: Repository, https://codeberg.org/bovine/roboherd
7
+ Requires-Python: >=3.11
8
+ Requires-Dist: almabtrieb>=0.2
9
+ Requires-Dist: apscheduler>=3.11.0
10
+ Requires-Dist: click>=8.1.8
11
+ Requires-Dist: cron-descriptor>=1.4.5
12
+ Requires-Dist: dynaconf>=3.2.6
13
+ Requires-Dist: fast-depends>=3.0.0
14
+ Requires-Dist: pydantic==2.12.3
15
+ Requires-Dist: tomli-w>=1.1.0
16
+ Provides-Extra: amqp
17
+ Requires-Dist: almabtrieb[amqp]>=0.2.8; extra == 'amqp'
18
+ Provides-Extra: bovine
19
+ Requires-Dist: bovine>=0.5.15; extra == 'bovine'
20
+ Requires-Dist: markdown>=3.7; extra == 'bovine'
21
+ Provides-Extra: dev
22
+ Requires-Dist: aiohttp>=3.11.12; extra == 'dev'
23
+ Requires-Dist: watchfiles>=1.0.4; extra == 'dev'
24
+ Provides-Extra: mqtt
25
+ Requires-Dist: almabtrieb[mqtt]>=0.2.8; extra == 'mqtt'
26
+ Description-Content-Type: text/markdown
27
+
28
+ # Roboherd
29
+
30
+ Roboherd is a framework for building Fediverse bots
31
+ using the [Cattle Drive Protocol](https://bovine.codeberg.page/cattle_grid/cattle_drive/).
32
+
33
+ For more information, see the [documentation](https://bovine.codeberg.page/roboherd/) or the [repository](https://codeberg.org/bovine/roboherd/).
34
+
35
+ ## Developping with cattle_grid
36
+
37
+ In your catle_grid `config` directory add a roboherd user, e.g.
38
+ a file `testing.toml` with content
39
+
40
+ ```toml
41
+ [testing]
42
+ enable = true
43
+
44
+ [[testing.accounts]]
45
+ name = "herd"
46
+ password = "pass"
47
+ permissions = ["admin"]
48
+ ```
49
+
50
+ Configure roboherd via `roboherd.toml`, e.g.
51
+
52
+ ```toml
53
+ base_url = "http://abel"
54
+ connection_string = "ws://herd:pass@localhost:3000/ws/"
55
+
56
+ [cow.rooster]
57
+ bot = "roboherd.examples.rooster:bot"
58
+ ```
59
+
60
+ This will trigger a periodic message to cattle_grid.
61
+
62
+ ### nginx for cattle_grid
63
+
64
+ The nginx in the `cattle_grid` configuration should forward the path `/ws/` to
65
+ rabbitmq (supporting mqtt over websockets)
66
+
67
+ ```nginx
68
+ server {
69
+ listen 80;
70
+
71
+ location /ws/ {
72
+ proxy_pass http://rabbitmq:15675;
73
+ proxy_http_version 1.1;
74
+ proxy_set_header Upgrade $http_upgrade;
75
+ proxy_set_header Connection $connection_upgrade;
76
+ proxy_read_timeout 86400; # neccessary to avoid websocket timeout disconnect
77
+ proxy_send_timeout 86400; # neccessary to avoid websocket timeout disconnect
78
+ proxy_redirect off;
79
+ proxy_buffering off;
80
+ }
81
+ }
82
+ ```
83
+
84
+ similarly `nginx` should forward port 80 to 3000 (in the docker compose file).
85
+
86
+ ## BDD Tests
87
+
88
+ Start the pasture currently from containers. Run a runner container via
89
+
90
+ ```bash
91
+ docker run --rm -it -e UV_PROJECT_ENVIRONMENT=/tmp/venv\
92
+ -v .:/app --workdir /app\
93
+ --network fediverse-pasture\
94
+ ghcr.io/astral-sh/uv:alpine /bin/sh
95
+ ```
@@ -0,0 +1,68 @@
1
+ # Roboherd
2
+
3
+ Roboherd is a framework for building Fediverse bots
4
+ using the [Cattle Drive Protocol](https://bovine.codeberg.page/cattle_grid/cattle_drive/).
5
+
6
+ For more information, see the [documentation](https://bovine.codeberg.page/roboherd/) or the [repository](https://codeberg.org/bovine/roboherd/).
7
+
8
+ ## Developping with cattle_grid
9
+
10
+ In your catle_grid `config` directory add a roboherd user, e.g.
11
+ a file `testing.toml` with content
12
+
13
+ ```toml
14
+ [testing]
15
+ enable = true
16
+
17
+ [[testing.accounts]]
18
+ name = "herd"
19
+ password = "pass"
20
+ permissions = ["admin"]
21
+ ```
22
+
23
+ Configure roboherd via `roboherd.toml`, e.g.
24
+
25
+ ```toml
26
+ base_url = "http://abel"
27
+ connection_string = "ws://herd:pass@localhost:3000/ws/"
28
+
29
+ [cow.rooster]
30
+ bot = "roboherd.examples.rooster:bot"
31
+ ```
32
+
33
+ This will trigger a periodic message to cattle_grid.
34
+
35
+ ### nginx for cattle_grid
36
+
37
+ The nginx in the `cattle_grid` configuration should forward the path `/ws/` to
38
+ rabbitmq (supporting mqtt over websockets)
39
+
40
+ ```nginx
41
+ server {
42
+ listen 80;
43
+
44
+ location /ws/ {
45
+ proxy_pass http://rabbitmq:15675;
46
+ proxy_http_version 1.1;
47
+ proxy_set_header Upgrade $http_upgrade;
48
+ proxy_set_header Connection $connection_upgrade;
49
+ proxy_read_timeout 86400; # neccessary to avoid websocket timeout disconnect
50
+ proxy_send_timeout 86400; # neccessary to avoid websocket timeout disconnect
51
+ proxy_redirect off;
52
+ proxy_buffering off;
53
+ }
54
+ }
55
+ ```
56
+
57
+ similarly `nginx` should forward port 80 to 3000 (in the docker compose file).
58
+
59
+ ## BDD Tests
60
+
61
+ Start the pasture currently from containers. Run a runner container via
62
+
63
+ ```bash
64
+ docker run --rm -it -e UV_PROJECT_ENVIRONMENT=/tmp/venv\
65
+ -v .:/app --workdir /app\
66
+ --network fediverse-pasture\
67
+ ghcr.io/astral-sh/uv:alpine /bin/sh
68
+ ```
@@ -0,0 +1,6 @@
1
+ version = 2
2
+ amqp_url = "amqp://guest:guest@cattle_grid_mq/"
3
+ # amqp_url = "amqp://guest:guest@rabbitmq/"
4
+ db_url = "postgresql+asyncpg://postgres:pass@cattle_grid_db/"
5
+
6
+ "frontend.base_urls" = ["http://cattle_grid"]
@@ -0,0 +1 @@
1
+ :::roboherd.annotations
Binary file
@@ -0,0 +1,18 @@
1
+ # Command Line Interface
2
+
3
+ The simplest usage of the command line interface is just
4
+ to run
5
+
6
+ ```bash
7
+ roboherd run
8
+ ```
9
+
10
+ !!! info
11
+ The watch and register commands require you to install
12
+ `roboherd[dev]`.
13
+
14
+ ::: mkdocs-click
15
+ :module: roboherd.__main__
16
+ :command: main
17
+ :prog_name: roboherd
18
+ :depth: 2
@@ -0,0 +1 @@
1
+ :::roboherd.cow
@@ -0,0 +1 @@
1
+ :::roboherd.herd