seren-kitchen 0.5.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.
- seren_kitchen-0.5.0/DESIGN.md +129 -0
- seren_kitchen-0.5.0/PKG-INFO +114 -0
- seren_kitchen-0.5.0/README.md +92 -0
- seren_kitchen-0.5.0/pyproject.toml +53 -0
- seren_kitchen-0.5.0/seren-kitchen.yaml.sample +44 -0
- seren_kitchen-0.5.0/seren_kitchen/__init__.py +25 -0
- seren_kitchen-0.5.0/seren_kitchen/__main__.py +51 -0
- seren_kitchen-0.5.0/seren_kitchen/_constellation.py +37 -0
- seren_kitchen-0.5.0/seren_kitchen/_describe.py +40 -0
- seren_kitchen-0.5.0/seren_kitchen/_diag.py +18 -0
- seren_kitchen-0.5.0/seren_kitchen/_version.py +24 -0
- seren_kitchen-0.5.0/seren_kitchen/app.py +486 -0
- seren_kitchen-0.5.0/seren_kitchen/config.py +212 -0
- seren_kitchen-0.5.0/seren_kitchen/freezer.py +192 -0
- seren_kitchen-0.5.0/seren_kitchen/settings.py +254 -0
- seren_kitchen-0.5.0/seren_kitchen/store.py +425 -0
- seren_kitchen-0.5.0/seren_kitchen/viewer/ui/body.html +151 -0
- seren_kitchen-0.5.0/seren_kitchen/viewer/ui/header_aside.html +5 -0
- seren_kitchen-0.5.0/seren_kitchen/viewer/ui/scripts.js +589 -0
- seren_kitchen-0.5.0/seren_kitchen/viewer/ui/styles.css +311 -0
- seren_kitchen-0.5.0/seren_kitchen/viewer/ui/tabs.html +5 -0
- seren_kitchen-0.5.0/seren_kitchen.egg-info/PKG-INFO +114 -0
- seren_kitchen-0.5.0/seren_kitchen.egg-info/SOURCES.txt +34 -0
- seren_kitchen-0.5.0/seren_kitchen.egg-info/dependency_links.txt +1 -0
- seren_kitchen-0.5.0/seren_kitchen.egg-info/entry_points.txt +2 -0
- seren_kitchen-0.5.0/seren_kitchen.egg-info/requires.txt +10 -0
- seren_kitchen-0.5.0/seren_kitchen.egg-info/scm_file_list.json +29 -0
- seren_kitchen-0.5.0/seren_kitchen.egg-info/scm_version.json +8 -0
- seren_kitchen-0.5.0/seren_kitchen.egg-info/top_level.txt +1 -0
- seren_kitchen-0.5.0/setup.cfg +4 -0
- seren_kitchen-0.5.0/tests/conftest.py +8 -0
- seren_kitchen-0.5.0/tests/test_app.py +183 -0
- seren_kitchen-0.5.0/tests/test_art.py +65 -0
- seren_kitchen-0.5.0/tests/test_freezer.py +97 -0
- seren_kitchen-0.5.0/tests/test_settings.py +95 -0
- seren_kitchen-0.5.0/tests/test_store.py +166 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Why the kitchen is the way it is
|
|
2
|
+
|
|
3
|
+
Reasons, not rules. Each of these is a decision that could have gone another
|
|
4
|
+
way and went this way for a reason. If you change one, change it knowing what
|
|
5
|
+
it was for.
|
|
6
|
+
|
|
7
|
+
## The metaphor is the information architecture
|
|
8
|
+
|
|
9
|
+
- **One big fridge, little fridges as polaroids.** The landing is one fridge
|
|
10
|
+
the size of the page. Each app is a polaroid taped to its door, a mini
|
|
11
|
+
fridge in the app's own colour: name, version, build dot, handles, who
|
|
12
|
+
holds it, up to three tiny notes. Hover and it grows; click and it opens;
|
|
13
|
+
drag it by the tape and the wall reorders. The joke (who takes a picture
|
|
14
|
+
of a fridge and puts it on a fridge?) is also the whole glance: one page,
|
|
15
|
+
everything at once, nothing hidden behind a menu.
|
|
16
|
+
- **Each fridge wears its app's colour.** The accent is the one the app's
|
|
17
|
+
own installer card declares, so a fridge is recognisable from across the
|
|
18
|
+
room, and the page picks dark or light ink per colour by contrast rather
|
|
19
|
+
than by hand.
|
|
20
|
+
- **A freezer is about half the door.** Real fridges are. The freezer holds
|
|
21
|
+
the name, the release and build in magnet letters, and the dispenser; the
|
|
22
|
+
door holds the notes and the magnets. An empty door says EMPTY in magnet
|
|
23
|
+
letters rather than whispering it.
|
|
24
|
+
- **Magnet letters are many-coloured with a thin black edge**, like the
|
|
25
|
+
plastic ones from a bag. The release and build are read from the repo's
|
|
26
|
+
own releases and workflow runs; nothing here is typed in.
|
|
27
|
+
- **The dispenser.** An ice-maker button on the freezer polls that one
|
|
28
|
+
fridge now; the big fridge has one that polls them all. It fits the
|
|
29
|
+
object, and a person already knows what a button on a fridge does.
|
|
30
|
+
- **The leftovers are a drawer.** Everything finished goes to the bottom of
|
|
31
|
+
the fridge, closed until pulled, because what is done only grows and
|
|
32
|
+
should not crowd what is not.
|
|
33
|
+
- **No fridge open is a fridge too**: grey, door swung out, light on,
|
|
34
|
+
shelves empty, and clicking it takes you back to the wall. An empty state
|
|
35
|
+
that is also the way home.
|
|
36
|
+
|
|
37
|
+
## Sheets, not tasks
|
|
38
|
+
|
|
39
|
+
- **A sheet is a note.** A title in someone's hand, a note, and an optional
|
|
40
|
+
list. A thank-you, a drawing, a line of a song is as welcome on a door as
|
|
41
|
+
a honey-do. Only sheets with lines or choices wait on anyone.
|
|
42
|
+
- **A list is one sheet with many lines**, not many sheets. A honey-do list
|
|
43
|
+
is one piece of paper. Lines tick; a sheet of plain lines all ticked
|
|
44
|
+
finishes itself.
|
|
45
|
+
- **Choices live on a line, not on the whole sheet.** A line that ends
|
|
46
|
+
`? a | b | c` is a choice. Universal options on a note felt wrong; a line
|
|
47
|
+
with options reads the way a person writes one.
|
|
48
|
+
- **Deciding is not finishing.** Picking a choice does not send a sheet to
|
|
49
|
+
the leftovers. A sheet with choices stays where it was once they are
|
|
50
|
+
picked, for whoever picks the work up, until someone says done. Otherwise
|
|
51
|
+
a decision vanishes the moment it is made, which is exactly when it is
|
|
52
|
+
most needed.
|
|
53
|
+
- **Milk goes off.** A choice nobody has picked past the house's bar is
|
|
54
|
+
sour, and the page says so. Waiting is visible; it is never a quiet queue.
|
|
55
|
+
- **A missing title takes the first line.** Refusing a note for lacking a
|
|
56
|
+
title punishes the person who had the least to say.
|
|
57
|
+
- **Replies are sheets stuck on sheets**, drawn under the line they answer,
|
|
58
|
+
each saying who stuck it and when. A reader at nine in the morning with no
|
|
59
|
+
coffee should see what answers what without working it out.
|
|
60
|
+
- **Pictures are never shrunk** in the full view, only fitted on cards; more
|
|
61
|
+
than one makes a small gallery that turns on its own. A picture is someone
|
|
62
|
+
spending time on you; it is shown at full size.
|
|
63
|
+
- **Cards are the glance; the sheet is the dialog.** A shelf shows title,
|
|
64
|
+
a line of the note, how much is left and the first picture. Click to see
|
|
65
|
+
everything. Long sheets stay short on the shelf.
|
|
66
|
+
- **Notes pile up on a door where they were left**, overlapping, newest on
|
|
67
|
+
top, shrinking a little as the pile grows. A fridge should look lived in,
|
|
68
|
+
not laid out.
|
|
69
|
+
|
|
70
|
+
## Magnets
|
|
71
|
+
|
|
72
|
+
- **A magnet is who holds a repo right now**, not a login. A session that
|
|
73
|
+
only talks needs no magnet. A magnet stays where it was left when the
|
|
74
|
+
session ends, so the next one in sees who was here, and it remembers
|
|
75
|
+
where it was before.
|
|
76
|
+
- **A magnet carries a session starter.** Click it and the text that starts
|
|
77
|
+
that partner's session is copied. The board is also the switchboard.
|
|
78
|
+
- **Pictures on magnets are each house's own.** None ship.
|
|
79
|
+
|
|
80
|
+
## Hands and names
|
|
81
|
+
|
|
82
|
+
- **Each author has their own hand.** A sheet signed by a name is drawn in
|
|
83
|
+
that person's font; everyone else writes in the house hand. Handwriting
|
|
84
|
+
tells you who is talking before you read a word.
|
|
85
|
+
- **Fonts are files on the box, never in the package.** A display face is
|
|
86
|
+
whatever the house holds a licence for; a hand is whoever lives there.
|
|
87
|
+
They are uploaded from the page and kept beside the state.
|
|
88
|
+
- **The house names its people.** The kinds are `person` and `partner`; the
|
|
89
|
+
page puts the house's own names on them. The package ships with no names
|
|
90
|
+
in it.
|
|
91
|
+
- **Tidy** is a setting: every note straight, galleries still, defaulting to
|
|
92
|
+
on when the system asks for reduced motion. A tilt is a texture, not a
|
|
93
|
+
requirement.
|
|
94
|
+
- **The hinge is a setting.** Handles on the right suit a left hand; a
|
|
95
|
+
right-handed house flips them.
|
|
96
|
+
|
|
97
|
+
## Where things live
|
|
98
|
+
|
|
99
|
+
- **One JSON file, written whole through a rename.** A kitchen holds a few
|
|
100
|
+
hundred sheets, not millions. A file a person can open, back up with `cp`
|
|
101
|
+
and read after the service is gone is worth more than a query planner,
|
|
102
|
+
and a crash mid-write leaves the old kitchen rather than a torn one.
|
|
103
|
+
- **Pictures and fonts are files beside it**, named by what they belong to,
|
|
104
|
+
and come down with it.
|
|
105
|
+
- **The yaml is what an installer can know**: where to listen, where the
|
|
106
|
+
state lives. Everything a house decides after moving in (fonts, the
|
|
107
|
+
GitHub token, which fridges, whose names, how long milk keeps) is set from
|
|
108
|
+
the page and kept in the state folder. Nobody should edit a file on a box
|
|
109
|
+
to change a colour, and a token should never be a config flag.
|
|
110
|
+
- **The GitHub token is written once and never read back out.** It is a
|
|
111
|
+
600 file in the state folder; the page says only whether one is set.
|
|
112
|
+
Without one GitHub allows 60 calls an hour and a pass costs two per
|
|
113
|
+
fridge, so the freezer defaults to an hourly pass, waits after a restart
|
|
114
|
+
when its facts are fresh, and says in words when the budget is spent and
|
|
115
|
+
when it comes back.
|
|
116
|
+
- **The kitchen never reads or writes a partner's own stores.** It is a
|
|
117
|
+
shared surface between the people of a house. What each of them remembers
|
|
118
|
+
is theirs alone.
|
|
119
|
+
- **Refusals are 400s in plain words.** The store says why; the page shows
|
|
120
|
+
it; nobody reads a stack trace to learn a title is too long.
|
|
121
|
+
- **Fonts and pictures are served without a bearer.** A stylesheet and an
|
|
122
|
+
image tag cannot send one. Everything else is guarded like the rest of
|
|
123
|
+
the family.
|
|
124
|
+
|
|
125
|
+
## Small things
|
|
126
|
+
|
|
127
|
+
- A cheese on the counter. Leave it alone.
|
|
128
|
+
- There are a few other small things in the page that nobody is told about.
|
|
129
|
+
Finding them is better than reading about them.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: seren-kitchen
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: The kitchen: a fridge per Seren app, magnets for whoever holds it, and the notes we leave each other.
|
|
5
|
+
Author: Chad Roesler, Wren Marginalia
|
|
6
|
+
License-Expression: AGPL-3.0-or-later
|
|
7
|
+
Project-URL: Homepage, https://github.com/ChadRoesler/SerenKitchen
|
|
8
|
+
Project-URL: Repository, https://github.com/ChadRoesler/SerenKitchen
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/ChadRoesler/SerenKitchen/issues
|
|
10
|
+
Keywords: seren,fridge,notes,board,fastapi,viewer
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: fastapi>=0.110
|
|
14
|
+
Requires-Dist: uvicorn[standard]>=0.27
|
|
15
|
+
Requires-Dist: pyyaml>=6.0
|
|
16
|
+
Requires-Dist: httpx>=0.27
|
|
17
|
+
Requires-Dist: seren-meninges<7,>=6.0.0
|
|
18
|
+
Requires-Dist: seren-sinew<6,>=5.7.0
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
21
|
+
Requires-Dist: anyio>=4.0; extra == "dev"
|
|
22
|
+
|
|
23
|
+
# seren-kitchen
|
|
24
|
+
|
|
25
|
+
The kitchen: a fridge per Seren app, magnets for whoever holds it, and the notes
|
|
26
|
+
we leave each other. Part of [Seren](https://github.com/ChadRoesler).
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
pip install seren-kitchen
|
|
30
|
+
seren-kitchen # http://127.0.0.1:7431/viewer
|
|
31
|
+
seren-kitchen --describe # its identity card, stdlib only
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## What is on the wall
|
|
35
|
+
|
|
36
|
+
**Fridges.** One per app, each in the colour its own Starwright card declares.
|
|
37
|
+
The wall starts as the whole family; the yaml adds, drops or recolours. The
|
|
38
|
+
freezer shows *facts* (latest release, build) that whoever knows sets with
|
|
39
|
+
`POST /api/fridges/{name}/facts`; the kitchen looks nothing up itself.
|
|
40
|
+
|
|
41
|
+
**Magnets.** One per partner: their picture (a data URL they provide; none ship),
|
|
42
|
+
the text that starts their session (click the magnet to copy it), and the fridge
|
|
43
|
+
they are stuck to. A magnet on a fridge is who holds that repo right now. It stays
|
|
44
|
+
where it was left when the session ends, and remembers where it was before.
|
|
45
|
+
|
|
46
|
+
**Sheets.** A sheet is one piece of paper: a title in someone's hand and lines
|
|
47
|
+
under it that can be ticked. A list is one sheet with many lines; a thought is a
|
|
48
|
+
sheet with one. Its kind says where it sits:
|
|
49
|
+
|
|
50
|
+
| kind | sits on | what it is |
|
|
51
|
+
|------------|--------------|---------------------------------------------------|
|
|
52
|
+
| `now` | the door | honey-do now |
|
|
53
|
+
| `list` | the shelf | honey-do list |
|
|
54
|
+
| `person` | the door | a note to the person of the house (`house.person` names them) |
|
|
55
|
+
| `other` | the door | a note to the partner (`house.partner` names them) |
|
|
56
|
+
| `self` | the door | a note to self |
|
|
57
|
+
| `art` | the crisper | a picture, a sketch, a link to one |
|
|
58
|
+
| `decision` | the door | options and a pick; unpicked past `sour_after_days` it goes sour |
|
|
59
|
+
|
|
60
|
+
Every line ticked, or `done`, moves a sheet to the **leftovers**. A pick
|
|
61
|
+
finishes a decision. `DELETE` takes a sheet off the fridge for good.
|
|
62
|
+
|
|
63
|
+
## The API
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
GET /api/kitchen the wall: fridges, magnets, the sheets on the doors
|
|
67
|
+
GET /api/fridges/{name} one fridge opened: door, shelf, crisper, leftovers, magnets
|
|
68
|
+
POST /api/fridges/{name}/facts {"release": "5.6.1", "build": "ok"}; null forgets a key
|
|
69
|
+
POST /api/fridges/{name}/sheets {"kind", "title", "lines": [], "author", "pin", "options": []}
|
|
70
|
+
GET /api/sheets?fridge=&kind=&place=&author=&open=true
|
|
71
|
+
GET /api/sheets/{id}
|
|
72
|
+
PATCH /api/sheets/{id} title | lines | add_lines | tick | untick | place | x | y | rot | pin | fridge | done | pick
|
|
73
|
+
DELETE /api/sheets/{id}
|
|
74
|
+
GET /api/magnets
|
|
75
|
+
POST /api/magnets {"partner", "starter", "picture"}
|
|
76
|
+
POST /api/magnets/{partner}/stick {"fridge": "seren-memory" | null, "x", "y"}
|
|
77
|
+
DELETE /api/magnets/{partner}
|
|
78
|
+
POST /api/sheets/{id}/reply {"kind", "title", "lines", "author", "line"}: a sheet stuck on a sheet
|
|
79
|
+
POST /api/sheets/{id}/art the request body IS the picture (image/png, jpeg, gif or webp; 8 MB at most)
|
|
80
|
+
GET /api/art/{file} a sheet's picture, public (an <img> cannot send a bearer)
|
|
81
|
+
POST /api/freezer/refresh read GitHub for every fridge now
|
|
82
|
+
GET /api/fonts/{name|freezer|hand} the configured font file, public (a stylesheet cannot send a bearer)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Pictures live as files in `<state_dir>/art/`, one per sheet, and come down with
|
|
86
|
+
the sheet. The freezer (`github:` in the yaml) reads each fridge's latest release
|
|
87
|
+
or tag and the last workflow run's conclusion, once an hour unauthenticated; a
|
|
88
|
+
token named by `github.token_env` lifts GitHub's ceiling.
|
|
89
|
+
|
|
90
|
+
A refusal is a `400` with the reason in plain words. Writes are guarded by the
|
|
91
|
+
bearer like the rest of the family; loopback with no token is open, and a wider
|
|
92
|
+
bind without one is refused at startup.
|
|
93
|
+
|
|
94
|
+
## Configuration
|
|
95
|
+
|
|
96
|
+
`--config`, then `$SEREN_KITCHEN_CONFIG`, then `~/seren-kitchen/seren-kitchen.yaml`.
|
|
97
|
+
See `seren-kitchen.yaml.sample`. The state is one JSON file, `kitchen.json`, in
|
|
98
|
+
`state_dir`, written whole and atomically; back it up with `cp`.
|
|
99
|
+
|
|
100
|
+
Fonts are paths on the box, never shipped: `fonts.name` (the repo name on the
|
|
101
|
+
freezer), `fonts.freezer` (the facts), `fonts.hand` (the notes), and
|
|
102
|
+
`fonts.hands` (one hand per author: a sheet signed by that name is drawn in
|
|
103
|
+
that font). Unset, the page falls back to system fonts. `house.person` and
|
|
104
|
+
`house.partner` are the names the page puts on "to the person" and "to the
|
|
105
|
+
partner".
|
|
106
|
+
|
|
107
|
+
## Why it is the way it is
|
|
108
|
+
|
|
109
|
+
`DESIGN.md` beside this file holds the reasons behind the kitchen's shape:
|
|
110
|
+
what each decision was for, so a change can be made knowing what it undoes.
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
AGPL-3.0-or-later.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# seren-kitchen
|
|
2
|
+
|
|
3
|
+
The kitchen: a fridge per Seren app, magnets for whoever holds it, and the notes
|
|
4
|
+
we leave each other. Part of [Seren](https://github.com/ChadRoesler).
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
pip install seren-kitchen
|
|
8
|
+
seren-kitchen # http://127.0.0.1:7431/viewer
|
|
9
|
+
seren-kitchen --describe # its identity card, stdlib only
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## What is on the wall
|
|
13
|
+
|
|
14
|
+
**Fridges.** One per app, each in the colour its own Starwright card declares.
|
|
15
|
+
The wall starts as the whole family; the yaml adds, drops or recolours. The
|
|
16
|
+
freezer shows *facts* (latest release, build) that whoever knows sets with
|
|
17
|
+
`POST /api/fridges/{name}/facts`; the kitchen looks nothing up itself.
|
|
18
|
+
|
|
19
|
+
**Magnets.** One per partner: their picture (a data URL they provide; none ship),
|
|
20
|
+
the text that starts their session (click the magnet to copy it), and the fridge
|
|
21
|
+
they are stuck to. A magnet on a fridge is who holds that repo right now. It stays
|
|
22
|
+
where it was left when the session ends, and remembers where it was before.
|
|
23
|
+
|
|
24
|
+
**Sheets.** A sheet is one piece of paper: a title in someone's hand and lines
|
|
25
|
+
under it that can be ticked. A list is one sheet with many lines; a thought is a
|
|
26
|
+
sheet with one. Its kind says where it sits:
|
|
27
|
+
|
|
28
|
+
| kind | sits on | what it is |
|
|
29
|
+
|------------|--------------|---------------------------------------------------|
|
|
30
|
+
| `now` | the door | honey-do now |
|
|
31
|
+
| `list` | the shelf | honey-do list |
|
|
32
|
+
| `person` | the door | a note to the person of the house (`house.person` names them) |
|
|
33
|
+
| `other` | the door | a note to the partner (`house.partner` names them) |
|
|
34
|
+
| `self` | the door | a note to self |
|
|
35
|
+
| `art` | the crisper | a picture, a sketch, a link to one |
|
|
36
|
+
| `decision` | the door | options and a pick; unpicked past `sour_after_days` it goes sour |
|
|
37
|
+
|
|
38
|
+
Every line ticked, or `done`, moves a sheet to the **leftovers**. A pick
|
|
39
|
+
finishes a decision. `DELETE` takes a sheet off the fridge for good.
|
|
40
|
+
|
|
41
|
+
## The API
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
GET /api/kitchen the wall: fridges, magnets, the sheets on the doors
|
|
45
|
+
GET /api/fridges/{name} one fridge opened: door, shelf, crisper, leftovers, magnets
|
|
46
|
+
POST /api/fridges/{name}/facts {"release": "5.6.1", "build": "ok"}; null forgets a key
|
|
47
|
+
POST /api/fridges/{name}/sheets {"kind", "title", "lines": [], "author", "pin", "options": []}
|
|
48
|
+
GET /api/sheets?fridge=&kind=&place=&author=&open=true
|
|
49
|
+
GET /api/sheets/{id}
|
|
50
|
+
PATCH /api/sheets/{id} title | lines | add_lines | tick | untick | place | x | y | rot | pin | fridge | done | pick
|
|
51
|
+
DELETE /api/sheets/{id}
|
|
52
|
+
GET /api/magnets
|
|
53
|
+
POST /api/magnets {"partner", "starter", "picture"}
|
|
54
|
+
POST /api/magnets/{partner}/stick {"fridge": "seren-memory" | null, "x", "y"}
|
|
55
|
+
DELETE /api/magnets/{partner}
|
|
56
|
+
POST /api/sheets/{id}/reply {"kind", "title", "lines", "author", "line"}: a sheet stuck on a sheet
|
|
57
|
+
POST /api/sheets/{id}/art the request body IS the picture (image/png, jpeg, gif or webp; 8 MB at most)
|
|
58
|
+
GET /api/art/{file} a sheet's picture, public (an <img> cannot send a bearer)
|
|
59
|
+
POST /api/freezer/refresh read GitHub for every fridge now
|
|
60
|
+
GET /api/fonts/{name|freezer|hand} the configured font file, public (a stylesheet cannot send a bearer)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Pictures live as files in `<state_dir>/art/`, one per sheet, and come down with
|
|
64
|
+
the sheet. The freezer (`github:` in the yaml) reads each fridge's latest release
|
|
65
|
+
or tag and the last workflow run's conclusion, once an hour unauthenticated; a
|
|
66
|
+
token named by `github.token_env` lifts GitHub's ceiling.
|
|
67
|
+
|
|
68
|
+
A refusal is a `400` with the reason in plain words. Writes are guarded by the
|
|
69
|
+
bearer like the rest of the family; loopback with no token is open, and a wider
|
|
70
|
+
bind without one is refused at startup.
|
|
71
|
+
|
|
72
|
+
## Configuration
|
|
73
|
+
|
|
74
|
+
`--config`, then `$SEREN_KITCHEN_CONFIG`, then `~/seren-kitchen/seren-kitchen.yaml`.
|
|
75
|
+
See `seren-kitchen.yaml.sample`. The state is one JSON file, `kitchen.json`, in
|
|
76
|
+
`state_dir`, written whole and atomically; back it up with `cp`.
|
|
77
|
+
|
|
78
|
+
Fonts are paths on the box, never shipped: `fonts.name` (the repo name on the
|
|
79
|
+
freezer), `fonts.freezer` (the facts), `fonts.hand` (the notes), and
|
|
80
|
+
`fonts.hands` (one hand per author: a sheet signed by that name is drawn in
|
|
81
|
+
that font). Unset, the page falls back to system fonts. `house.person` and
|
|
82
|
+
`house.partner` are the names the page puts on "to the person" and "to the
|
|
83
|
+
partner".
|
|
84
|
+
|
|
85
|
+
## Why it is the way it is
|
|
86
|
+
|
|
87
|
+
`DESIGN.md` beside this file holds the reasons behind the kitchen's shape:
|
|
88
|
+
what each decision was for, so a change can be made knowing what it undoes.
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
AGPL-3.0-or-later.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "setuptools-scm>=8", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "seren-kitchen"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "The kitchen: a fridge per Seren app, magnets for whoever holds it, and the notes we leave each other."
|
|
9
|
+
license = "AGPL-3.0-or-later"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
authors = [{ name = "Chad Roesler" }, { name = "Wren Marginalia" }]
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
keywords = ["seren", "fridge", "notes", "board", "fastapi", "viewer"]
|
|
14
|
+
dependencies = [
|
|
15
|
+
"fastapi>=0.110",
|
|
16
|
+
"uvicorn[standard]>=0.27",
|
|
17
|
+
"pyyaml>=6.0",
|
|
18
|
+
"httpx>=0.27",
|
|
19
|
+
# the shell, auth, config, update checking
|
|
20
|
+
"seren-meninges>=6.0.0,<7",
|
|
21
|
+
# the request log
|
|
22
|
+
"seren-sinew>=5.7.0,<6",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
dev = ["pytest>=8.0", "anyio>=4.0"]
|
|
27
|
+
|
|
28
|
+
[project.scripts]
|
|
29
|
+
seren-kitchen = "seren_kitchen.__main__:main"
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://github.com/ChadRoesler/SerenKitchen"
|
|
33
|
+
Repository = "https://github.com/ChadRoesler/SerenKitchen"
|
|
34
|
+
"Bug Tracker" = "https://github.com/ChadRoesler/SerenKitchen/issues"
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.packages.find]
|
|
37
|
+
where = ["."]
|
|
38
|
+
include = ["seren_kitchen*"]
|
|
39
|
+
|
|
40
|
+
# Without this the viewer's .html/.css/.js are absent from the wheel, and /viewer
|
|
41
|
+
# 500s on an installed copy while working from the checkout.
|
|
42
|
+
[tool.setuptools.package-data]
|
|
43
|
+
seren_kitchen = ["viewer/ui/*.html", "viewer/ui/*.css", "viewer/ui/*.js"]
|
|
44
|
+
|
|
45
|
+
[tool.pytest.ini_options]
|
|
46
|
+
testpaths = ["tests"]
|
|
47
|
+
|
|
48
|
+
[tool.setuptools_scm]
|
|
49
|
+
root = ".."
|
|
50
|
+
version_scheme = "release-branch-semver"
|
|
51
|
+
version_file = "seren_kitchen/_version.py"
|
|
52
|
+
tag_regex = "^v(?P<version>[0-9]+\\.[0-9]+\\.[0-9]+.*)$"
|
|
53
|
+
fallback_version = "0.0.0.dev0"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# ════════════════════════════════════════════════════════════════════════
|
|
2
|
+
# seren-kitchen.yaml - copy to ~/seren-kitchen/seren-kitchen.yaml
|
|
3
|
+
# ════════════════════════════════════════════════════════════════════════
|
|
4
|
+
|
|
5
|
+
server:
|
|
6
|
+
host: 127.0.0.1 # loopback. Wider needs a token, or the kitchen refuses to start.
|
|
7
|
+
port: 7431
|
|
8
|
+
# bearer_token_env: SEREN_KITCHEN_TOKEN
|
|
9
|
+
|
|
10
|
+
# Where the sheets, magnets and freezer facts live: one JSON file, kitchen.json.
|
|
11
|
+
# state_dir: ~/seren-kitchen/state
|
|
12
|
+
|
|
13
|
+
# Fonts are PATHS to files on this box, never shipped with the kitchen: the display
|
|
14
|
+
# faces on the freezer are whatever you hold a licence for, and the handwriting on
|
|
15
|
+
# the notes is whoever's hand lives here. Unset, the page uses system fonts.
|
|
16
|
+
# fonts:
|
|
17
|
+
# name: ~/fonts/AirConditioner.ttf # the repo name on the freezer
|
|
18
|
+
# freezer: ~/fonts/AlphaFridgeMagnets.ttf # the release and build on the freezer
|
|
19
|
+
# hand: ~/seren-kitchen/HouseHand.ttf # the notes, unless the author has a hand of their own:
|
|
20
|
+
# hands:
|
|
21
|
+
# alex: ~/seren-kitchen/AlexHand.ttf # a sheet signed "alex" is drawn in this
|
|
22
|
+
|
|
23
|
+
# Whose house this is: the names the page puts on "to the person" and "to the partner".
|
|
24
|
+
# house:
|
|
25
|
+
# person: alex
|
|
26
|
+
# partner: ada
|
|
27
|
+
|
|
28
|
+
# The wall starts as the whole Seren family, each fridge in its app's own colour.
|
|
29
|
+
# Add a fridge, recolour one, or take one down:
|
|
30
|
+
# fridges:
|
|
31
|
+
# - name: my-side-project
|
|
32
|
+
# display: Side Project
|
|
33
|
+
# group: other
|
|
34
|
+
# accent: "#7fd1c1"
|
|
35
|
+
# repo: me/side-project
|
|
36
|
+
# - name: seren-theatre
|
|
37
|
+
# accent: "#8a3a33" # a lighter wine
|
|
38
|
+
# drop: [seren-carabiner]
|
|
39
|
+
|
|
40
|
+
# A decision nobody has picked in this many days goes off like milk.
|
|
41
|
+
sour_after_days: 7
|
|
42
|
+
|
|
43
|
+
updates:
|
|
44
|
+
enabled: true
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""seren_kitchen - the kitchen.
|
|
2
|
+
|
|
3
|
+
One fridge per Seren app, in that app's own colour. On the door: a magnet for
|
|
4
|
+
whoever is holding the repo right now, and the sheets we leave each other
|
|
5
|
+
(honey-do now, a note to the person, a note to the partner, art). Inside, on the
|
|
6
|
+
shelves: the longer lists, the decisions waiting on someone, and the leftovers
|
|
7
|
+
(what got done). A decision left too long goes off like milk.
|
|
8
|
+
|
|
9
|
+
It is a shared surface, not a memory: a partner's own stores (Memory, Loci, the
|
|
10
|
+
Margin) are theirs alone, and nothing here reads or writes them. The kitchen is
|
|
11
|
+
where the people who share a house leave each other notes.
|
|
12
|
+
"""
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
try: # the setuptools-scm build artifact (gitignored); present in installed wheels
|
|
16
|
+
from ._version import version as __version__
|
|
17
|
+
except Exception: # source checkout without a build -> metadata, then dev fallback
|
|
18
|
+
try:
|
|
19
|
+
from importlib.metadata import version as _v
|
|
20
|
+
|
|
21
|
+
__version__ = _v("seren-kitchen")
|
|
22
|
+
except Exception:
|
|
23
|
+
__version__ = "0.0.0.dev0"
|
|
24
|
+
|
|
25
|
+
__all__ = ["__version__"]
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""Entry point for `python -m seren_kitchen` or the `seren-kitchen` script.
|
|
2
|
+
|
|
3
|
+
--config / -c like the rest of the family; --describe answers before anything
|
|
4
|
+
heavy is imported, so a broken install can still say its own name.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import argparse
|
|
9
|
+
import json
|
|
10
|
+
import sys
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _force_utf8_stdio() -> None:
|
|
14
|
+
for stream in (sys.stdout, sys.stderr):
|
|
15
|
+
try:
|
|
16
|
+
stream.reconfigure(encoding="utf-8") # type: ignore[union-attr]
|
|
17
|
+
except (AttributeError, ValueError):
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def main() -> None:
|
|
22
|
+
_force_utf8_stdio()
|
|
23
|
+
if "--describe" in sys.argv[1:]:
|
|
24
|
+
from ._describe import DESCRIBE
|
|
25
|
+
print(json.dumps(DESCRIBE))
|
|
26
|
+
raise SystemExit(0)
|
|
27
|
+
|
|
28
|
+
parser = argparse.ArgumentParser(prog="seren_kitchen",
|
|
29
|
+
description="SerenKitchen - a fridge per app, and the notes we leave each other.")
|
|
30
|
+
parser.add_argument("--config", "-c", default=None,
|
|
31
|
+
help="Path to seren-kitchen.yaml (default: $SEREN_KITCHEN_CONFIG, then "
|
|
32
|
+
"~/seren-kitchen/seren-kitchen.yaml, then built-in defaults).")
|
|
33
|
+
args = parser.parse_args()
|
|
34
|
+
|
|
35
|
+
import uvicorn
|
|
36
|
+
from seren_meninges.exposure import enforce_server
|
|
37
|
+
|
|
38
|
+
from ._diag import diag
|
|
39
|
+
from .app import create_app
|
|
40
|
+
from .config import load_config
|
|
41
|
+
|
|
42
|
+
cfg = load_config(args.config)
|
|
43
|
+
enforce_server(cfg.server, service="seren-kitchen", env_prefix="SEREN_KITCHEN", log=diag)
|
|
44
|
+
app = create_app(cfg)
|
|
45
|
+
diag(f"[seren-kitchen] the kitchen at http://{cfg.host}:{cfg.port}/viewer")
|
|
46
|
+
diag(f"[seren-kitchen] {len(cfg.fridges)} fridges on the wall; sheets kept in {cfg.state_path}")
|
|
47
|
+
uvicorn.run(app, host=cfg.host, port=cfg.port, log_level="info")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
if __name__ == "__main__":
|
|
51
|
+
main()
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""The family, as fridges: every Seren app with the colour its own Starwright card
|
|
2
|
+
declares (each card's `--describe`). A kitchen's yaml can
|
|
3
|
+
add fridges, drop them, or recolour one; this is what it starts with.
|
|
4
|
+
|
|
5
|
+
STDLIB ONLY: the config reads it before anything else is up.
|
|
6
|
+
"""
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
# name, display, group, accent, GitHub repo
|
|
10
|
+
CONSTELLATION = [
|
|
11
|
+
("seren-lodestar", "Lodestar", "core", "#F5D76E", "ChadRoesler/SerenLodestar"),
|
|
12
|
+
("seren-observatory", "Observatory", "core", "#f59056", "ChadRoesler/SerenObservatory"),
|
|
13
|
+
("seren-workbench", "Workbench", "core", "#afdbdb", "ChadRoesler/SerenWorkbench"),
|
|
14
|
+
("seren-memory", "Memory", "brain", "#ff6e8a", "ChadRoesler/SerenMemory"),
|
|
15
|
+
("seren-loci", "Loci", "brain", "#5bc8e8", "ChadRoesler/SerenLoci"),
|
|
16
|
+
("seren-corpus-callosum", "Corpus Callosum", "brain", "#9d7cff", "ChadRoesler/SerenCorpusCallosum"),
|
|
17
|
+
("seren-hippocampus", "Hippocampus", "brain", "#c9a0dc", "ChadRoesler/SerenHippocampus"),
|
|
18
|
+
("seren-margin", "Margin", "auxiliary", "#d1cbba", "ChadRoesler/SerenMargin"),
|
|
19
|
+
("seren-probe", "Probe", "auxiliary", "#8fffb4", "ChadRoesler/SerenProbe"),
|
|
20
|
+
("seren-theatre", "Theatre", "auxiliary", "#6d2823", "ChadRoesler/SerenTheatre"),
|
|
21
|
+
("seren-lyceum", "Lyceum", "auxiliary", "#a17056", "ChadRoesler/SerenLyceum"),
|
|
22
|
+
("seren-soma", "Soma", "auxiliary", "#8fbf88", "ChadRoesler/SerenSoma"),
|
|
23
|
+
("seren-psycheion", "Psycheion", "auxiliary", "#f2aeb1", "ChadRoesler/SerenPsycheion"),
|
|
24
|
+
# "Kitchen Repo", not "Kitchen": the room holds every fridge, this fridge holds the room's own code
|
|
25
|
+
("seren-kitchen", "Kitchen Repo", "auxiliary", "#e0514b", "ChadRoesler/SerenKitchen"),
|
|
26
|
+
("seren-symposium", "Symposium", "desktop", "#a3b18a", "ChadRoesler/SerenSymposium"),
|
|
27
|
+
("seren-carabiner", "Carabiner", "carabiners", "#2f6fb3", "ChadRoesler/SerenCarabiners"),
|
|
28
|
+
("seren-starwright", "Starwright", "installer", "#d9b382", "ChadRoesler/SerenStarwright"),
|
|
29
|
+
("seren-sinew", "Sinew", "library", "#c4c4c4", "ChadRoesler/SerenSinew"),
|
|
30
|
+
("seren-meninges", "Meninges", "library", "#b8b8c8", "ChadRoesler/SerenMeninges"),
|
|
31
|
+
# the house itself: its sheets live on the big fridge's door and freezer, not on a polaroid
|
|
32
|
+
("seren-project", "The House", "project", "#c9c2d6", ""),
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def default_fridges() -> list[dict]:
|
|
37
|
+
return [{"name": n, "display": d, "group": g, "accent": a, "repo": r} for n, d, g, a, r in CONSTELLATION]
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""SerenKitchen's identity card. STDLIB ONLY - nothing imported, nothing read.
|
|
2
|
+
|
|
3
|
+
What an INSTALLED Kitchen answers to `--describe`, so it can be compared with
|
|
4
|
+
its Starwright card once that exists. Standard library only, for the reason
|
|
5
|
+
every Seren card is: the moment you most want a thing to say its own name is
|
|
6
|
+
when its install is broken.
|
|
7
|
+
"""
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
NAME = "seren-kitchen"
|
|
11
|
+
DISPLAY = "Seren Kitchen"
|
|
12
|
+
DESCRIPTION = ("The kitchen: a fridge per Seren app, magnets for whoever holds it, "
|
|
13
|
+
"and the notes we leave each other.")
|
|
14
|
+
|
|
15
|
+
# 7431: after Probe (7430), the next free slot in the family band.
|
|
16
|
+
PORT = 7431
|
|
17
|
+
|
|
18
|
+
GROUP = "auxiliary"
|
|
19
|
+
|
|
20
|
+
# Tomato: a fridge-magnet red that no other app in the family wears.
|
|
21
|
+
ACCENT = "#e0514b"
|
|
22
|
+
|
|
23
|
+
# Nothing to install first. The freezer's facts (releases, builds) arrive over
|
|
24
|
+
# HTTP from whoever knows them; a kitchen with no fridges configured still
|
|
25
|
+
# serves its page and says so.
|
|
26
|
+
REQUIRES: tuple = ()
|
|
27
|
+
EXTRAS: tuple = ()
|
|
28
|
+
|
|
29
|
+
DESCRIBE = {
|
|
30
|
+
"schema_version": 1,
|
|
31
|
+
"name": NAME,
|
|
32
|
+
"display": DISPLAY,
|
|
33
|
+
"description": DESCRIPTION,
|
|
34
|
+
"port": PORT,
|
|
35
|
+
"group": GROUP,
|
|
36
|
+
"accent": ACCENT,
|
|
37
|
+
"package": "seren-kitchen",
|
|
38
|
+
"requires": list(REQUIRES),
|
|
39
|
+
"extras": list(EXTRAS),
|
|
40
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Startup diagnostics that survive a nulled stdout (parity with SerenTheatre's
|
|
2
|
+
and SerenMargin's _diag): `pythonw` nulls sys.stdout, and a write to a closed
|
|
3
|
+
stream would end the run. Print, but never let printing be what kills it."""
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def diag(message: str) -> None:
|
|
10
|
+
for stream in (sys.stdout, sys.stderr):
|
|
11
|
+
try:
|
|
12
|
+
if stream is None:
|
|
13
|
+
continue
|
|
14
|
+
stream.write(message + "\n")
|
|
15
|
+
stream.flush()
|
|
16
|
+
return
|
|
17
|
+
except Exception: # noqa: BLE001 - a broken stream must not be fatal
|
|
18
|
+
continue
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '0.5.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 5, 0)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = 'g26cbdea36'
|