Skip to main content

tgadmin

A command line tool for managing your projects in the TextGrid repository without TextGridLab.

Install

You may use this with venv or with pipx. With pipx you have the benefit of having the command available in your shell without further manual venv creation and activation.

Install pipx, e.g. on Debian/Ubuntu apt install pipx.

And add this tool from pypi.org

pipx install tgadmin
# or if uv is available (to enable managed python version)
uv tool --managed-python install tgadmin
```sh

Upgrade to a new version with

```sh
pipx upgrade tgadmin

If you do not want to use pipx have a look at the section "Development".

Usage

Export sessionID (SID)

get from https://textgridlab.org/1.0/Shibboleth.sso/Login?target=/1.0/secure/TextGrid-WebAuth.php?authZinstance=textgrid-esx2.gwdg.de

and set as env var:

export TEXTGRID_SID=your_secret_sid_here

or set with --sid for every command

Get help

tgadmin

List projects

list your projects:

tgadmin list

Create project

if there is no suitable project, create one:

tgadmin create lab-import-test-20230605

Upload an aggregation object like editons, aggregations and collections

You can upload aggregations as new textgrid objects like

tgadmin --server http://test.textgridlab.org import -p TGPR-...fe eng003.edition

this would assume that you have an file containing the aggragtion with local paths in eng003.edition and metadata description files like eng003.edition.meta. After initial uploads you find an filename.imex which has a mapping of lokal file names to textgrid URIs. This can be used to update the objects from the edition like:

tgadmin --server http://test.textgridlab.org import -i eng003.edition.imex .

BYOLR (Bring Your Own Link Rewriter ;-)

We use command line tools to rewrite links in TEI and aggregations. Our default choice is linkrewriter-cli but you are free to choose anything which implements the command line interface.

To use the link rewriter cli as native build (linux amd64 only for now):

wget https://gitlab.gwdg.de/api/v4/projects/45698/packages/generic/linkrewriter/0.1.23/linkrewriter-cli
chmod +x ./linkrewriter-cli

or on non linux-amd64 systems:

wget https://gitlab.gwdg.de/api/v4/projects/45698/packages/generic/linkrewriter/0.1.23/linkrewriter-cli.jar
echo -e '#!/bin/bash\njava -jar linkrewriter-cli.jar $@' > ./linkrewriter-cli
chmod +x ./linkrewriter-cli

If you are not on linux amd64, you may use linkrewriter with java. You may create a shell script calling java -jar linkrewriter-cli.jar $# then, or build something great with jbang.

Or if you are not happy with linkrewriter results, create a shell script, utilizing e.g. sed. Just call it linkrewriter-cli and make sure it implements the cli interface

  • -i imex_file_location
  • -c config you may ignore this
  • -b base path of xml relative to the imex file location (you may ignore this too)
  • FILENAME

Advanced Usage

You may use the development or the test instance of the TextGrid Server.

To use tgadmin with the test instance do

tgadmin --server https://test.textgridlab.org list

for the dev system there is a shortcut, you may call

tgadmin --dev list

shell completion

_TGADMIN_COMPLETE=bash_source tgadmin > tgadmin-complete.bash
. tgadmin-complete.bash

Development

clone repo

git clone https://gitlab.gwdg.de/dariah-de/textgridrep/tgadmin.git
cd tgadmin

and create venv

uv venv # or python3 -m venv .venv
source .venv/bin/activate
uv pip install --editable . # or pip install --editable .[dev]

afterwards tgadmin is in your venv as command and can be executed

tgadmin

run integration tests and check coverage

WARNING: do not provide a project ID where you have data, as objects from project may accidently get removed

export PROJECT_ID=[my-project-id]
export TEXTGRID_SID=[my-session-id]
coverage run -m pytest --junitxml=report.xml && coverage html

Contributing

Commit convention:

Style constraints:

Coding constraints:

For your convenience, pre-commit hooks are configured to check against these constraints. Provided, you have installed the development requirements (see above), activate pre-commit to run on every git commit:

pre-commit install

Badges

REUSE status PyPI

Release files for tgadmin 0.38.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tgadmin 0.38.4
File Size Uploaded
tgadmin-0.38.4.tar.gz 34.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tgadmin 0.38.4
File Interpreter ABI Platform
tgadmin-0.38.4-py3-none-any.whl Python 3 none any Details

Total release size:71.2 kB

Release files / tgadmin-0.38.4.tar.gz

Download URL tgadmin-0.38.4.tar.gz
Size 34.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a7a9ebb2c84a1c69fadecb7fa64796d9346352f528e6fdd1157fac716734aeeb
BLAKE2b-256 checksum
How to use checksums
e28daa067feb7fb207f16db4c6d11663773afba66dc09630ce1876b9d35b8af3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / tgadmin-0.38.4-py3-none-any.whl

Download URL tgadmin-0.38.4-py3-none-any.whl
Size 36.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80f9436e4a0f4790d1d1a365458b8b10db95a49015ee1cf27e658a45c8741197
BLAKE2b-256 checksum
How to use checksums
a1869ff272e8e7bec572d077579b769edae81bc1f1f2981046df84f8616d73d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.38.4 This release

2 release files

0.38.3

2 release files

0.38.2

2 release files

0.38.1

2 release files

0.38.0

2 release files

0.37.0

2 release files

0.36.5

2 release files

0.36.4

2 release files

0.36.3

2 release files

0.36.2

2 release files

0.36.1

2 release files

0.36.0

2 release files

0.35.1

2 release files

0.35.0

2 release files

0.34.0

2 release files

0.33.0

2 release files

0.32.2

2 release files

0.32.1

2 release files

0.32.0

2 release files

0.31.1

2 release files

0.30.2

2 release files

0.30.1

2 release files

0.30.0

2 release files

0.29.0

2 release files

0.28.1

2 release files

0.28.0

2 release files

0.27.1

2 release files

0.27.0

2 release files

0.26.0

2 release files

0.25.0

2 release files

0.24.0

2 release files

0.23.0

2 release files

0.22.3

2 release files

0.22.2

2 release files

0.22.1

2 release files

0.22.0

2 release files

0.21.0

2 release files

0.20.0

2 release files

0.19.0

2 release files

0.18.2

2 release files

0.18.1

2 release files

0.18.0

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.2

2 release files

0.15.1

2 release files

0.15.0

2 release files

0.14.1

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page