Skip to main content

dsw-tdk

User Guide GitHub release (latest SemVer) PyPI Docker Pulls LICENSE CII Best Practices Python Version

Template Development Kit for Data Stewardship Wizard

Installation

Python package

You can easily install this tool using pip (from PyPI):

$ pip install dsw-tdk

Optionally, you can clone any version from this repository and install it directly:

$ git clone https://github.com/ds-wizard/dsw-tdk.git
$ pip install -e .

We recommend using virtual environments to avoid clashes in dependencies with other projects.

Dockerized tool

If you don't want to use Python directly on your machine, you can easily use Docker image with DSW TDK:

$ docker run datastewardshipwizard/dsw-tdk --help
$ docker run datastewardshipwizard/dsw-tdk:develop --help

See datastewardshipwizard/dsw-tdk on Docker Hub to check available tags.

Usage

You can find out possibilities directly using --help flag:

$ dsw-tdk --help
$ dsw-tdk put --help

For further information, visit our documentation.

Basic commands

  • new = create a new template project locally using interactive wizard
  • list = list templates available in configured DSW instance
  • get = download a template from DSW instance
  • put = upload a template to DSW instance (create or update)
  • verify = check the metadata of local template project
  • package = create a distribution ZIP package that is importable to DSW via web interface
  • pot = create a POT file with translatable strings of the local template project
  • get-context = download the document context of a project (--project UUID, optionally --event UUID) or a knowledge model editor (--km-editor UUID), as the server sends it; it prints the ETag, which is the context's hash
  • generate-context = generate plausible document contexts from a knowledge model: --sample (shipped with the TDK), --km-bundle FILE, --km-package UUID (from the server) or --from FILE (keeps its knowledge model, package, config and workspace); --profile empty|minimal|typical|full|edge (repeatable) sets how much is filled in, --count N the variants per profile, --source project|km-editor the kind of context, --seed makes the output reproducible and -D KEY=VALUE sets config values. With --from, --mutate perturbs the context at the rate of each profile and --anonymize replaces its personal data and free text with deterministic placeholders (both can be combined). Every generated context passes validate-context
  • validate-context = check document context files against the 19.0 schema and their own knowledge model (reply paths and values, files, labels, phase, version, hash); it prints errors and warnings and exits with 1 on any error, and --fix-hash rewrites a hash that does not match the content
  • render = render documents from the local template project and document contexts (no DSW instance needed)

Rendering documents locally

render uses the same engine as the DSW document worker (dsw-templating). You need a document context (metamodel 19.0) as a JSON file, from get-context or generate-context:

$ dsw-tdk render --context context.json --format "HTML Document" --output document.html
$ dsw-tdk render -c context.json -F "PDF Document" --po cs.po -l cs --project-files ./files
  • --format accepts the UUID or name of a format (it can be omitted if the template has only one)
  • The context must be a complete, valid 19.0 context; otherwise render fails with the file, the JSON path and the problem. A context whose hash does not match its content (edited by hand) is rendered with a warning
  • render fills document as the document worker would: documentTemplate (id and version from template.json) and format are always those being rendered (with a warning if the context names others); the rest is kept from the context, or, for document: null, is a preview named after the project or KM editor, without a language, created now
  • -l/--language, --preview/--final, --event UUID and --document-name NAME set document.language (and resets document.locale), preview, eventUuid and name
  • --po renders with translations from a PO file (e.g. a translated dsw-tdk pot output), in document.language; with -l, document.locale is filled for that language
  • --write-context [FILE] saves the context that was rendered (with document filled, but without what the worker adds below) to FILE, or to <output-name>.context.json; it passes validate-context
  • --project-files is a directory with files uploaded to the project, named by their UUID or file name
  • Only files selected by _tdk.files are available to the rendering, as on the server
  • The context is completed as the document worker does it with its default configuration: config gets the service name and URL of the Data Stewardship Wizard and fallbacks for missing branding (app title, colors, logo), and extras requested by the format but missing in the context are rendered as for a document without a project (with a warning)
  • The worker's defaults can be overridden with -D NAME=VALUE (repeatable), named as in the documentContext section of the document worker configuration, or with its environment variables (also in .env); the option wins over the environment:
$ dsw-tdk render -c context.json -F "HTML Document" -D "serviceName=FAIR Wizard" -D serviceUrl=https://fair-wizard.com
$ echo 'DOCUMENT_CONTEXT_SERVICE_NAME=FAIR Wizard' >> .env
Name Environment variable Default
serviceName DOCUMENT_CONTEXT_SERVICE_NAME Data Stewardship Wizard
serviceNameShort DOCUMENT_CONTEXT_SERVICE_NAME_SHORT DSW
serviceUrl DOCUMENT_CONTEXT_SERVICE_URL https://ds-wizard.org
serviceDomainName DOCUMENT_CONTEXT_SERVICE_DOMAIN_NAME ds-wizard.org
defaultPrimaryColor DOCUMENT_CONTEXT_DEFAULT_PRIMARY_COLOR #0033aa
defaultLogoUrl DOCUMENT_CONTEXT_DEFAULT_LOGO_URL {{clientUrl}}/assets/logo.svg
defaultAppTitle DOCUMENT_CONTEXT_DEFAULT_APP_TITLE DS Wizard

