saktumiva2-editor

Saktumiva editor

New to Saktumiva, TEI or GitHub? Start with the tutorial.

A local editing screen for critical editions in TEI, collated with Charles Li’s Saktumiva v.2. Saktumiva’s own collation code runs in the background; your decisions are written straight back into the TEI files. Everything runs on your own computer. The only outside traffic is your browser fetching manuscript images from the archives’ IIIF servers, and “Check for updates” asking GitHub for the latest release.

It was written for the Suśrutasaṃhitā and works for any project laid out as folders of TEI files, for example the Rasendramaṅgala.

Screenshot of the editor

Install

Ready-made program (no Python needed): download the file for your computer from the latest release, unzip it and run saktumiva-editor (saktumiva-editor.exe on Windows). A terminal window opens, and the editor opens in your web browser. Close the terminal window, or press Ctrl+C in it, to stop.

With Python (3.10 or later; for Intel Macs, or if you prefer), in its own virtual environment:

python3 -m venv ~/saktumiva-editor-env
~/saktumiva-editor-env/bin/pip install git+https://github.com/sushrutaproject/saktumiva2-editor.git

Then run ~/saktumiva-editor-env/bin/saktumiva-editor in a terminal.

Updating: Help → Check for updates in the editor (or saktumiva-editor --check-updates) tells you whether there is a newer release and gives the command or download link for the way you installed it.

Start

saktumiva-editor                      # choose a project; recently used ones are listed
saktumiva-editor ~/git/Rasendramangala      # choose one of the project's sections
saktumiva-editor ~/git/Sushrutasamhita_Saktumiva2/03-su.sa   # edit that section straight away

Options: --port 8800 (the next free port is used if it is taken), --no-browser, --version. The Projects button in the editor goes back to the chooser.

Projects and sections

A section is one folder with an edition file and the witness transcriptions collated with it. The files are TEI XML; their names may end in .xml, .txt or .tei (the editor looks inside to see whether a file is TEI). A project is a folder of sections, for example a git repository with one folder per chapter. Without further instructions, any folder (the project folder itself, or one level below it) with an editor.config.json, a saktumiva.config.json or at least two TEI files is offered as a section.

The first time you open a section, the editor proposes which file is the edition (a name containing “edition”) and which are the witnesses (the other TEI files; files that already contain a Saktumiva apparatus are taken to be published output, not witnesses). Check the proposal, change it if needed, and it is saved as editor.config.json in the section folder:

A project may have a saktumiva-project.json in its top folder. Every key is optional:

{
  "name": "Rasendramaṅgala",
  "sections": ["chapter*", "commentary"],
  "fileExtensions": [".xml", ".txt"],
  "editionPattern": "provisional[-_]edition",
  "defaults": {"extraIgnoreTags": ["trailer"], "apparatus": {"normlem": true, "mergerdgs": true}}
}

sections lists the section folders (patterns allowed); editionPattern is a regular expression for recognising the edition file; defaults are settings for every section, which a section’s own editor.config.json can override.

If the section is in a git repository, every save and every Publish is a git commit. Nothing goes online until you push. Work cycle: edit → Publish → check the published file → git push.

What it does

Safety checks on every save: the file must not have been changed on disk meanwhile (e.g. in Oxygen), the result must be well-formed XML, and xml:ids must stay unique. New notes that point nowhere are reported before saving.

Not yet possible

Where the editor keeps its own files

Recent projects and computed alignments (so that each passage is collated only once) are kept outside your projects: on Linux in ~/.config/saktumiva-editor and ~/.cache/saktumiva-editor, on macOS in ~/Library/Application Support/saktumiva-editor and ~/Library/Caches/saktumiva-editor, on Windows in %APPDATA%\saktumiva-editor and %LOCALAPPDATA%\saktumiva-editor\Cache. The cache is safe to delete.

Development

git clone --recurse-submodules https://github.com/sushrutaproject/saktumiva2-editor.git
cd saktumiva-editor
python -m pip install -e ".[test]"
saktumiva-editor

Tests

python -m pytest                     # the server, configuration, update check
cd tests/js && npm ci && npm test   # the collation regression tests (Node 22)

The browser tests (tests/python/test_browser_several.py: choosing several passages, the combined apparatus, going back to one passage; test_browser_restructure.py: merging and splitting passages, down to the files on disk) run with Playwright and are skipped without it: python -m pip install -e ".[test,browser]" && python -m playwright install chromium (an installed Google Chrome is used if Playwright’s own Chromium is missing).

The regression tests run the editor’s collation and apparatus code, with the pinned Saktumiva, on real sections (tests/fixtures: the Suśrutasaṃhitā Śārīrasthāna and Rasendramaṅgala chapter 1) and compare the alignments, apparatus and published <standOff> with the stored results in tests/golden. stemma.test.mjs tests the Stemma view on the NeXML of SplitsTree6, Saktumiva and Bio::Phylo (tests/fixtures/stemma and the Rasendramaṅgala fixture); nexus.test.mjs the NEXUS export (tests/fixtures/nexus), multi.test.mjs choosing several passages (app/multi.mjs), restructure.test.mjs merging and splitting passages (app/restructure.mjs). They also check that the patch still fits and still matters (switching script notes off must change the apparatus of certain passages).

Updating Saktumiva

Dependabot proposes a pull request when Saktumiva has new commits; the tests run on it.

By hand: cd src/saktumiva_editor/app/saktumiva && git fetch && git checkout <commit>, run the tests, commit.

Releasing

  1. Set __version__ in src/saktumiva_editor/__init__.py and add a section to CHANGELOG.md.
  2. Commit, then git tag v0.2.0 && git push --follow-tags.

.github/workflows/release.yml then builds the wheel and the programs for Linux, macOS and Windows, checks that each one starts, and publishes them as a GitHub Release, where Check for updates finds them.

Licence

The Saktumiva editor is free software under the GNU General Public License, version 3 (see LICENSE). Saktumiva itself is a separate project with its own terms.

Credits

Saktumiva is by Charles Li (github.com/chchch/saktumiva); it does the collation and makes the apparatus. The test fixtures come from the projects named in tests/fixtures/README.md; the Rasendramaṅgala transcriptions are licensed CC BY-SA 4.0.