ScapeX — The command-line Inkscape eXporter, Makefile and LaTeX friendly
ScapeX is a Python utility that invokes Inkscape to export an SVG drawing into a single PDF file or a set of PDFs.
It is designed to export high-quality drawings, graphics, and diagrams, hence the choice of the PDF format for vector graphics.
The design of the command-line interface makes it suitable for on-the-fly usage or integration in a Makefile-based build system (e.g., for LaTeX).
In addition, thanks to its fragments export feature, this tool can be used to create animated slides (e.g., using Beamer).
Features
- Command-line interface with autocompletion
- Each figure export can be configured via a sidecar TOML file
- The
fragmentsexport mode creates multiple PDFs based on arbitrary layer combinations - Fonts rendering can be performed either by Inkscape during export or by LaTeX during compilation
- Out-of-tree export capability
Installation
The easiest way to install ScapeX is to use PipX, a Pip wrapper that automatically creates a virtual environment.
pipx install scapex
To enable Zsh autocompletion, add the following to your ~/.zshrc:
which scapex >/dev/null && fpath+=($(scapex --completions-zsh))
Restart your shell and you are ready to go!
Usage
The simplest usage is to export a single PDF file, optionally into another build directory:
scapex -o BUILD_DIRECTORY INPUT.svg
Fragments (animations)
To create animated exports, first generate a TOML configuration file for your diagram:
scapex --generate INPUT.svg
Open the file and adjust its configuration according to the layer identifiers defined in Inkscape:
vim INPUT.toml
Once ready, perform the fragments export:
scapex --fragments INPUT.svg
Interfacing with LaTeX (fonts rendering)
Fonts rendering can be delegated to LaTeX using the --fonts-engine=latex option.
This will create a .pdf_tex sidecar file to the .pdf, containing the text that will be processed by LaTeX when including the exported PDF with \input{FILE.pdf_tex}:
scapex --fonts-engine=latex INPUT.svg
Interfacing with Makefile
ScapeX can also be used inside a Makefile, enabling automatic export when a drawing is modified and proper dependency handling. See the self-documented example under examples/Makefile.
Getting help
For additional usage, see scapex -h:
usage: scapex [-h] [-v] [-o OUTPUT_DIR] [--generate]
[--fonts-engine {latex,inkscape}] [--fragments | --no-fragments]
[--completions-zsh]
[SVG_FILE]
The command-line Inkscape eXporter, Makefile and LaTeX friendly
positional arguments:
SVG_FILE Inkscape drawing in SVG format to export
options:
-h, --help show this help message and exit
-v, --verbose Increase verbosity if set
-o, --output-dir OUTPUT_DIR
Set the output directory [default = .]
--generate Generate a TOML template configuration file for input
SVG file (instead of exporting)
--fonts-engine {latex,inkscape}
Set the font rendering engine [default = inkscape]
--fragments, --no-fragments
Enable (or disable) fragments exportation (instead of
full exportation) [default = False]
--completions-zsh Print the path of the directory containing the Zsh
autocompletion script (instead of exporting)
Contributing
See CONTRIBUTING.md.
Metadata
Release files for scapex 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scapex-1.0.2.tar.gz | 22.9 kB | Without provenance | Details for scapex-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scapex-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for scapex-1.0.2-py3-none-any.whl |
Total release size: 45.9 kB
Release files / scapex-1.0.2.tar.gz
| Download URL | scapex-1.0.2.tar.gz |
|---|---|
| Size | 22.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f95b7a00dced331e04eca635ad17d97aeb7de6a298d18aafc5fce9c62b44068
|
|
BLAKE2b-256 checksum How to use checksums |
6c45c75b9dcf33f8d40eae17fe80e4a05304c17a6576adf1633487bf462dec9d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / scapex-1.0.2-py3-none-any.whl
| Download URL | scapex-1.0.2-py3-none-any.whl |
|---|---|
| Size | 23.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
07f5e16fbba2d82f1b08fd7d2bfba8a4b274225c52ba5b6cc83b9ac35bfbb8d6
|
|
BLAKE2b-256 checksum How to use checksums |
e2f1468d16300cf25252b3b6dd52282ff1dcd84af2188e8328e8354aa5addf20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for scapex 1.0.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.