veronique 0.1.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.
- veronique-0.1.0/PKG-INFO +129 -0
- veronique-0.1.0/README.md +116 -0
- veronique-0.1.0/data/favicon.ico +0 -0
- veronique-0.1.0/data/graphology-library.min.js +2 -0
- veronique-0.1.0/data/graphology.umd.min.js +2 -0
- veronique-0.1.0/data/htmx.js +1 -0
- veronique-0.1.0/data/leaflet.css +661 -0
- veronique-0.1.0/data/leaflet.js +6 -0
- veronique-0.1.0/data/login.html +49 -0
- veronique-0.1.0/data/mana-cost.css +118 -0
- veronique-0.1.0/data/mana.svg +1093 -0
- veronique-0.1.0/data/marker-icon-2x.png +0 -0
- veronique-0.1.0/data/pico.min.css +4 -0
- veronique-0.1.0/data/prism.css +3 -0
- veronique-0.1.0/data/prism.js +4 -0
- veronique-0.1.0/data/sigma.min.js +1369 -0
- veronique-0.1.0/data/style.css +450 -0
- veronique-0.1.0/data/template.html +71 -0
- veronique-0.1.0/data/veronique.png +0 -0
- veronique-0.1.0/pyproject.toml +35 -0
- veronique-0.1.0/veronique/.pytest_cache/.gitignore +2 -0
- veronique-0.1.0/veronique/.pytest_cache/CACHEDIR.TAG +4 -0
- veronique-0.1.0/veronique/.pytest_cache/README.md +8 -0
- veronique-0.1.0/veronique/.pytest_cache/v/cache/nodeids +1 -0
- veronique-0.1.0/veronique/.pytest_cache/v/cache/stepwise +1 -0
- veronique-0.1.0/veronique/__init__.py +132 -0
- veronique-0.1.0/veronique/autocomplete.py +153 -0
- veronique-0.1.0/veronique/bootstrap.py +104 -0
- veronique-0.1.0/veronique/context.py +26 -0
- veronique-0.1.0/veronique/data_types.py +690 -0
- veronique-0.1.0/veronique/db.py +690 -0
- veronique-0.1.0/veronique/nomnidate.py +152 -0
- veronique-0.1.0/veronique/objects.py +1431 -0
- veronique-0.1.0/veronique/remote.py +52 -0
- veronique-0.1.0/veronique/routes/__init__.py +11 -0
- veronique-0.1.0/veronique/routes/autocomplete.py +24 -0
- veronique-0.1.0/veronique/routes/claims.py +471 -0
- veronique-0.1.0/veronique/routes/index.py +83 -0
- veronique-0.1.0/veronique/routes/network.py +212 -0
- veronique-0.1.0/veronique/routes/queries.py +250 -0
- veronique-0.1.0/veronique/routes/search.py +54 -0
- veronique-0.1.0/veronique/routes/settings.py +122 -0
- veronique-0.1.0/veronique/routes/static.py +74 -0
- veronique-0.1.0/veronique/routes/tools.py +55 -0
- veronique-0.1.0/veronique/routes/users.py +226 -0
- veronique-0.1.0/veronique/routes/verbs.py +158 -0
- veronique-0.1.0/veronique/search.py +83 -0
- veronique-0.1.0/veronique/security.py +61 -0
- veronique-0.1.0/veronique/settings.py +98 -0
- veronique-0.1.0/veronique/utils.py +204 -0
veronique-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: veronique
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Private graph DB / social network
|
|
5
|
+
Author: L3viathan
|
|
6
|
+
Author-email: L3viathan <git@l3vi.de>
|
|
7
|
+
Requires-Dist: sanic
|
|
8
|
+
Requires-Dist: markdown-it-py[linkify]
|
|
9
|
+
Requires-Dist: phonenumbers
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Project-URL: Repository, https://github.com/L3viathan/veronique
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# Véronique
|
|
15
|
+
|
|
16
|
+
_A small database for storing entities, links between them and simple
|
|
17
|
+
properties (e.g. text, color, numbers)._
|
|
18
|
+
|
|
19
|
+

