roboherd 0.1.2__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.
Potentially problematic release.
This version of roboherd might be problematic. Click here for more details.
- roboherd-0.1.2/.gitignore +5 -0
- roboherd-0.1.2/.woodpecker/create_release.yml +15 -0
- roboherd-0.1.2/.woodpecker/publish_docker.yml +29 -0
- roboherd-0.1.2/.woodpecker/publish_pypi.yml +13 -0
- roboherd-0.1.2/.woodpecker/test.yml +22 -0
- roboherd-0.1.2/.woodpecker/website.yml +16 -0
- roboherd-0.1.2/CHANGES.md +11 -0
- roboherd-0.1.2/PKG-INFO +23 -0
- roboherd-0.1.2/README.md +6 -0
- roboherd-0.1.2/docs/annotations.md +1 -0
- roboherd-0.1.2/docs/assets/mastodon.png +0 -0
- roboherd-0.1.2/docs/cli.md +14 -0
- roboherd-0.1.2/docs/cow.md +1 -0
- roboherd-0.1.2/docs/herd.md +1 -0
- roboherd-0.1.2/docs/index.md +297 -0
- roboherd-0.1.2/docs/util.md +1 -0
- roboherd-0.1.2/mkdocs.yml +65 -0
- roboherd-0.1.2/pyproject.toml +48 -0
- roboherd-0.1.2/resources/docker/Dockerfile +9 -0
- roboherd-0.1.2/resources/docker/build.sh +11 -0
- roboherd-0.1.2/roboherd/__init__.py +0 -0
- roboherd-0.1.2/roboherd/__main__.py +106 -0
- roboherd-0.1.2/roboherd/annotations/__init__.py +50 -0
- roboherd-0.1.2/roboherd/annotations/bovine.py +41 -0
- roboherd-0.1.2/roboherd/annotations/common.py +12 -0
- roboherd-0.1.2/roboherd/cow/__init__.py +211 -0
- roboherd-0.1.2/roboherd/cow/handlers.py +54 -0
- roboherd-0.1.2/roboherd/cow/profile.py +113 -0
- roboherd-0.1.2/roboherd/cow/test_handlers.py +76 -0
- roboherd-0.1.2/roboherd/cow/test_init.py +56 -0
- roboherd-0.1.2/roboherd/cow/test_profile.py +49 -0
- roboherd-0.1.2/roboherd/cow/test_util.py +17 -0
- roboherd-0.1.2/roboherd/cow/types.py +58 -0
- roboherd-0.1.2/roboherd/cow/util.py +23 -0
- roboherd-0.1.2/roboherd/examples/__init__.py +0 -0
- roboherd-0.1.2/roboherd/examples/dev_null.py +13 -0
- roboherd-0.1.2/roboherd/examples/json_echo.py +56 -0
- roboherd-0.1.2/roboherd/examples/meta.py +5 -0
- roboherd-0.1.2/roboherd/examples/moocow.py +39 -0
- roboherd-0.1.2/roboherd/examples/number.py +72 -0
- roboherd-0.1.2/roboherd/examples/rooster.py +22 -0
- roboherd-0.1.2/roboherd/examples/scarecrow.py +21 -0
- roboherd-0.1.2/roboherd/herd/__init__.py +94 -0
- roboherd-0.1.2/roboherd/herd/builder.py +21 -0
- roboherd-0.1.2/roboherd/herd/manager/__init__.py +46 -0
- roboherd-0.1.2/roboherd/herd/manager/config.py +54 -0
- roboherd-0.1.2/roboherd/herd/manager/test_config.py +65 -0
- roboherd-0.1.2/roboherd/herd/manager/test_manager.py +42 -0
- roboherd-0.1.2/roboherd/herd/processor.py +39 -0
- roboherd-0.1.2/roboherd/herd/scheduler.py +50 -0
- roboherd-0.1.2/roboherd/herd/test_herd.py +37 -0
- roboherd-0.1.2/roboherd/herd/test_scheduler.py +17 -0
- roboherd-0.1.2/roboherd/herd/types.py +12 -0
- roboherd-0.1.2/roboherd/register.py +38 -0
- roboherd-0.1.2/roboherd/test_util.py +24 -0
- roboherd-0.1.2/roboherd/util.py +116 -0
- roboherd-0.1.2/uv.lock +1657 -0
|
@@ -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
|
+
environment:
|
|
11
|
+
CODEBERG_TOKEN: { from_secret: codeberg_token }
|
|
12
|
+
CODEBERG_OWNER: bovine
|
|
13
|
+
CODEBERG_REPO: roboherd
|
|
14
|
+
caddle_drive_connection_string:
|
|
15
|
+
{ from_secret: caddle_drive_connection_string }
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
publish_docker_latest:
|
|
12
|
+
image: woodpeckerci/plugin-docker-buildx
|
|
13
|
+
settings:
|
|
14
|
+
platforms: linux/amd64,linux/arm64
|
|
15
|
+
repo: helgekr/roboherd
|
|
16
|
+
username:
|
|
17
|
+
from_secret: docker_username
|
|
18
|
+
password:
|
|
19
|
+
from_secret: docker_password
|
|
20
|
+
dockerfile: resources/docker/Dockerfile
|
|
21
|
+
tags:
|
|
22
|
+
- latest
|
|
23
|
+
- ${CI_COMMIT_TAG}
|
|
24
|
+
- ${CI_COMMIT_TAG}-python${PYTHON_VERSION}
|
|
25
|
+
build_args:
|
|
26
|
+
- tag=${CI_COMMIT_TAG}
|
|
27
|
+
- python_tag=${PYTHON_VERSION}
|
|
28
|
+
when:
|
|
29
|
+
- matrix: { PYTHON_VERSION: 3.13 }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
when:
|
|
2
|
+
- branch: [main]
|
|
3
|
+
event: [pull_request, push]
|
|
4
|
+
|
|
5
|
+
steps:
|
|
6
|
+
build:
|
|
7
|
+
image: ghcr.io/astral-sh/uv:python3.11-alpine
|
|
8
|
+
commands:
|
|
9
|
+
- uv sync --all-extras
|
|
10
|
+
test_format:
|
|
11
|
+
image: ghcr.io/astral-sh/uv:python3.11-alpine
|
|
12
|
+
commands:
|
|
13
|
+
- uv run ruff format .
|
|
14
|
+
- uv run ruff check .
|
|
15
|
+
test_pytest:
|
|
16
|
+
image: ghcr.io/astral-sh/uv:python3.11-alpine
|
|
17
|
+
commands:
|
|
18
|
+
- uv run pytest
|
|
19
|
+
build_docs:
|
|
20
|
+
image: ghcr.io/astral-sh/uv:python3.11-alpine
|
|
21
|
+
commands:
|
|
22
|
+
- uv run mkdocs build
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
|
10
|
+
- uv run mkdocs build
|
|
11
|
+
deploy:
|
|
12
|
+
image: codeberg.org/xfix/plugin-codeberg-pages-deploy:1
|
|
13
|
+
settings:
|
|
14
|
+
folder: site
|
|
15
|
+
ssh_key:
|
|
16
|
+
from_secret: deploy_ssh_key
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Changes to roboherd
|
|
2
|
+
|
|
3
|
+
## 0.1.1 ([Milestone](https://codeberg.org/bovine/roboherd/milestone/10245))
|
|
4
|
+
|
|
5
|
+
- Document environment variable overrides [roboherd#16](https://codeberg.org/bovine/roboherd/issues/16)
|
|
6
|
+
- Add minimal password length (6 characters) for roboherd register
|
|
7
|
+
- Finish documentation [roboherd#6](https://codeberg.org/bovine/roboherd/issues/6)
|
|
8
|
+
- Add a roboherd register command
|
|
9
|
+
- Repair bovine annotations [roboherd#11](https://codeberg.org/bovine/roboherd/issues/11)
|
|
10
|
+
- Enable setting the type of the actor [roboherd#9](https://codeberg.org/bovine/roboherd/issues/9)
|
|
11
|
+
- Enable setting PropertyValues for the cow actor [roboherd#4](https://codeberg.org/bovine/roboherd/issues/4)
|
roboherd-0.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: roboherd
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: A Fediverse bot framework
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Requires-Dist: almabtrieb[mqtt]>=0.1.0a1
|
|
7
|
+
Requires-Dist: apscheduler>=3.11.0
|
|
8
|
+
Requires-Dist: click>=8.1.8
|
|
9
|
+
Requires-Dist: cron-descriptor>=1.4.5
|
|
10
|
+
Requires-Dist: dynaconf>=3.2.6
|
|
11
|
+
Requires-Dist: fast-depends>=2.4.12
|
|
12
|
+
Requires-Dist: tomli-w>=1.1.0
|
|
13
|
+
Requires-Dist: watchfiles>=1.0.4
|
|
14
|
+
Provides-Extra: bovine
|
|
15
|
+
Requires-Dist: bovine>=0.5.15; extra == 'bovine'
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# Roboherd
|
|
19
|
+
|
|
20
|
+
Roboherd is a framework for building Fediverse bots
|
|
21
|
+
using the [Cattle Drive Protocol](https://bovine.codeberg.page/cattle_grid/cattle_drive/).
|
|
22
|
+
|
|
23
|
+
For more information, see the [documentation](https://bovine.codeberg.page/roboherd/) or the [repository](https://codeberg.org/bovine/roboherd/).
|
roboherd-0.1.2/README.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
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/).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:::roboherd.annotations
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:::roboherd.cow
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:::roboherd.herd
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
# Roboherd
|
|
2
|
+
|
|
3
|
+
Roboherd is a tool to build automated Fediverse actors. It does
|
|
4
|
+
so by connecting to a server through the [Cattle Drive protocol](https://bovine.codeberg.page/cattle_grid/cattle_drive/) protocol. Once you have
|
|
5
|
+
configured the connection, all other tasks can be done using
|
|
6
|
+
python code and a toml configuration file.
|
|
7
|
+
|
|
8
|
+
## Tour of the functionality
|
|
9
|
+
|
|
10
|
+
We will now tour how to write bots with Roboherd. We start with
|
|
11
|
+
a basic bot that does nothing except have a profile. Then we will
|
|
12
|
+
start by adding features.
|
|
13
|
+
|
|
14
|
+
### Basic bot aka how to configure the profile
|
|
15
|
+
|
|
16
|
+
The configuration file defines the actor by a name and the used python file,
|
|
17
|
+
e.g.
|
|
18
|
+
|
|
19
|
+
```toml title="roboherd.toml"
|
|
20
|
+
base_url = "https://dev.bovine.social"
|
|
21
|
+
|
|
22
|
+
[cow.devnull]
|
|
23
|
+
bot = "roboherd.examples.dev_null:bot"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Where the module is defined as
|
|
27
|
+
|
|
28
|
+
```python title="roboherd/examples/dev_null.py"
|
|
29
|
+
--8<-- "roboherd/examples/dev_null.py"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
One should note that the above definition describes the properties of
|
|
33
|
+
the actor. In mastodon this looks like
|
|
34
|
+
|
|
35
|
+
??? info "Mastodon Screenshot"
|
|
36
|
+

|
|
37
|
+
|
|
38
|
+
??? info "Actor Profile as json"
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"attachment": [
|
|
42
|
+
{
|
|
43
|
+
"type": "PropertyValue",
|
|
44
|
+
"name": "Author",
|
|
45
|
+
"value": "acct:helge@mymath.rocks"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"type": "PropertyValue",
|
|
49
|
+
"name": "Source",
|
|
50
|
+
"value": "https://codeberg.org/bovine/roboherd"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"@context": [
|
|
54
|
+
"https://www.w3.org/ns/activitystreams",
|
|
55
|
+
"https://w3id.org/security/v1",
|
|
56
|
+
{
|
|
57
|
+
"PropertyValue": {
|
|
58
|
+
"@id": "https://schema.org/PropertyValue",
|
|
59
|
+
"@context": {
|
|
60
|
+
"value": "https://schema.org/value",
|
|
61
|
+
"name": "https://schema.org/name"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"publicKey": {
|
|
67
|
+
"id": "https://dev.bovine.social/actor/5Dhr1Bk_E_WuNik_ii0BBQ#legacy-key-1",
|
|
68
|
+
"owner": "https://dev.bovine.social/actor/5Dhr1Bk_E_WuNik_ii0BBQ",
|
|
69
|
+
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvUWtZLOftKTRpNJ+t6Bq\nma6hyRKwcbl6LVuZl+dJ+lAfKpEPRx/2uo/1LkA4mUVEVewyhWMQ8SyIoRayuDqP\njDUaai4mohSg+ReNvmWXD4mgGB7XPc00A4Yk2R/u2hkmu8hWLU7260BTQwmpjsyK\nDG7QWvZYbob1Hyr1QabOpn4tUS3pOl6KqGw8ijNUtAYw22kZl/aZ0v/mk7+V2xhT\nsZbRAC/7o39sFvgGdRHsDwXbJX63aU+qpBc7UX42fdOH9pfmRl5Ps7xCfB1iSlQP\nR4BTGbJB9DOLYlvb2iTqh5cn37VYBxNG3haAv34Q3fBPONOe77CeV1abKTr8/jCG\nsQIDAQAB\n-----END PUBLIC KEY-----\n"
|
|
70
|
+
},
|
|
71
|
+
"id": "https://dev.bovine.social/actor/5Dhr1Bk_E_WuNik_ii0BBQ",
|
|
72
|
+
"type": "Service",
|
|
73
|
+
"inbox": "https://dev.bovine.social/inbox/nAy02r0LlQJ0WO5ry2-LFA",
|
|
74
|
+
"outbox": "https://dev.bovine.social/outbox/7JZSBh-1ZXgTXzkSDjGr-A",
|
|
75
|
+
"followers": "https://dev.bovine.social/followers/90-KDZpuvSif5KAL_TzoYQ",
|
|
76
|
+
"following": "https://dev.bovine.social/following/jrp61fFlLDA5HcYDN98JRA",
|
|
77
|
+
"preferredUsername": "devnull",
|
|
78
|
+
"name": "/dev/null",
|
|
79
|
+
"summary": "I don't do anything.",
|
|
80
|
+
"identifiers": [
|
|
81
|
+
"acct:devnull@dev.bovine.social",
|
|
82
|
+
"https://dev.bovine.social/actor/5Dhr1Bk_E_WuNik_ii0BBQ"
|
|
83
|
+
],
|
|
84
|
+
"endpoints": {
|
|
85
|
+
"sharedInbox": "https://dev.bovine.social/shared_inbox"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Setting me as the author and the source code is contained in [meta_information][roboherd.cow.types.MetaInformation].
|
|
91
|
+
|
|
92
|
+
```python title="roboherd/examples/meta.py"
|
|
93
|
+
--8<-- "roboherd/examples/meta.py"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
!!! todo
|
|
97
|
+
How to configure a profile picture [roboherd#10](https://codeberg.org/bovine/roboherd/issues/10)
|
|
98
|
+
|
|
99
|
+
### Posting on startup
|
|
100
|
+
|
|
101
|
+
By adding
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
@bot.startup
|
|
105
|
+
async def startup(publish_object: PublishObject, object_factory: ObjectFactory):
|
|
106
|
+
await publish_object(object_factory.note(content="Booo! 🐦").as_public().build())
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
one can post on startup. Here [PublishObject][roboherd.annotations.PublishObject]
|
|
110
|
+
and [ObjectFactory][roboherd.annotations.bovine.ObjectFactory]
|
|
111
|
+
are annotations that are injected
|
|
112
|
+
through [FastDepends](https://lancetnik.github.io/FastDepends/).
|
|
113
|
+
|
|
114
|
+
PublishObject depends on the [simple storage extension of cattle_grid](https://bovine.codeberg.page/cattle_grid/extensions/simple_storage/), whereas
|
|
115
|
+
ObjectFactory injects an [ObjectFactory][bovine.activitystreams.object_factory.ObjectFactory] provided by the [bovine](https://bovine.readthedocs.io/en/latest/) library.
|
|
116
|
+
|
|
117
|
+
???info "Full source"
|
|
118
|
+
```python title="roboherd/examples/scarecrow.py"
|
|
119
|
+
--8<-- "roboherd/examples/scarecrow.py"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Replying to messages
|
|
123
|
+
|
|
124
|
+
By adding a block such as
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
@bot.incoming_create
|
|
128
|
+
async def create(
|
|
129
|
+
raw: RawData, publish_object: PublishObject, object_factory: ObjectFactory
|
|
130
|
+
):
|
|
131
|
+
note = (
|
|
132
|
+
object_factory.reply(
|
|
133
|
+
raw.get("object"),
|
|
134
|
+
content=reply_content(raw),
|
|
135
|
+
)
|
|
136
|
+
.as_public()
|
|
137
|
+
.build()
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
await publish_object(note)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
one can reply to messages. Here [RawData][roboherd.annotations.RawData] is an annotation that will ensure that the received activity is injected
|
|
144
|
+
through [FastDepends](https://lancetnik.github.io/FastDepends/).
|
|
145
|
+
The same is true for [PublishObject][roboherd.annotations.PublishObject]
|
|
146
|
+
and [ObjectFactory][roboherd.annotations.bovine.ObjectFactory]. The last
|
|
147
|
+
one depends on [bovine](https://bovine.readthedocs.io/en/latest/).
|
|
148
|
+
|
|
149
|
+
`@bot.incoming_create` indicates that the coroutine `create` should be
|
|
150
|
+
called when a `Create` activity is received. See [roboherd.cow.RoboCow.incoming_create][].
|
|
151
|
+
|
|
152
|
+
???info "Full source"
|
|
153
|
+
```python title="roboherd/examples/json_echo.py"
|
|
154
|
+
--8<-- "roboherd/examples/json_echo.py"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Scheduling a message
|
|
158
|
+
|
|
159
|
+
By including
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
@bot.cron("42 * * * *")
|
|
163
|
+
async def crow(publisher: PublishObject, object_factory: ObjectFactory):
|
|
164
|
+
await publisher(
|
|
165
|
+
object_factory.note(content="cock-a-doodle-doo").as_public().build()
|
|
166
|
+
)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
one can schedule a message to be published at the 42nd minute of every hour.
|
|
170
|
+
Here `"42 * * * *"` is a cron expression.
|
|
171
|
+
|
|
172
|
+
???info "Full source"
|
|
173
|
+
```python title="roboherd/examples/rooster.py"
|
|
174
|
+
--8<-- "roboherd/examples/rooster.py"
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
!!!tip
|
|
178
|
+
Alternatively one can write [bots that post on startup](#posting-on-startup) and schedule them using cron.
|
|
179
|
+
|
|
180
|
+
## Installation
|
|
181
|
+
|
|
182
|
+
### Using the docker container
|
|
183
|
+
|
|
184
|
+
By running
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
docker run --rm -ti -v .:/app helgekr/roboherd
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
you can run a docker container mounting the current directory.
|
|
191
|
+
If the current directory contains a `roboherd.toml` file
|
|
192
|
+
and the appropriate bots, one can run these bots
|
|
193
|
+
by running
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
roboherd run
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
inside the container. Alternatively, this can be done directly
|
|
200
|
+
by running
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
docker run --rm -v .:/app helgekr/roboherd roboherd run
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Installing roboherd as a python package
|
|
207
|
+
|
|
208
|
+
To install roboherd with [bovine](https://bovine.readthedocs.io/en/latest/) support run
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
pip install roboherd[bovine]
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
You are then able to run the roboherd command either by
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
roboherd run
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
or
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
python -mroboherd run
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Configuration
|
|
227
|
+
|
|
228
|
+
roboherd has three global configuration variables, e.g.
|
|
229
|
+
|
|
230
|
+
```toml title="roboherd.toml"
|
|
231
|
+
connection_string = "wss://NAME:PASSWORD@host.example/ws"
|
|
232
|
+
base_url = "https://host.example"
|
|
233
|
+
echo = false
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
`connection_string` points to the server providing a Cattle Drive endpoint. This connection string currently contains the authentication data.
|
|
237
|
+
|
|
238
|
+
`base_url` specifies the domain being used to create the bots. With the above configuration file, it would lead to bots with Fediverse handle `acct:BOT-NAME@host.example`. This might be relaxed in the future with
|
|
239
|
+
[roboherd#12](https://codeberg.org/bovine/roboherd/issues/12).
|
|
240
|
+
|
|
241
|
+
Setting `echo` to `true` will cause roboherd to print all messages performed through Cattle Drive to the console.
|
|
242
|
+
|
|
243
|
+
### Overriding the configuration through environment variables
|
|
244
|
+
|
|
245
|
+
Roboherd uses environment variables starting with `ROBOHERD_`
|
|
246
|
+
as overrides for the configuration. This is done
|
|
247
|
+
through [DynaConf](https://www.dynaconf.com/envvars/). So
|
|
248
|
+
for example
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
ROBOHERD_CONNECTION_STRING=wss://NAME:PASSWORD@other.example/ws\
|
|
252
|
+
roboherd run
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
will connect to `other.example` instead of `host.example`.
|
|
256
|
+
|
|
257
|
+
### Using dev.bovine.social
|
|
258
|
+
|
|
259
|
+
In order to encourage experimentation, I host an _instance_ at
|
|
260
|
+
[dev.bovine.social](https://dev.bovine.social/), where
|
|
261
|
+
you can quickly sign up and deploy some bots.
|
|
262
|
+
|
|
263
|
+
Getting start is simple, run
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
docker run --rm -v .:/app helgekr/roboherd\
|
|
267
|
+
roboherd register --name NAME --fediverse acct:your@handle.example
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
you will then be prompted for a password.
|
|
271
|
+
Afterwards a `roboherd.toml` file with the appropriate configuration
|
|
272
|
+
will be created. Now, you can write a bot, add it to `roboherd.toml`
|
|
273
|
+
and run it via
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
docker run --rm -v .:/app helgekr/roboherd roboherd run
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Please be respectful to the rest of the Fediverse when using
|
|
280
|
+
this service.
|
|
281
|
+
|
|
282
|
+
### console.bovine.social
|
|
283
|
+
|
|
284
|
+
After signing up, you can open the
|
|
285
|
+
[cattle_grid console](https://console.bovine.social/)
|
|
286
|
+
and use it to explore your bots. First one has to sign in
|
|
287
|
+
at the top right corner. Afterwards, one should be able
|
|
288
|
+
to see the incoming and outgoing messages by selecting
|
|
289
|
+
the appropriate points in the menu on the left.
|
|
290
|
+
|
|
291
|
+
!!! warning
|
|
292
|
+
This still seems somewhat buggy, see
|
|
293
|
+
[cattle_grid#83](https://codeberg.org/bovine/cattle_grid/issues/83)
|
|
294
|
+
|
|
295
|
+
The console also allows you to lookup Fediverse
|
|
296
|
+
objects as seen through cattle_grid and perform actions
|
|
297
|
+
manually.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:::roboherd.util
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
site_name: roboherd
|
|
2
|
+
watch: [docs, mkdocs.yml, roboherd]
|
|
3
|
+
|
|
4
|
+
repo_url: https://codeberg.org/bovine/roboherd/
|
|
5
|
+
repo_name: bovine/roboherd
|
|
6
|
+
theme:
|
|
7
|
+
name: material
|
|
8
|
+
icon:
|
|
9
|
+
repo: fontawesome/brands/git-alt
|
|
10
|
+
palette:
|
|
11
|
+
- scheme: default
|
|
12
|
+
toggle:
|
|
13
|
+
icon: material/brightness-7
|
|
14
|
+
name: Switch to dark mode
|
|
15
|
+
- scheme: slate
|
|
16
|
+
toggle:
|
|
17
|
+
icon: material/brightness-4
|
|
18
|
+
name: Switch to light mode
|
|
19
|
+
features:
|
|
20
|
+
- content.code.copy
|
|
21
|
+
- content.tabs.link
|
|
22
|
+
- navigation.footer
|
|
23
|
+
- navigation.sections
|
|
24
|
+
markdown_extensions:
|
|
25
|
+
- smarty
|
|
26
|
+
- tables
|
|
27
|
+
- attr_list
|
|
28
|
+
- md_in_html
|
|
29
|
+
- pymdownx.emoji
|
|
30
|
+
- pymdownx.highlight:
|
|
31
|
+
anchor_linenums: true
|
|
32
|
+
line_spans: __span
|
|
33
|
+
- pymdownx.inlinehilite
|
|
34
|
+
- pymdownx.snippets
|
|
35
|
+
- pymdownx.superfences
|
|
36
|
+
- pymdownx.tabbed:
|
|
37
|
+
alternate_style: true
|
|
38
|
+
- admonition
|
|
39
|
+
- pymdownx.details
|
|
40
|
+
- mkdocs-click
|
|
41
|
+
plugins:
|
|
42
|
+
- search
|
|
43
|
+
- mkdocstrings:
|
|
44
|
+
enable_inventory: true
|
|
45
|
+
handlers:
|
|
46
|
+
python:
|
|
47
|
+
inventories:
|
|
48
|
+
- https://docs.python.org/3/objects.inv
|
|
49
|
+
- https://docs.pydantic.dev/latest/objects.inv
|
|
50
|
+
- https://bovine.readthedocs.io/en/latest/objects.inv
|
|
51
|
+
options:
|
|
52
|
+
docstring_style: sphinx
|
|
53
|
+
heading_level: 1
|
|
54
|
+
show_root_heading: true
|
|
55
|
+
show_submodules: true
|
|
56
|
+
extensions:
|
|
57
|
+
- griffe_fieldz: { include_inherited: true }
|
|
58
|
+
nav:
|
|
59
|
+
- Home: index.md
|
|
60
|
+
- "Commang Line Tool": cli.md
|
|
61
|
+
- "References":
|
|
62
|
+
- "roboherd.annotations": annotations.md
|
|
63
|
+
- "roboherd.cow": cow.md
|
|
64
|
+
- "roboherd.herd": herd.md
|
|
65
|
+
- "roboherd.util": util.md
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "roboherd"
|
|
3
|
+
version = "0.1.2"
|
|
4
|
+
description = "A Fediverse bot framework"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"almabtrieb[mqtt]>=0.1.0a1",
|
|
9
|
+
"apscheduler>=3.11.0",
|
|
10
|
+
"click>=8.1.8",
|
|
11
|
+
"cron-descriptor>=1.4.5",
|
|
12
|
+
"dynaconf>=3.2.6",
|
|
13
|
+
"fast-depends>=2.4.12",
|
|
14
|
+
"tomli-w>=1.1.0",
|
|
15
|
+
"watchfiles>=1.0.4",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[build-system]
|
|
19
|
+
requires = ["hatchling"]
|
|
20
|
+
build-backend = "hatchling.build"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
[project.scripts]
|
|
24
|
+
roboherd = "roboherd.__main__:main"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
bovine = ["bovine>=0.5.15"]
|
|
29
|
+
|
|
30
|
+
[tool.uv]
|
|
31
|
+
dev-dependencies = [
|
|
32
|
+
"pytest>=8.3.4",
|
|
33
|
+
"pytest-asyncio>=0.25.2",
|
|
34
|
+
"pytest-watcher>=0.4.3",
|
|
35
|
+
"mkdocs-material>=9.5.50",
|
|
36
|
+
"mkdocstrings-python>=1.13.0",
|
|
37
|
+
"griffe-fieldz>=0.2.1",
|
|
38
|
+
"mkdocs-click>=0.8.1",
|
|
39
|
+
"ruff>=0.9.6",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[tool.pytest.ini_options]
|
|
43
|
+
addopts = "--doctest-modules"
|
|
44
|
+
asyncio_mode = "auto"
|
|
45
|
+
log_cli = 1
|
|
46
|
+
log_cli_level = "info"
|
|
47
|
+
doctest_optionflags = "NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL ELLIPSIS"
|
|
48
|
+
testpaths = ["roboherd/**/*.py"]
|
|
File without changes
|