skip to Main Content

I am trying to use PlantUML in my Sphinx project hosted on ReadTheDocs. I want to know how to specify the version of PlantUML to install because it’s currently installing an older version, which doesn’t have the latest PlantUML features I want.

I currently have PlantUML diagrams working by adding these to my Sphinx extensions (in conf.py):

    "sphinx.ext.graphviz",
    "sphinxcontrib.plantuml",

And I am installing PlantUML as part of my ReadTheDocs configuration (in .readthedocs.yaml):

version: 2

build:
  os: ubuntu-22.04
  tools:
    python: "3.12"

  apt_packages:
    - plantuml

sphinx:
  configuration: wiki/conf.py
  fail_on_warning: true

python:
  install:
  - requirements: wiki/requirements.txt

But when it builds on ReadTheDocs I see it’s installing PlantUML version 1.2020.2, which is quite old:

$ apt-get update --assume-yes --quiet
$ apt-get install --assume-yes --quiet -- plantuml
...
Get:46 http://archive.ubuntu.com/ubuntu jammy/universe amd64 plantuml all 1:1.2020.2+ds-1 [8035 kB]
...
Selecting previously unselected package plantuml.
Preparing to unpack .../45-plantuml_1%3a1.2020.2+ds-1_all.deb ...
Unpacking plantuml (1:1.2020.2+ds-1) ...
...
Setting up plantuml (1:1.2020.2+ds-1) ...
...
done.

2

Answers


  1. The version from Ubuntu 22.04 is the latest version of PlatUML that Read the Docs supports currently. If you need a newer version, you should consider installing it manually by following their installation guide: https://plantuml.com/starting

    Login or Signup to reply.
  2. You can create a wiki/scripts/pre_install.sh

    #!/bin/bash
    
    # Stop and exit on error
    set -euox pipefail
    
    # Check for required tools
    java -version
    dot -V
    
    # This folder is on PATH and does not require sudo
    # Download latest plantuml.jar from github
    curl -o ${READTHEDOCS_VIRTUALENV_PATH}/bin/plantuml.jar -L https://github.com/plantuml/plantuml/releases/download/v1.2024.3/plantuml-1.2024.3.jar
    # Create an executable script for plantuml
    printf '#!/bin/bashnexec java -Djava.awt.headless=true -jar ${READTHEDOCS_VIRTUALENV_PATH}/bin/plantuml.jar "$@"' > ${READTHEDOCS_VIRTUALENV_PATH}/bin/plantuml
    chmod +x ${READTHEDOCS_VIRTUALENV_PATH}/bin/plantuml
    
    # Check plantuml version
    plantuml -version
    

    and then update your .readthedocs.yaml

    version: 2
    
    build:
      os: ubuntu-22.04
      tools:
        python: "3.12"
    
      apt_packages:
        - default-jre
        - graphviz
    
      jobs:
        pre_install:
          - bash wiki/scripts/pre_install.sh
    
    sphinx:
      configuration: wiki/conf.py
      fail_on_warning: true
    
    python:
      install:
      - requirements: wiki/requirements.txt
    
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search