|
|
20
|
+
|
|
21
|
+
Intended as a private social network/people database to help with memorizing
|
|
22
|
+
facts about people, but there's not really any features specific to that.
|
|
23
|
+
|
|
24
|
+
This is meant as a personal, intentionally non-scalable tool. As such, it uses
|
|
25
|
+
SQLite, and there's no proper packaging yet (mostly because it's not needed).
|
|
26
|
+
The app is protected from unauthenticated access, but beyond that there's no
|
|
27
|
+
protection against e.g. XSS. This is a feature, you can put HTML into text
|
|
28
|
+
fields for example. If you need SSO, MFA, or any other similar features, use a
|
|
29
|
+
different tool.
|
|
30
|
+
|
|
31
|
+
## Development
|
|
32
|
+
|
|
33
|
+
- Clone the repo
|
|
34
|
+
- Install `sanic`, `phonenumber`, and `markdown-it-py[linkify]` (to a venv)
|
|
35
|
+
- _Either_: Place a file called `veronique_initial_pw` containing a password in
|
|
36
|
+
the working directory. This will be the password of the `admin` user.
|
|
37
|
+
- _Or_: Run `python -m veronique.bootstrap` to fill the database with testing
|
|
38
|
+
data. The password of the admin user will be "admin". **This irrevocably
|
|
39
|
+
overwrites any existing db you may have.**
|
|
40
|
+
- Run `sanic veronique:app --dev`
|
|
41
|
+
|
|
42
|
+
## Deployment
|
|
43
|
+
|
|
44
|
+
Running in production mostly means removing the `--dev` flag. Maybe set up a
|
|
45
|
+
systemd service for it and point a reverse proxy at it or something. I
|
|
46
|
+
personally [use
|
|
47
|
+
ansible](https://github.com/L3viathan/ansibly/blob/master/roles/mainserver/tasks/veronique.yml)
|
|
48
|
+
for deploying new versions.
|
|
49
|
+
|
|
50
|
+
Missing migrations are automatically applied when restarting the app.
|
|
51
|
+
|
|
52
|
+
## Concepts
|
|
53
|
+
|
|
54
|
+
The database starts mostly empty, only a few internal verbs are added during
|
|
55
|
+
the initial migration. There's also a fixed list of _data types_, since they
|
|
56
|
+
need supporting Python code.
|
|
57
|
+
|
|
58
|
+
### Claim
|
|
59
|
+
|
|
60
|
+
A claim can be thought of as a simple sentence: It (normally) has a subject, a
|
|
61
|
+
verb, and an object. For example, "John loves Mary", "Peter is 28 years old",
|
|
62
|
+
or "Paul knows that [John loves Mary]".
|
|
63
|
+
|
|
64
|
+
A subject is either another claim, or NULL. The latter is only possible when
|
|
65
|
+
the verb is a special builtin one called `ROOT`. Root claims have no subject
|
|
66
|
+
and have their name as their object. They represent any kind of entity.
|
|
67
|
+
|
|
68
|
+
Now that we bootstrapped the world with root claims, we can talk about other
|
|
69
|
+
types of claims: They (non-root claims) always have a subject claim (which can
|
|
70
|
+
be, but doesn't have to be a root claim), a verb, and an object. The object can
|
|
71
|
+
either be another claim (when the verb has the data type `directed_link` or
|
|
72
|
+
`undirected_link`) or some atomic value (e.g. a number, a string, a date, ...).
|
|
73
|
+
|
|
74
|
+
### Verb
|
|
75
|
+
|
|
76
|
+
A verb has a similar function as it does in human language. You might also call
|
|
77
|
+
it a property or a predicate. A verb always has a label (what it's called, e.g.
|
|
78
|
+
`"loves"`), and a data type (see below). There's also a few built-in verbs that
|
|
79
|
+
get special treatment:
|
|
80
|
+
|
|
81
|
+
- `ROOT` (as described above)
|
|
82
|
+
- `IS_A`: They have the data type `directed_link` and describe an is-a
|
|
83
|
+
relation. You could for example create a root fact called `"human"` and link
|
|
84
|
+
all people you create to it. There's special UI treatment for this relation
|
|
85
|
+
(it's displayed in the heading of the claim detail view). A claim can have
|
|
86
|
+
several `IS_A` links.
|
|
87
|
+
- `VALID_FROM` and `VALID_UNTIL`: They have the data type `date` and describe
|
|
88
|
+
that a fact is only valid before or after a certain date. Invalid facts are
|
|
89
|
+
visible as such in the frontend.
|
|
90
|
+
- `AVATAR`: A special field of type `picture` that will be used as the avatar
|
|
91
|
+
for facts in their detail view and almost all other references to it.
|
|
92
|
+
- `COMMENT`: A regular `text` verb, except with special UI support.
|
|
93
|
+
|
|
94
|
+
### Data type
|
|
95
|
+
|
|
96
|
+
A data type describes what kind of object a claim of a certain verb can take.
|
|
97
|
+
Notable data types are:
|
|
98
|
+
|
|
99
|
+
- `directed_link`: This represents a regular link or transitive verb, e.g.
|
|
100
|
+
`"loves"`, `"is child of"`, etc.
|
|
101
|
+
- `undirected_link`: These represent relationships that are by their nature
|
|
102
|
+
undirected. You could use this for `"friend of"`, `"partner of"`, `"works
|
|
103
|
+
with"`, or similar verbs, if you assume/model that this is never one-sided.
|
|
104
|
+
- `string`, `number`, `text`, `boolean`: As you might expect, these are fairly
|
|
105
|
+
straightforward. Booleans get a checkbox as an input, string and text differ
|
|
106
|
+
by the size of their input controls (regular input vs. textarea).
|
|
107
|
+
- `date`: Dates get special treatment in Véronique: You should enter them as
|
|
108
|
+
`%Y-%m-%d` ISO timestamps, _but_ you are allowed to replace any digit with a
|
|
109
|
+
question mark. This allows you to represent dates such as "some time in
|
|
110
|
+
1973" or "26th of July, but I don't know which year", which can be common
|
|
111
|
+
when entering data without full knowledge of the truth.
|
|
112
|
+
- `inferred`: This is a special type for which you can't create any actual
|
|
113
|
+
claims. Instead, you need to define a set of rules by which this claim will
|
|
114
|
+
automatically be shown on claim detail pages. As this sounds pretty abstract,
|
|
115
|
+
here's an example: If you have a "child of" claim, you could create a
|
|
116
|
+
"sibling" claim based on the fact that siblings always have a shared parent.
|
|
117
|
+
|
|
118
|
+
### Users
|
|
119
|
+
|
|
120
|
+
Véronique now has basic support for additional users. Non-admin users can by
|
|
121
|
+
default only see claims of a built-in type (e.g., root claims, labels,
|
|
122
|
+
category, ...).
|
|
123
|
+
|
|
124
|
+
You can then allow reading of other verbs per user, and also give _write_
|
|
125
|
+
access to certain verbs. Non-admin users can only create claims of those verbs
|
|
126
|
+
then, and can only edit claims they themselves have created.
|
|
127
|
+
|
|
128
|
+
Users can also be allowed to see a set of allowed queries. Pretty much anything
|
|
129
|
+
else is forbidden.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Véronique
|
|
2
|
+
|
|
3
|
+
_A small database for storing entities, links between them and simple
|
|
4
|
+
properties (e.g. text, color, numbers)._
|
|
5
|
+
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
Intended as a private social network/people database to help with memorizing
|
|
9
|
+
facts about people, but there's not really any features specific to that.
|
|
10
|
+
|
|
11
|
+
This is meant as a personal, intentionally non-scalable tool. As such, it uses
|
|
12
|
+
SQLite, and there's no proper packaging yet (mostly because it's not needed).
|
|
13
|
+
The app is protected from unauthenticated access, but beyond that there's no
|
|
14
|
+
protection against e.g. XSS. This is a feature, you can put HTML into text
|
|
15
|
+
fields for example. If you need SSO, MFA, or any other similar features, use a
|
|
16
|
+
different tool.
|
|
17
|
+
|
|
18
|
+
## Development
|
|
19
|
+
|
|
20
|
+
- Clone the repo
|
|
21
|
+
- Install `sanic`, `phonenumber`, and `markdown-it-py[linkify]` (to a venv)
|
|
22
|
+
- _Either_: Place a file called `veronique_initial_pw` containing a password in
|
|
23
|
+
the working directory. This will be the password of the `admin` user.
|
|
24
|
+
- _Or_: Run `python -m veronique.bootstrap` to fill the database with testing
|
|
25
|
+
data. The password of the admin user will be "admin". **This irrevocably
|
|
26
|
+
overwrites any existing db you may have.**
|
|
27
|
+
- Run `sanic veronique:app --dev`
|
|
28
|
+
|
|
29
|
+
## Deployment
|
|
30
|
+
|
|
31
|
+
Running in production mostly means removing the `--dev` flag. Maybe set up a
|
|
32
|
+
systemd service for it and point a reverse proxy at it or something. I
|
|
33
|
+
personally [use
|
|
34
|
+
ansible](https://github.com/L3viathan/ansibly/blob/master/roles/mainserver/tasks/veronique.yml)
|
|
35
|
+
for deploying new versions.
|
|
36
|
+
|
|
37
|
+
Missing migrations are automatically applied when restarting the app.
|
|
38
|
+
|
|
39
|
+
## Concepts
|
|
40
|
+
|
|
41
|
+
The database starts mostly empty, only a few internal verbs are added during
|
|
42
|
+
the initial migration. There's also a fixed list of _data types_, since they
|
|
43
|
+
need supporting Python code.
|
|
44
|
+
|
|
45
|
+
### Claim
|
|
46
|
+
|
|
47
|
+
A claim can be thought of as a simple sentence: It (normally) has a subject, a
|
|
48
|
+
verb, and an object. For example, "John loves Mary", "Peter is 28 years old",
|
|
49
|
+
or "Paul knows that [John loves Mary]".
|
|
50
|
+
|
|
51
|
+
A subject is either another claim, or NULL. The latter is only possible when
|
|
52
|
+
the verb is a special builtin one called `ROOT`. Root claims have no subject
|
|
53
|
+
and have their name as their object. They represent any kind of entity.
|
|
54
|
+
|
|
55
|
+
Now that we bootstrapped the world with root claims, we can talk about other
|
|
56
|
+
types of claims: They (non-root claims) always have a subject claim (which can
|
|
57
|
+
be, but doesn't have to be a root claim), a verb, and an object. The object can
|
|
58
|
+
either be another claim (when the verb has the data type `directed_link` or
|
|
59
|
+
`undirected_link`) or some atomic value (e.g. a number, a string, a date, ...).
|
|
60
|
+
|
|
61
|
+
### Verb
|
|
62
|
+
|
|
63
|
+
A verb has a similar function as it does in human language. You might also call
|
|
64
|
+
it a property or a predicate. A verb always has a label (what it's called, e.g.
|
|
65
|
+
`"loves"`), and a data type (see below). There's also a few built-in verbs that
|
|
66
|
+
get special treatment:
|
|
67
|
+
|
|
68
|
+
- `ROOT` (as described above)
|
|
69
|
+
- `IS_A`: They have the data type `directed_link` and describe an is-a
|
|
70
|
+
relation. You could for example create a root fact called `"human"` and link
|
|
71
|
+
all people you create to it. There's special UI treatment for this relation
|
|
72
|
+
(it's displayed in the heading of the claim detail view). A claim can have
|
|
73
|
+
several `IS_A` links.
|
|
74
|
+
- `VALID_FROM` and `VALID_UNTIL`: They have the data type `date` and describe
|
|
75
|
+
that a fact is only valid before or after a certain date. Invalid facts are
|
|
76
|
+
visible as such in the frontend.
|
|
77
|
+
- `AVATAR`: A special field of type `picture` that will be used as the avatar
|
|
78
|
+
for facts in their detail view and almost all other references to it.
|
|
79
|
+
- `COMMENT`: A regular `text` verb, except with special UI support.
|
|
80
|
+
|
|
81
|
+
### Data type
|
|
82
|
+
|
|
83
|
+
A data type describes what kind of object a claim of a certain verb can take.
|
|
84
|
+
Notable data types are:
|
|
85
|
+
|
|
86
|
+
- `directed_link`: This represents a regular link or transitive verb, e.g.
|
|
87
|
+
`"loves"`, `"is child of"`, etc.
|
|
88
|
+
- `undirected_link`: These represent relationships that are by their nature
|
|
89
|
+
undirected. You could use this for `"friend of"`, `"partner of"`, `"works
|
|
90
|
+
with"`, or similar verbs, if you assume/model that this is never one-sided.
|
|
91
|
+
- `string`, `number`, `text`, `boolean`: As you might expect, these are fairly
|
|
92
|
+
straightforward. Booleans get a checkbox as an input, string and text differ
|
|
93
|
+
by the size of their input controls (regular input vs. textarea).
|
|
94
|
+
- `date`: Dates get special treatment in Véronique: You should enter them as
|
|
95
|
+
`%Y-%m-%d` ISO timestamps, _but_ you are allowed to replace any digit with a
|
|
96
|
+
question mark. This allows you to represent dates such as "some time in
|
|
97
|
+
1973" or "26th of July, but I don't know which year", which can be common
|
|
98
|
+
when entering data without full knowledge of the truth.
|
|
99
|
+
- `inferred`: This is a special type for which you can't create any actual
|
|
100
|
+
claims. Instead, you need to define a set of rules by which this claim will
|
|
101
|
+
automatically be shown on claim detail pages. As this sounds pretty abstract,
|
|
102
|
+
here's an example: If you have a "child of" claim, you could create a
|
|
103
|
+
"sibling" claim based on the fact that siblings always have a shared parent.
|
|
104
|
+
|
|
105
|
+
### Users
|
|
106
|
+
|
|
107
|
+
Véronique now has basic support for additional users. Non-admin users can by
|
|
108
|
+
default only see claims of a built-in type (e.g., root claims, labels,
|
|
109
|
+
category, ...).
|
|
110
|
+
|
|
111
|
+
You can then allow reading of other verbs per user, and also give _write_
|
|
112
|
+
access to certain verbs. Non-admin users can only create claims of those verbs
|
|
113
|
+
then, and can only edit claims they themselves have created.
|
|
114
|
+
|
|
115
|
+
Users can also be allowed to see a set of allowed queries. Pretty much anything
|
|
116
|
+
else is forbidden.
|
|
Binary file
|