fedkit 0.1.0__tar.gz → 0.2.0__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.
- fedkit-0.2.0/PKG-INFO +230 -0
- fedkit-0.2.0/README.md +199 -0
- fedkit-0.2.0/pyproject.toml +143 -0
- fedkit-0.2.0/pyproject.toml.orig +124 -0
- fedkit-0.2.0/src/fedkit/__init__.py +6 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/activities/base.py +1 -3
- fedkit-0.2.0/src/fedkit/activities/c2s.py +241 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/activities/follow.py +26 -27
- fedkit-0.2.0/src/fedkit/activities/inbound.py +224 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/activity.py +12 -8
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/admin.py +137 -27
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/apps.py +16 -4
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/cli.py +4 -1
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/contentnegotiation.py +2 -10
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/fedkit_typing.py +4 -2
- fedkit-0.2.0/src/fedkit/feeds.py +70 -0
- fedkit-0.2.0/src/fedkit/management/commands/accept_followers.py +68 -0
- fedkit-0.2.0/src/fedkit/migrations/0001_initial.py +250 -0
- fedkit-0.2.0/src/fedkit/migrations/0002_bookmark.py +41 -0
- fedkit-0.2.0/src/fedkit/migrations/0002_bookmark_squashed_0015_tagcooccurrence.py +519 -0
- fedkit-0.2.0/src/fedkit/migrations/0003_reblog.py +41 -0
- fedkit-0.2.0/src/fedkit/migrations/0004_notetag_note_tags.py +60 -0
- fedkit-0.2.0/src/fedkit/migrations/0005_taghref.py +38 -0
- fedkit-0.2.0/src/fedkit/migrations/0006_note_likes_count_note_reblogs_count.py +22 -0
- fedkit-0.2.0/src/fedkit/migrations/0007_note_last_fetched.py +17 -0
- fedkit-0.2.0/src/fedkit/migrations/0008_alter_actor_unique_together_actor_remote_id_and_more.py +170 -0
- fedkit-0.2.0/src/fedkit/migrations/0009_rename_actor_id.py +18 -0
- fedkit-0.2.0/src/fedkit/migrations/0010_rename_uuid_id.py +18 -0
- fedkit-0.2.0/src/fedkit/migrations/0011_alter_id_pk.py +30 -0
- fedkit-0.2.0/src/fedkit/migrations/0012_remove_old_id.py +17 -0
- fedkit-0.2.0/src/fedkit/migrations/0013_post_actor_uuid.py +95 -0
- fedkit-0.2.0/src/fedkit/migrations/0014_migrate_action_gfk.py +79 -0
- fedkit-0.2.0/src/fedkit/migrations/0015_tagcooccurrence.py +49 -0
- fedkit-0.2.0/src/fedkit/models/__init__.py +9 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/models/action.py +9 -21
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/models/actor.py +102 -26
- fedkit-0.2.0/src/fedkit/models/bookmark.py +26 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/models/like.py +1 -1
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/models/note.py +30 -2
- fedkit-0.2.0/src/fedkit/models/reblog.py +26 -0
- fedkit-0.2.0/src/fedkit/models/tag_cooccurrence.py +19 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/registry.py +1 -2
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/renderers.py +1 -2
- fedkit-0.2.0/src/fedkit/serializers/action.py +95 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/serializers/actor.py +8 -3
- fedkit-0.2.0/src/fedkit/signals.py +271 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/signature.py +11 -24
- fedkit-0.2.0/src/fedkit/sitemaps.py +149 -0
- fedkit-0.2.0/src/fedkit/tasks/__init__.py +17 -0
- fedkit-0.2.0/src/fedkit/tasks/actor.py +64 -0
- fedkit-0.2.0/src/fedkit/tasks/base.py +29 -0
- fedkit-0.2.0/src/fedkit/tasks/delivery.py +185 -0
- fedkit-0.2.0/src/fedkit/tasks/fetch.py +122 -0
- fedkit-0.2.0/src/fedkit/templates/base.html +21 -0
- fedkit-0.2.0/src/fedkit/templates/fedkit/action.html +144 -0
- fedkit-0.2.0/src/fedkit/templates/fedkit/actor.html +128 -0
- fedkit-0.2.0/src/fedkit/templates/fedkit/actor_base.html +396 -0
- fedkit-0.2.0/src/fedkit/templates/fedkit/followers.html +82 -0
- fedkit-0.2.0/src/fedkit/templates/fedkit/following.html +78 -0
- fedkit-0.2.0/src/fedkit/templates/fedkit/inbox.html +181 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/templates/fedkit/index.html +16 -3
- fedkit-0.2.0/src/fedkit/templates/fedkit/like_detail.html +54 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/templates/fedkit/liked.html +45 -42
- fedkit-0.2.0/src/fedkit/templates/fedkit/note.html +69 -0
- fedkit-0.2.0/src/fedkit/templates/fedkit/outbox.html +155 -0
- fedkit-0.2.0/src/fedkit/templates/fedkit/tag_detail.html +88 -0
- fedkit-0.2.0/src/fedkit/urls/__init__.py +37 -0
- fedkit-0.2.0/src/fedkit/urls/api.py +128 -0
- fedkit-0.2.0/src/fedkit/urls/client.py +21 -0
- fedkit-0.2.0/src/fedkit/urls/server.py +81 -0
- fedkit-0.2.0/src/fedkit/urls/web.py +126 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/validators.py +10 -13
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/views/__init__.py +2 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/views/action.py +5 -4
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/views/activity.py +7 -4
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/views/actor.py +3 -5
- fedkit-0.2.0/src/fedkit/views/compat.py +1812 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/views/followers.py +12 -16
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/views/following.py +5 -11
- fedkit-0.2.0/src/fedkit/views/globalinbox.py +117 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/views/inbox.py +61 -51
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/views/liked.py +3 -4
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/views/nodeinfo.py +38 -11
- fedkit-0.2.0/src/fedkit/views/note.py +50 -0
- fedkit-0.2.0/src/fedkit/views/outbox.py +150 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/views/streaming.py +6 -1
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/views/timelines.py +6 -1
- fedkit-0.2.0/src/fedkit/views/web/__init__.py +24 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/views/web/following.py +4 -4
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/views/web/likes.py +12 -13
- fedkit-0.2.0/src/fedkit/views/web/tag.py +27 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/views/webfinger.py +11 -12
- fedkit-0.1.0/PKG-INFO +0 -135
- fedkit-0.1.0/README.md +0 -104
- fedkit-0.1.0/pyproject.toml +0 -62
- fedkit-0.1.0/src/fedkit/__init__.py +0 -1
- fedkit-0.1.0/src/fedkit/activities/inbound.py +0 -170
- fedkit-0.1.0/src/fedkit/migrations/0001_initial.py +0 -111
- fedkit-0.1.0/src/fedkit/models/__init__.py +0 -6
- fedkit-0.1.0/src/fedkit/serializers/action.py +0 -56
- fedkit-0.1.0/src/fedkit/signals.py +0 -133
- fedkit-0.1.0/src/fedkit/tasks/__init__.py +0 -259
- fedkit-0.1.0/src/fedkit/tasks/fetch.py +0 -46
- fedkit-0.1.0/src/fedkit/templates/fedkit/action.html +0 -13
- fedkit-0.1.0/src/fedkit/templates/fedkit/actor.html +0 -435
- fedkit-0.1.0/src/fedkit/templates/fedkit/followers.html +0 -11
- fedkit-0.1.0/src/fedkit/templates/fedkit/following.html +0 -7
- fedkit-0.1.0/src/fedkit/templates/fedkit/inbox.html +0 -543
- fedkit-0.1.0/src/fedkit/templates/fedkit/like_detail.html +0 -2
- fedkit-0.1.0/src/fedkit/templates/fedkit/note.html +0 -5
- fedkit-0.1.0/src/fedkit/templates/fedkit/outbox.html +0 -151
- fedkit-0.1.0/src/fedkit/tests/__init__.py +0 -5
- fedkit-0.1.0/src/fedkit/tests/actor.py +0 -92
- fedkit-0.1.0/src/fedkit/tests/rename_messages.py +0 -458
- fedkit-0.1.0/src/fedkit/tests/test_action.py +0 -43
- fedkit-0.1.0/src/fedkit/tests/test_activityobject.py +0 -58
- fedkit-0.1.0/src/fedkit/tests/test_actor.py +0 -60
- fedkit-0.1.0/src/fedkit/tests/test_fetch.py +0 -73
- fedkit-0.1.0/src/fedkit/tests/test_following.py +0 -71
- fedkit-0.1.0/src/fedkit/tests/test_inbox.py +0 -138
- fedkit-0.1.0/src/fedkit/tests/test_outbox.py +0 -89
- fedkit-0.1.0/src/fedkit/tests/test_signature.py +0 -172
- fedkit-0.1.0/src/fedkit/tests/test_webfinger.py +0 -49
- fedkit-0.1.0/src/fedkit/tests/untest_web.py +0 -59
- fedkit-0.1.0/src/fedkit/urls/__init__.py +0 -80
- fedkit-0.1.0/src/fedkit/urls/web.py +0 -32
- fedkit-0.1.0/src/fedkit/views/globalinbox.py +0 -14
- fedkit-0.1.0/src/fedkit/views/note.py +0 -39
- fedkit-0.1.0/src/fedkit/views/outbox.py +0 -106
- fedkit-0.1.0/src/fedkit/views/web/__init__.py +0 -18
- {fedkit-0.1.0 → fedkit-0.2.0}/LICENSE +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/activities/__init__.py +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/context.py +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/decorators.py +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/exceptions.py +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/management/__init__.py +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/management/commands/__init__.py +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/management/commands/follow.py +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/managers.py +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/migrations/__init__.py +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/parsers.py +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/schema.py +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/serializers/__init__.py +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/serializers/activity.py +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/serializers/note.py +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/templates/fedkit/follow_create.html +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/templates/fedkit/follow_delete.html +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/templates/fedkit/follow_detail.html +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/templates/fedkit/follow_list.html +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/templates/fedkit/like_create.html +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/templates/fedkit/like_delete.html +0 -0
- {fedkit-0.1.0 → fedkit-0.2.0}/src/fedkit/templates/fedkit/like_list.html +0 -0
fedkit-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fedkit
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A reusable Django app for the Fediverse.
|
|
5
|
+
Author: Andreas Neumeier
|
|
6
|
+
Author-email: Andreas Neumeier <andreas@neumeier.org>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Framework :: Django
|
|
10
|
+
Classifier: Framework :: Django :: 6.0
|
|
11
|
+
Classifier: Framework :: Django :: 6.1
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
17
|
+
Requires-Dist: cryptography
|
|
18
|
+
Requires-Dist: django>=6.0
|
|
19
|
+
Requires-Dist: djangorestframework>=3.18.3
|
|
20
|
+
Requires-Dist: pillow
|
|
21
|
+
Requires-Dist: pyld
|
|
22
|
+
Requires-Dist: requests
|
|
23
|
+
Requires-Dist: django-taggit>=6.1.0
|
|
24
|
+
Requires-Python: >=3.12
|
|
25
|
+
Project-URL: Homepage, https://pramari.de/@fedkit
|
|
26
|
+
Project-URL: Documentation, https://docs.pramari.de
|
|
27
|
+
Project-URL: Repository, https://github.com/pramari/fedkit
|
|
28
|
+
Project-URL: Bug Tracker, https://github.com/pramari/fedkit/issues
|
|
29
|
+
Project-URL: Changelog, https://github.com/pramari/fedkit/releases
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# fedkit
|
|
33
|
+
|
|
34
|
+
# fedkit: ActivityPub & ActivityStreams for Python & Django
|
|
35
|
+
|
|
36
|
+
**fedkit** is a Python library built to enable easy integration of the **ActivityStreams** and **ActivityPub** federation protocols into Python-built websites, with a particular focus on the **Django** framework.
|
|
37
|
+
|
|
38
|
+
It allows your application to participate in the Fediverse, enabling seamless communication with other federated services like Mastodon, Pleroma, and PeerTube.
|
|
39
|
+
|
|
40
|
+
-----
|
|
41
|
+
|
|
42
|
+
## ✨ (Planned) Features
|
|
43
|
+
|
|
44
|
+
- [ ] **ActivityStreams Object Handling:** Simple and declarative Python classes for creating, validating, and serializing **ActivityStreams** objects.
|
|
45
|
+
- [ ] **ActivityPub Protocol Support:** Tools for handling **Inboxes**, **Outboxes**, and remote actor discovery (WebFinger).
|
|
46
|
+
- [ ] **Django Integration:** Built-in utilities, database models, and view helpers to quickly add federation capabilities to your existing Django project.
|
|
47
|
+
* [ ] **Decoupled Design:** Core federation logic can be used in any Python web framework (Flask, FastAPI, etc.).
|
|
48
|
+
|
|
49
|
+
-----
|
|
50
|
+
|
|
51
|
+
## 🚀 Installation
|
|
52
|
+
|
|
53
|
+
You can install `fedkit` directly using pip:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install "fedkit>=0.2.0"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
> **Note:** the 0.1.0 release was an unsupported preview whose wheel contained
|
|
60
|
+
> no package code. Use 0.2.0 or newer.
|
|
61
|
+
|
|
62
|
+
### Django Setup
|
|
63
|
+
|
|
64
|
+
1. **Add to `INSTALLED_APPS`**:
|
|
65
|
+
To integrate `fedkit` into your Django project, add it to your `settings.py`:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
# settings.py
|
|
69
|
+
|
|
70
|
+
INSTALLED_APPS = [
|
|
71
|
+
# ... your other apps
|
|
72
|
+
'fedkit',
|
|
73
|
+
# ...
|
|
74
|
+
]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
2. **Include URLs**:
|
|
78
|
+
Add the `fedkit` URLs to your project's `urls.py`. To ensure standard protocol discovery endpoints (like WebFinger and NodeInfo) and the REST APIs reside at the root of your domain, you should include the URLs at the root path:
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
# urls.py
|
|
82
|
+
from django.urls import path, include
|
|
83
|
+
|
|
84
|
+
urlpatterns = [
|
|
85
|
+
# ... your other URLs
|
|
86
|
+
path('', include('fedkit.urls')),
|
|
87
|
+
]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
`fedkit` URLs are structured into four modules, namespaced under the main `fedkit` namespace:
|
|
91
|
+
- **`fedkit:web`**: Human-facing web views (like notes, index, feeds, RSS, and discovery routes like WebFinger/NodeInfo). Mountable separately via `fedkit.urls.web`.
|
|
92
|
+
- **`fedkit:client`**: ActivityPub Client-to-Server (C2S) interactions (e.g. outboxes). Mountable separately via `fedkit.urls.client`.
|
|
93
|
+
- **`fedkit:server`**: ActivityPub Server-to-Server (S2S) federation endpoints (e.g. actor profiles, inboxes, followers/following/liked lists). Mountable separately via `fedkit.urls.server`.
|
|
94
|
+
- **`fedkit:api`**: Mastodon-compatible REST API endpoints and OAuth routes. Mountable separately via `fedkit.urls.api`.
|
|
95
|
+
|
|
96
|
+
If you want more granular control over where each module is mounted (for instance, if you want all S2S endpoints prefixed with `@/`), you can include them individually:
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
# urls.py
|
|
100
|
+
from django.urls import path, include
|
|
101
|
+
from fedkit.urls import api, client, server, web
|
|
102
|
+
|
|
103
|
+
urlpatterns = [
|
|
104
|
+
# Mount REST API / OAuth at /api and /oauth
|
|
105
|
+
path('', include((api, 'api'), namespace='fedkit')),
|
|
106
|
+
|
|
107
|
+
# Mount ActivityPub S2S federation and profiles at the @ prefix
|
|
108
|
+
path('@/', include((server, 'server'), namespace='fedkit')),
|
|
109
|
+
|
|
110
|
+
# Mount C2S client interactions at @
|
|
111
|
+
path('@/', include((client, 'client'), namespace='fedkit')),
|
|
112
|
+
|
|
113
|
+
# Mount HTML web views and metadata discovery at root/other prefixes
|
|
114
|
+
path('', include((web, 'web'), namespace='fedkit')),
|
|
115
|
+
]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
3. **Run Migrations**:
|
|
120
|
+
Apply the necessary database migrations:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
python manage.py migrate
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
-----
|
|
127
|
+
|
|
128
|
+
## ⚙️ Basic Usage
|
|
129
|
+
|
|
130
|
+
### 1\. Creating a Federating Actor
|
|
131
|
+
|
|
132
|
+
`fedkit` creates an `Actor` automatically when a Django user is created. The
|
|
133
|
+
actor's slug, keys, and ActivityPub endpoints are derived from the user and the
|
|
134
|
+
current `Site`.
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
from django.contrib.auth import get_user_model
|
|
138
|
+
|
|
139
|
+
User = get_user_model()
|
|
140
|
+
user = User.objects.create_user("alice", "alice@example.com", "change-me")
|
|
141
|
+
|
|
142
|
+
actor = user.actor
|
|
143
|
+
print(actor.uri) # https://<your-domain>/@alice
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### 2\. Creating a Note
|
|
147
|
+
|
|
148
|
+
Create a `Note` attributed to the local actor. Saving it records a local
|
|
149
|
+
`Create` action and, when followers exist, publishes the activity to them.
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from fedkit.models import Note
|
|
153
|
+
|
|
154
|
+
note = Note.objects.create(
|
|
155
|
+
content="<p>Hello from fedkit.</p>",
|
|
156
|
+
attributedTo=actor,
|
|
157
|
+
)
|
|
158
|
+
print(note.get_absolute_url())
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
-----
|
|
162
|
+
|
|
163
|
+
## 📖 Documentation & Examples
|
|
164
|
+
|
|
165
|
+
For detailed instructions on configuring federation settings, customizing views, handling **Inboxes**, and implementing full server-to-server communication, please refer to the official documentation (coming soon).
|
|
166
|
+
|
|
167
|
+
-----
|
|
168
|
+
|
|
169
|
+
## 🤝 Contributing
|
|
170
|
+
|
|
171
|
+
**fedkit** is an open-source project and contributions are highly welcome\!
|
|
172
|
+
|
|
173
|
+
If you'd like to contribute, please check out the repository on GitHub, fork the project, and submit a pull request with your suggested changes. You can also report issues or suggest features via the issue tracker.
|
|
174
|
+
|
|
175
|
+
-----
|
|
176
|
+
|
|
177
|
+
## 🔍 SEO & Syndication (Sitemaps & RSS)
|
|
178
|
+
|
|
179
|
+
To optimize search engine indexing and content syndication for your public notes:
|
|
180
|
+
|
|
181
|
+
### 1. Automatic Sitemap Registration
|
|
182
|
+
`fedkit` automatically includes a `sitemap.xml` route when you include `fedkit.urls` in your host project, provided that `'django.contrib.sitemaps'` is added to your `INSTALLED_APPS` setting.
|
|
183
|
+
- Sitemaps included: Notes, Likes, and Tags.
|
|
184
|
+
- Path: `https://<your-domain>/sitemap.xml` (when mounted at root `path('', include('fedkit.urls'))`).
|
|
185
|
+
|
|
186
|
+
If you prefer to mount the sitemaps manually or customize them, you can import and register them:
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
# urls.py (in host project)
|
|
190
|
+
from django.contrib.sitemaps.views import sitemap
|
|
191
|
+
from django.urls import path
|
|
192
|
+
from fedkit.sitemaps import NoteSitemap, LikeSitemap, TagSitemap
|
|
193
|
+
|
|
194
|
+
sitemaps = {
|
|
195
|
+
'notes': NoteSitemap,
|
|
196
|
+
'likes': LikeSitemap,
|
|
197
|
+
'tags': TagSitemap,
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
urlpatterns = [
|
|
201
|
+
# ... your other URLs
|
|
202
|
+
path('sitemap.xml', sitemap, {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.sitemap'),
|
|
203
|
+
]
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### 2. Access the RSS Feed
|
|
207
|
+
`fedkit` provides a built-in syndication feed view under `/feed/` (e.g., `https://pramari.de/feed/` when mounted at root). This generates a clean RSS feed of the latest public notes:
|
|
208
|
+
- RSS Feed URL: `https://<your-domain>/feed/`
|
|
209
|
+
- Actor RSS Feed URL: `https://<your-domain>/@<actorname>/rss` (e.g., `https://<your-domain>/@andreas/rss`)
|
|
210
|
+
|
|
211
|
+
-----
|
|
212
|
+
|
|
213
|
+
## 🔐 Security, Authentication, & Third-Party Clients
|
|
214
|
+
|
|
215
|
+
**fedkit** implements the ActivityPub and ActivityStreams protocols, but it does **not** provide a built-in user authentication system or OAuth2 provider.
|
|
216
|
+
|
|
217
|
+
- **OAuth flows** and **user management** are the responsibility of the hosting application.
|
|
218
|
+
- To connect with third-party Mastodon-compatible clients (e.g. Elk, Ivory, Mona):
|
|
219
|
+
1. The host application must install and configure `django-oauth-toolkit`.
|
|
220
|
+
2. The hosting application must add `oauth2_provider` to its `INSTALLED_APPS` and configure the authorization server.
|
|
221
|
+
3. `fedkit`'s built-in `POST /api/v1/apps` endpoint will automatically detect `oauth2_provider` and programmatically register application client credentials (`client_id` and `client_secret`) directly inside it for the client.
|
|
222
|
+
4. If `oauth2_provider` is not installed or configured, clients attempting to register will receive a `403 Forbidden` response.
|
|
223
|
+
|
|
224
|
+
-----
|
|
225
|
+
|
|
226
|
+
## ⚖️ License
|
|
227
|
+
|
|
228
|
+
This project is licensed under the **MIT License**.
|
|
229
|
+
|
|
230
|
+
Please see the `LICENSE` file in the repository for more details.
|
fedkit-0.2.0/README.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# fedkit
|
|
2
|
+
|
|
3
|
+
# fedkit: ActivityPub & ActivityStreams for Python & Django
|
|
4
|
+
|
|
5
|
+
**fedkit** is a Python library built to enable easy integration of the **ActivityStreams** and **ActivityPub** federation protocols into Python-built websites, with a particular focus on the **Django** framework.
|
|
6
|
+
|
|
7
|
+
It allows your application to participate in the Fediverse, enabling seamless communication with other federated services like Mastodon, Pleroma, and PeerTube.
|
|
8
|
+
|
|
9
|
+
-----
|
|
10
|
+
|
|
11
|
+
## ✨ (Planned) Features
|
|
12
|
+
|
|
13
|
+
- [ ] **ActivityStreams Object Handling:** Simple and declarative Python classes for creating, validating, and serializing **ActivityStreams** objects.
|
|
14
|
+
- [ ] **ActivityPub Protocol Support:** Tools for handling **Inboxes**, **Outboxes**, and remote actor discovery (WebFinger).
|
|
15
|
+
- [ ] **Django Integration:** Built-in utilities, database models, and view helpers to quickly add federation capabilities to your existing Django project.
|
|
16
|
+
* [ ] **Decoupled Design:** Core federation logic can be used in any Python web framework (Flask, FastAPI, etc.).
|
|
17
|
+
|
|
18
|
+
-----
|
|
19
|
+
|
|
20
|
+
## 🚀 Installation
|
|
21
|
+
|
|
22
|
+
You can install `fedkit` directly using pip:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install "fedkit>=0.2.0"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
> **Note:** the 0.1.0 release was an unsupported preview whose wheel contained
|
|
29
|
+
> no package code. Use 0.2.0 or newer.
|
|
30
|
+
|
|
31
|
+
### Django Setup
|
|
32
|
+
|
|
33
|
+
1. **Add to `INSTALLED_APPS`**:
|
|
34
|
+
To integrate `fedkit` into your Django project, add it to your `settings.py`:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
# settings.py
|
|
38
|
+
|
|
39
|
+
INSTALLED_APPS = [
|
|
40
|
+
# ... your other apps
|
|
41
|
+
'fedkit',
|
|
42
|
+
# ...
|
|
43
|
+
]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
2. **Include URLs**:
|
|
47
|
+
Add the `fedkit` URLs to your project's `urls.py`. To ensure standard protocol discovery endpoints (like WebFinger and NodeInfo) and the REST APIs reside at the root of your domain, you should include the URLs at the root path:
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
# urls.py
|
|
51
|
+
from django.urls import path, include
|
|
52
|
+
|
|
53
|
+
urlpatterns = [
|
|
54
|
+
# ... your other URLs
|
|
55
|
+
path('', include('fedkit.urls')),
|
|
56
|
+
]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`fedkit` URLs are structured into four modules, namespaced under the main `fedkit` namespace:
|
|
60
|
+
- **`fedkit:web`**: Human-facing web views (like notes, index, feeds, RSS, and discovery routes like WebFinger/NodeInfo). Mountable separately via `fedkit.urls.web`.
|
|
61
|
+
- **`fedkit:client`**: ActivityPub Client-to-Server (C2S) interactions (e.g. outboxes). Mountable separately via `fedkit.urls.client`.
|
|
62
|
+
- **`fedkit:server`**: ActivityPub Server-to-Server (S2S) federation endpoints (e.g. actor profiles, inboxes, followers/following/liked lists). Mountable separately via `fedkit.urls.server`.
|
|
63
|
+
- **`fedkit:api`**: Mastodon-compatible REST API endpoints and OAuth routes. Mountable separately via `fedkit.urls.api`.
|
|
64
|
+
|
|
65
|
+
If you want more granular control over where each module is mounted (for instance, if you want all S2S endpoints prefixed with `@/`), you can include them individually:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
# urls.py
|
|
69
|
+
from django.urls import path, include
|
|
70
|
+
from fedkit.urls import api, client, server, web
|
|
71
|
+
|
|
72
|
+
urlpatterns = [
|
|
73
|
+
# Mount REST API / OAuth at /api and /oauth
|
|
74
|
+
path('', include((api, 'api'), namespace='fedkit')),
|
|
75
|
+
|
|
76
|
+
# Mount ActivityPub S2S federation and profiles at the @ prefix
|
|
77
|
+
path('@/', include((server, 'server'), namespace='fedkit')),
|
|
78
|
+
|
|
79
|
+
# Mount C2S client interactions at @
|
|
80
|
+
path('@/', include((client, 'client'), namespace='fedkit')),
|
|
81
|
+
|
|
82
|
+
# Mount HTML web views and metadata discovery at root/other prefixes
|
|
83
|
+
path('', include((web, 'web'), namespace='fedkit')),
|
|
84
|
+
]
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
3. **Run Migrations**:
|
|
89
|
+
Apply the necessary database migrations:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
python manage.py migrate
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
-----
|
|
96
|
+
|
|
97
|
+
## ⚙️ Basic Usage
|
|
98
|
+
|
|
99
|
+
### 1\. Creating a Federating Actor
|
|
100
|
+
|
|
101
|
+
`fedkit` creates an `Actor` automatically when a Django user is created. The
|
|
102
|
+
actor's slug, keys, and ActivityPub endpoints are derived from the user and the
|
|
103
|
+
current `Site`.
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from django.contrib.auth import get_user_model
|
|
107
|
+
|
|
108
|
+
User = get_user_model()
|
|
109
|
+
user = User.objects.create_user("alice", "alice@example.com", "change-me")
|
|
110
|
+
|
|
111
|
+
actor = user.actor
|
|
112
|
+
print(actor.uri) # https://<your-domain>/@alice
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 2\. Creating a Note
|
|
116
|
+
|
|
117
|
+
Create a `Note` attributed to the local actor. Saving it records a local
|
|
118
|
+
`Create` action and, when followers exist, publishes the activity to them.
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from fedkit.models import Note
|
|
122
|
+
|
|
123
|
+
note = Note.objects.create(
|
|
124
|
+
content="<p>Hello from fedkit.</p>",
|
|
125
|
+
attributedTo=actor,
|
|
126
|
+
)
|
|
127
|
+
print(note.get_absolute_url())
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
-----
|
|
131
|
+
|
|
132
|
+
## 📖 Documentation & Examples
|
|
133
|
+
|
|
134
|
+
For detailed instructions on configuring federation settings, customizing views, handling **Inboxes**, and implementing full server-to-server communication, please refer to the official documentation (coming soon).
|
|
135
|
+
|
|
136
|
+
-----
|
|
137
|
+
|
|
138
|
+
## 🤝 Contributing
|
|
139
|
+
|
|
140
|
+
**fedkit** is an open-source project and contributions are highly welcome\!
|
|
141
|
+
|
|
142
|
+
If you'd like to contribute, please check out the repository on GitHub, fork the project, and submit a pull request with your suggested changes. You can also report issues or suggest features via the issue tracker.
|
|
143
|
+
|
|
144
|
+
-----
|
|
145
|
+
|
|
146
|
+
## 🔍 SEO & Syndication (Sitemaps & RSS)
|
|
147
|
+
|
|
148
|
+
To optimize search engine indexing and content syndication for your public notes:
|
|
149
|
+
|
|
150
|
+
### 1. Automatic Sitemap Registration
|
|
151
|
+
`fedkit` automatically includes a `sitemap.xml` route when you include `fedkit.urls` in your host project, provided that `'django.contrib.sitemaps'` is added to your `INSTALLED_APPS` setting.
|
|
152
|
+
- Sitemaps included: Notes, Likes, and Tags.
|
|
153
|
+
- Path: `https://<your-domain>/sitemap.xml` (when mounted at root `path('', include('fedkit.urls'))`).
|
|
154
|
+
|
|
155
|
+
If you prefer to mount the sitemaps manually or customize them, you can import and register them:
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
# urls.py (in host project)
|
|
159
|
+
from django.contrib.sitemaps.views import sitemap
|
|
160
|
+
from django.urls import path
|
|
161
|
+
from fedkit.sitemaps import NoteSitemap, LikeSitemap, TagSitemap
|
|
162
|
+
|
|
163
|
+
sitemaps = {
|
|
164
|
+
'notes': NoteSitemap,
|
|
165
|
+
'likes': LikeSitemap,
|
|
166
|
+
'tags': TagSitemap,
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
urlpatterns = [
|
|
170
|
+
# ... your other URLs
|
|
171
|
+
path('sitemap.xml', sitemap, {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.sitemap'),
|
|
172
|
+
]
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### 2. Access the RSS Feed
|
|
176
|
+
`fedkit` provides a built-in syndication feed view under `/feed/` (e.g., `https://pramari.de/feed/` when mounted at root). This generates a clean RSS feed of the latest public notes:
|
|
177
|
+
- RSS Feed URL: `https://<your-domain>/feed/`
|
|
178
|
+
- Actor RSS Feed URL: `https://<your-domain>/@<actorname>/rss` (e.g., `https://<your-domain>/@andreas/rss`)
|
|
179
|
+
|
|
180
|
+
-----
|
|
181
|
+
|
|
182
|
+
## 🔐 Security, Authentication, & Third-Party Clients
|
|
183
|
+
|
|
184
|
+
**fedkit** implements the ActivityPub and ActivityStreams protocols, but it does **not** provide a built-in user authentication system or OAuth2 provider.
|
|
185
|
+
|
|
186
|
+
- **OAuth flows** and **user management** are the responsibility of the hosting application.
|
|
187
|
+
- To connect with third-party Mastodon-compatible clients (e.g. Elk, Ivory, Mona):
|
|
188
|
+
1. The host application must install and configure `django-oauth-toolkit`.
|
|
189
|
+
2. The hosting application must add `oauth2_provider` to its `INSTALLED_APPS` and configure the authorization server.
|
|
190
|
+
3. `fedkit`'s built-in `POST /api/v1/apps` endpoint will automatically detect `oauth2_provider` and programmatically register application client credentials (`client_id` and `client_secret`) directly inside it for the client.
|
|
191
|
+
4. If `oauth2_provider` is not installed or configured, clients attempting to register will receive a `403 Forbidden` response.
|
|
192
|
+
|
|
193
|
+
-----
|
|
194
|
+
|
|
195
|
+
## ⚖️ License
|
|
196
|
+
|
|
197
|
+
This project is licensed under the **MIT License**.
|
|
198
|
+
|
|
199
|
+
Please see the `LICENSE` file in the repository for more details.
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "fedkit"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "A reusable Django app for the Fediverse."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.12"
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Framework :: Django",
|
|
11
|
+
"Framework :: Django :: 6.0",
|
|
12
|
+
"Framework :: Django :: 6.1",
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"Programming Language :: Python :: 3.12",
|
|
15
|
+
"Programming Language :: Python :: 3.13",
|
|
16
|
+
"Programming Language :: Python :: 3.14",
|
|
17
|
+
"Programming Language :: Python :: 3.15",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"cryptography",
|
|
21
|
+
"Django>=6.0",
|
|
22
|
+
"djangorestframework>=3.18.3",
|
|
23
|
+
"Pillow",
|
|
24
|
+
"pyld",
|
|
25
|
+
"requests",
|
|
26
|
+
"django-taggit>=6.1.0",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[[project.authors]]
|
|
30
|
+
name = "Andreas Neumeier"
|
|
31
|
+
email = "andreas@neumeier.org"
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://pramari.de/@fedkit"
|
|
35
|
+
Documentation = "https://docs.pramari.de"
|
|
36
|
+
Repository = "https://github.com/pramari/fedkit"
|
|
37
|
+
"Bug Tracker" = "https://github.com/pramari/fedkit/issues"
|
|
38
|
+
Changelog = "https://github.com/pramari/fedkit/releases"
|
|
39
|
+
|
|
40
|
+
[project.entry-points."django.apps"]
|
|
41
|
+
fedkit = "fedkit.apps.ActivitypubConfig"
|
|
42
|
+
|
|
43
|
+
[project.scripts]
|
|
44
|
+
fedkit = "fedkit.cli:main"
|
|
45
|
+
|
|
46
|
+
[dependency-groups]
|
|
47
|
+
dev = [
|
|
48
|
+
"coverage>=7.6.9",
|
|
49
|
+
"django-allauth",
|
|
50
|
+
"pyjwt",
|
|
51
|
+
"mypy>=1.13.0",
|
|
52
|
+
"pytest-django>=4.9.0",
|
|
53
|
+
"pytest>=8.3.4",
|
|
54
|
+
"ruff>=0.8.2",
|
|
55
|
+
"sphinx>=8.1.3",
|
|
56
|
+
"sphinx-material>=0.0.36",
|
|
57
|
+
"sphinx-rtd-theme>=3.0.2",
|
|
58
|
+
"pre-commit",
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
[build-system]
|
|
62
|
+
requires = ["uv_build >= 0.9.5, <0.14.0"]
|
|
63
|
+
build-backend = "uv_build"
|
|
64
|
+
|
|
65
|
+
[tool.uv.build-backend]
|
|
66
|
+
|
|
67
|
+
[tool.pytest.ini_options]
|
|
68
|
+
DJANGO_SETTINGS_MODULE = "tests.settings"
|
|
69
|
+
pythonpath = ["src"]
|
|
70
|
+
testpaths = ["tests"]
|
|
71
|
+
addopts = [
|
|
72
|
+
"--import-mode=importlib",
|
|
73
|
+
"-m",
|
|
74
|
+
"not integration",
|
|
75
|
+
]
|
|
76
|
+
markers = ["integration: tests that require a live network or external service"]
|
|
77
|
+
|
|
78
|
+
[tool.ruff]
|
|
79
|
+
src = ["src"]
|
|
80
|
+
line-length = 100
|
|
81
|
+
indent-width = 4
|
|
82
|
+
|
|
83
|
+
[tool.ruff.format]
|
|
84
|
+
quote-style = "double"
|
|
85
|
+
indent-style = "space"
|
|
86
|
+
line-ending = "auto"
|
|
87
|
+
|
|
88
|
+
[tool.ruff.lint]
|
|
89
|
+
select = [
|
|
90
|
+
"F",
|
|
91
|
+
"E",
|
|
92
|
+
"I",
|
|
93
|
+
"RUF",
|
|
94
|
+
]
|
|
95
|
+
fixable = ["ALL"]
|
|
96
|
+
|
|
97
|
+
[tool.ruff.lint.per-file-ignores]
|
|
98
|
+
"src/fedkit/migrations/*.py" = [
|
|
99
|
+
"RUF012",
|
|
100
|
+
"E501",
|
|
101
|
+
]
|
|
102
|
+
"src/fedkit/tasks/__init__.py" = [
|
|
103
|
+
"E501",
|
|
104
|
+
"F401",
|
|
105
|
+
"RUF",
|
|
106
|
+
]
|
|
107
|
+
"tests/*.py" = [
|
|
108
|
+
"E501",
|
|
109
|
+
"RUF",
|
|
110
|
+
"F841",
|
|
111
|
+
]
|
|
112
|
+
"src/fedkit/serializers/*.py" = ["RUF012"]
|
|
113
|
+
"src/fedkit/views/**/*.py" = [
|
|
114
|
+
"RUF012",
|
|
115
|
+
"E402",
|
|
116
|
+
"F841",
|
|
117
|
+
]
|
|
118
|
+
"src/fedkit/views/*.py" = [
|
|
119
|
+
"RUF012",
|
|
120
|
+
"E501",
|
|
121
|
+
"E402",
|
|
122
|
+
"F841",
|
|
123
|
+
]
|
|
124
|
+
"src/fedkit/urls/*.py" = [
|
|
125
|
+
"E501",
|
|
126
|
+
"E402",
|
|
127
|
+
]
|
|
128
|
+
"src/fedkit/contentnegotiation.py" = [
|
|
129
|
+
"E501",
|
|
130
|
+
"RUF005",
|
|
131
|
+
]
|
|
132
|
+
"src/fedkit/parsers.py" = ["E501"]
|
|
133
|
+
"src/fedkit/models/*.py" = ["E501"]
|
|
134
|
+
"src/fedkit/activities/*.py" = [
|
|
135
|
+
"E501",
|
|
136
|
+
"E741",
|
|
137
|
+
]
|
|
138
|
+
"src/fedkit/activity.py" = ["E501"]
|
|
139
|
+
"src/fedkit/__init__.py" = ["F401"]
|
|
140
|
+
"src/fedkit/management/commands/*.py" = ["E501"]
|
|
141
|
+
|
|
142
|
+
[tool.ruff.lint.pydocstyle]
|
|
143
|
+
convention = "google"
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "fedkit"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "A reusable Django app for the Fediverse."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
authors = [{ name = "Andreas Neumeier", email = "andreas@neumeier.org" }]
|
|
9
|
+
requires-python = ">=3.12"
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Framework :: Django",
|
|
12
|
+
"Framework :: Django :: 6.0",
|
|
13
|
+
"Framework :: Django :: 6.1",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3.12",
|
|
16
|
+
"Programming Language :: Python :: 3.13",
|
|
17
|
+
"Programming Language :: Python :: 3.14",
|
|
18
|
+
"Programming Language :: Python :: 3.15",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"cryptography",
|
|
22
|
+
"Django>=6.0",
|
|
23
|
+
"djangorestframework>=3.18.3",
|
|
24
|
+
"Pillow",
|
|
25
|
+
"pyld",
|
|
26
|
+
"requests",
|
|
27
|
+
"django-taggit>=6.1.0",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://pramari.de/@fedkit"
|
|
33
|
+
Documentation = "https://docs.pramari.de"
|
|
34
|
+
Repository = "https://github.com/pramari/fedkit"
|
|
35
|
+
"Bug Tracker" = "https://github.com/pramari/fedkit/issues"
|
|
36
|
+
Changelog = "https://github.com/pramari/fedkit/releases"
|
|
37
|
+
|
|
38
|
+
[project.entry-points."django.apps"]
|
|
39
|
+
fedkit = "fedkit.apps.ActivitypubConfig"
|
|
40
|
+
|
|
41
|
+
[dependency-groups]
|
|
42
|
+
dev = [
|
|
43
|
+
"coverage>=7.6.9",
|
|
44
|
+
"django-allauth",
|
|
45
|
+
"pyjwt",
|
|
46
|
+
"mypy>=1.13.0",
|
|
47
|
+
"pytest-django>=4.9.0",
|
|
48
|
+
"pytest>=8.3.4",
|
|
49
|
+
"ruff>=0.8.2",
|
|
50
|
+
"sphinx>=8.1.3",
|
|
51
|
+
"sphinx-material>=0.0.36",
|
|
52
|
+
"sphinx-rtd-theme>=3.0.2",
|
|
53
|
+
"pre-commit",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
# Config moved to top
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
[project.scripts]
|
|
60
|
+
fedkit = "fedkit.cli:main"
|
|
61
|
+
|
|
62
|
+
[build-system]
|
|
63
|
+
requires = ["uv_build >= 0.9.5, <0.14.0"]
|
|
64
|
+
build-backend = "uv_build"
|
|
65
|
+
|
|
66
|
+
[tool.uv]
|
|
67
|
+
# Standard PyPI is used by default. For publishing to TestPyPI, publish-url can be used.
|
|
68
|
+
|
|
69
|
+
[tool.uv.build-backend]
|
|
70
|
+
|
|
71
|
+
[tool.pytest.ini_options]
|
|
72
|
+
DJANGO_SETTINGS_MODULE = "tests.settings"
|
|
73
|
+
pythonpath = [
|
|
74
|
+
"src"
|
|
75
|
+
]
|
|
76
|
+
testpaths = [
|
|
77
|
+
"tests"
|
|
78
|
+
]
|
|
79
|
+
addopts = [
|
|
80
|
+
"--import-mode=importlib",
|
|
81
|
+
"-m",
|
|
82
|
+
"not integration",
|
|
83
|
+
]
|
|
84
|
+
markers = [
|
|
85
|
+
"integration: tests that require a live network or external service",
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
[tool.ruff]
|
|
89
|
+
src = ["src"]
|
|
90
|
+
line-length = 100
|
|
91
|
+
indent-width = 4
|
|
92
|
+
|
|
93
|
+
[tool.ruff.format]
|
|
94
|
+
quote-style = "double"
|
|
95
|
+
indent-style = "space"
|
|
96
|
+
line-ending = "auto"
|
|
97
|
+
|
|
98
|
+
[tool.ruff.lint]
|
|
99
|
+
select = [
|
|
100
|
+
"F", # pyflakes
|
|
101
|
+
"E", # pycodestyle
|
|
102
|
+
"I", # isort
|
|
103
|
+
"RUF", # ruff-specific rules
|
|
104
|
+
]
|
|
105
|
+
fixable = ["ALL"]
|
|
106
|
+
|
|
107
|
+
[tool.ruff.lint.per-file-ignores]
|
|
108
|
+
"src/fedkit/migrations/*.py" = ["RUF012", "E501"]
|
|
109
|
+
"src/fedkit/tasks/__init__.py" = ["E501", "F401", "RUF"]
|
|
110
|
+
"tests/*.py" = ["E501", "RUF", "F841"]
|
|
111
|
+
"src/fedkit/serializers/*.py" = ["RUF012"]
|
|
112
|
+
"src/fedkit/views/**/*.py" = ["RUF012", "E402", "F841"]
|
|
113
|
+
"src/fedkit/views/*.py" = ["RUF012", "E501", "E402", "F841"]
|
|
114
|
+
"src/fedkit/urls/*.py" = ["E501", "E402"]
|
|
115
|
+
"src/fedkit/contentnegotiation.py" = ["E501", "RUF005"]
|
|
116
|
+
"src/fedkit/parsers.py" = ["E501"]
|
|
117
|
+
"src/fedkit/models/*.py" = ["E501"]
|
|
118
|
+
"src/fedkit/activities/*.py" = ["E501", "E741"]
|
|
119
|
+
"src/fedkit/activity.py" = ["E501"]
|
|
120
|
+
"src/fedkit/__init__.py" = ["F401"]
|
|
121
|
+
"src/fedkit/management/commands/*.py" = ["E501"]
|
|
122
|
+
|
|
123
|
+
[tool.ruff.lint.pydocstyle]
|
|
124
|
+
convention = "google"
|