[catsoop-dev] Docs and version support

Madison K Landry almonds at mit.edu
Fri Jun 14 23:21:33 EDT 2024


Hi friends,

Attached is one diff for the docs (server-docs.patch), one for the 
actual catsoop repo (tagtype-parser.patch).

The docs one adjusts the example nginx configuration (`location 
/catsoop`) to match the surrounding documentation that seems to use 
`/cat-soop` to a much greater extent.  The patch also adds some 
additional info about the serving static files configuration that I was 
personally confused by a couple years ago.

For the second diff, is catsoop still supporting 3.8 as the minimum 
version?  In language.py, there is a use of `removeprefix` (a str method 
introduced in 3.9).  It seems related to the new tag names in 19.0 
(e.g., <catsoop-section>).  Anyway, the patch replaces the use of 
`removeprefix` with 3.8-friendly code, and I do not notice other 
3.8-related issues with that fix.

Happy to hear your thoughts.

Best
/ Maddie
-------------- next part --------------
# HG changeset patch
# User Madison Landry <almonds at mit.edu>
# Date 1718419755 14400
#      Fri Jun 14 22:49:15 2024 -0400
# Node ID 9c34e4c942f25bb502e25e818b6e5fd0038ec2f1
# Parent  dd22b14a8fe3a84f93e16961bf9670cbec3913d3
update Server Configuration page
* fix endpoints in nginx config (`catsoop` -> `cat-soop`) to match surrounding
  documentation
* enhance Serve Static Files section with more details

diff -r dd22b14a8fe3 -r 9c34e4c942f2 docs/installing/server_configuration/content.catsoop
--- a/docs/installing/server_configuration/content.catsoop	Mon Feb 26 21:19:11 2024 -0500
+++ b/docs/installing/server_configuration/content.catsoop	Fri Jun 14 22:49:15 2024 -0400
@@ -96,8 +96,8 @@
     # the following will route requests to https://example.com/catsoop
     # to the uWSGI server.  change "cat-soop" in the following lines if you
     # want to use a different URL.
-    location /catsoop {
-            rewrite /catsoop/?(.*) /$1 break;
+    location /cat-soop {
+            rewrite /cat-soop/?(.*) /$1 break;
             proxy_http_version 1.1;
             proxy_set_header Upgrade $http_upgrade;
             proxy_set_header Connection 'upgrade';
@@ -188,6 +188,13 @@
         }
 ```
 
+This configuration assumes that catsoop is installed in the `catsoop` user's
+home directory, manually from the repo.  If catsoop is instead installed via
+pip inside a virtual environment (for example, Python 3.11 at `~/venv`), the
+root directives may use, e.g.,
+`/home/catsoop/venv/lib/python3.11/site-packages/catsoop/` instead of
+`/home/catsoop/catsoop/catsoop/`.
+
 <catsoop-section>(Optional) Additional Configuration</catsoop-section>
 
 <catsoop-subsection>Web Server</catsoop-subsection>
-------------- next part --------------
# HG changeset patch
# User Madison Landry <almonds at mit.edu>
# Date 1718420166 14400
#      Fri Jun 14 22:56:06 2024 -0400
# Node ID 64c0baa899300e434944ee3c5ccfe7c99910ed63
# Parent  118aecfb6aed87035631b413ac5237c237169414
better support for Python 3.8
* catsoop/language.py: replace use of `removeprefix` (PEP 616) with
  3.8-friendly code

diff -r 118aecfb6aed -r 64c0baa89930 catsoop/language.py
--- a/catsoop/language.py	Thu May 02 16:32:29 2024 -0400
+++ b/catsoop/language.py	Fri Jun 14 22:56:06 2024 -0400
@@ -862,7 +862,9 @@
     all_title_links = set()
 
     for i in tree.find_all(re.compile(section)):
-        tagtype = i.name.removeprefix("catsoop-")
+        tagtype = i.name
+        if tagtype.startswith("catsoop-"):
+            tagtype = tagtype[8:]
         if tagtype == "chapter":
             chapter = i.attrs.get("num", "0")
             tag = "h1"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x543E615FD80A35F6.asc
Type: application/pgp-keys
Size: 920 bytes
Desc: OpenPGP public key
URL: <http://mailman.mit.edu/pipermail/catsoop-dev/attachments/20240614/174e93dc/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.mit.edu/pipermail/catsoop-dev/attachments/20240614/174e93dc/attachment.sig>


More information about the catsoop-dev mailing list