Terms of servers: Difference between revisions
mNo edit summary |
mNo edit summary |
||
| Line 13: | Line 13: | ||
== Code == | == Code == | ||
code tour | code tour | ||
from rich.console import Console | <pre> | ||
from rich.console import Console | |||
from rich import print | from rich import print | ||
from rich.markdown import Markdown | from rich.markdown import Markdown | ||
from rich.align import Align | from rich.align import Align | ||
from time import sleep | from time import sleep | ||
import os | import os | ||
import sys | import sys | ||
</pre> | |||
== Things we didn't end up using == | == Things we didn't end up using == | ||
Revision as of 14:29, 15 July 2025
Intro
Terms of servers is a terminal based publication that runs on a temporary, communal server called Cerealbox. Working with the server for almost a year now evoked questions around its materiality and reliability. We discuss these questions among us, the users, but also direct them towards Cerealbox itself. Terms of servers' form is malleable, it can be read in a computer shell or as printed text.
Images
Process
links to pads and wiki pages
pink postit scan
Code
code tour
from rich.console import Console from rich import print from rich.markdown import Markdown from rich.align import Align from time import sleep import os import sys
Things we didn't end up using
On our way towards the practical realization of the project we ran into multiple possible ways we could achieve presenting formatted text.
Initially we had though of using various text manipulating tools from the linux core tools:
- tr
- pr
- cut
- col
- sed
- printf
- ANSI escape codes (which make the file unreadable)
Afterwards, we ran into tpp (text presentation program), a ruby-ncurses presentation tool that works with files written with some special description synthax (ex. -title, -newpage). Tpp looked like a solution for a while, it even has the possibility to run commands! But we were having issues to make it work on Kim's computer and when you actually ran commands inside of it the output was displayed at the bottom of the file. Working with tpp looks fun but it also does not seem to be the best for large quantities of text.(as presentation files become unreadable)
At the same time of this discovery, Joseph mentioned urwid, a python console user interface library for unix-like OSses. It allows for many possiblities like widgets for building custom TUI, animations, style support, but we also were struggling with making sense of the documentation.
Xdotool is an automation tool that allows for keyboard automation and more, at some point we were thinking of making a script that would open tpp presentations and send keyboard input every x seconds to cycle through them, the files would then be intermitted by linux commands. We did not settle for something too far from this in terms of logic, but we dropped this idea since xdotool works only with a desktop environment.
After some time thinking of how we might solve this, Joseph came up with another recommendation: a python library called pyboxen. Pyboxen is built on top of another library called rich (the one that we ended up using) and it is a python port of another popular npm library called boxen. It allows to make boxes, titles, and controlled formatting. We found out we did not need that much and so we started to look into rich (that also allows for less costumizable boxed frames btw).
Michael helped us writing what is now the final code, he was suggesting to look into textualize, another library from the same creator of rich, but in the end we had what we need and textualize was adding another (interesting) layer of abstraction we needed to wrap our head around in a very limited amount of time.
At some point it really helped sitting down and listing our essentials for this project, we needed a way to format text, but to also run both linux commands and custom bash scripts. We then decided to settle for python and both the rich and os library.
ncurses, tpp, urwid, pyboxen, xdotool, textualize
printing stack
What's next
We are interested in understanding how can we distribute this publication inside of the terminal, independently from when we first made it public at the Telecom Museum Rotterdam, the following is a list of open possibilities:
- uv, pip
we could package the project and then have people install it via pip install
- telnet
- ssh guest user
we could host a server on our own and set a guest user with no sudo rights open a process on connection that would read the publication. (eg. arthur @ beubeu)