The service* values are always set; the default* ones apply only where the context has no value.

  • Steps weasyprint, excel and rdflib-convert, the requests global and the pandoc-docx-pagebreakpy Pandoc filter need optional dependencies: pip install 'dsw-tdk[all]'; WeasyPrint also needs Pango and the pandoc step needs pandoc installed
  • The docx-*.lua Pandoc filters of the document worker are always available; --pandoc-filters DIR adds more (searched first) and --pandoc-templates DIR provides templates for the template option of the pandoc step (or PANDOC_FILTERS / PANDOC_TEMPLATES, as for the worker)
  • The secrets and requests globals exist only when configured for the template on the server; locally, --secret NAME=VALUE (repeatable) provides secrets and --allow-requests provides requests

Rendering many documents

-c can be repeated and accepts directories (every *.json in it, sorted, not recursive); -F can be repeated, or --all-formats renders every format of the template. With more than one context × format combination, --output is a directory (default output) and each document is written as <context-name>[.<format-name>].<extension> (the format part only with more than one format):

$ dsw-tdk generate-context --sample --profile minimal --profile edge -o contexts
$ dsw-tdk render -c contexts --all-formats -o output

output/summary.json lists every combination in the order it was rendered, with context, format, status (ok or error), durationMs, output (relative to the directory) and error. The exit code is 1 if any combination failed. --write-context takes no file name here and writes <document-name>.context.json next to each document.

Environment variables

You can use the following environment variables to avoid repeating CLI options.

  • DSW_API_URL = URL of the API you want to use; since Wizard 5.0 it is the address of the instance followed by /api, e.g., https://my.fair-wizard.com/api (not the address of the client itself)
    • Used when --api-url not specified
  • DSW_API_KEY = API Key of the user authorized to manage document templates
    • Used when --api-key not specified
  • DSW_WORKSPACE = UUID of the workspace put creates a new draft in; without it the draft is created for the whole organization (in a multi-workspace instance)
    • Used when --workspace not specified

You can also use them in .env file which is automatically loaded from current directory or specify it using --dot-env option:

$ ls -a
. .. .env my-other-file
$ dsw-tdk list
$ dsw-tdk --dot-env /path/to/my/.env list

How to start

  1. Prepare your DSW instance and admin account (optionally, prepare .env file)
  2. Verify the connection by issuing dsw-tdk list
  3. Create a new template project dsw-tdk new or get existing dsw-tdk get (or re-use some local)
  4. Go to the template project and make edits you need to do
  5. Update template in DSW with dsw-tdk put (or continually with dsw-tdk put --watch)
  6. (or) Create a distribution ZIP package that is importable via DSW web interface with dsw-tdk package

Verbosity

You can use --quiet and --debug flags to toggle less or more output messages:

$ dsw-tdk --quiet list
$ dsw-tdk --debug list

Requirements

  • Python 3.12+
  • DSW instance with matching version (e.g. a local one using Docker)
  • Admin credentials (email+password) to the DSW instance

Contributing

We welcome any form of feedback and contribution to this tool:

  • Report bugs or ask in case of uncertainty using GitHub Issues.
  • Share ideas and feature requests using DSW Ideas site.
  • Submit enhancements using Pull Requests, just please make sure that you comply with used conventions.

For more information read CONTRIBUTING.

License

This project is licensed under the Apache 2 License - see the LICENSE file for more details.

Metadata

Release files for dsw-tdk 5.0.0

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

Source distribution (sdist)

Source distribution for dsw-tdk 5.0.0
File Size Uploaded Provenance Actions
dsw_tdk-5.0.0.tar.gz 113.3 kB With provenance Details for dsw_tdk-5.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dsw-tdk 5.0.0
File Interpreter ABI Platform Actions
dsw_tdk-5.0.0-py3-none-any.whl Python 3 none any Details for dsw_tdk-5.0.0-py3-none-any.whl

Total release size: 190.7 kB

Release files / dsw_tdk-5.0.0.tar.gz

Download URL dsw_tdk-5.0.0.tar.gz
Size 113.3 kB
Tags Source
SHA-256 checksum
How to use checksums
61601c3c4eb036491eca1ae443fdbec9dc2a416aeb18addb20214ca9194889a1
BLAKE2b-256 checksum
How to use checksums
fe4ad5b65b7c66efb30dbc739ba1c9327bb0f2321d4f482652a9daedb3baf1b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / dsw_tdk-5.0.0-py3-none-any.whl

Download URL dsw_tdk-5.0.0-py3-none-any.whl
Size 77.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
169b58e0891745f0c938271f65cecabd3f299dc37924adc1b920187ebc87cb8a
BLAKE2b-256 checksum
How to use checksums
3fe66cb68984b824b9a2551684b568eb32505ac1f6450efdf8c25aa4af638829
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Security for dsw-tdk 5.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dsw_tdk-5.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

5.0.0 This release

2 release files Full provenance

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