Skip to main content

plantumlcli

PyPI PyPI - Python Version PyPI - Implementation Loc Comments

Docs Deploy Code Test Badge Creation Package Release codecov

GitHub stars GitHub forks GitHub commit activity GitHub issues GitHub pulls Contributors GitHub license

An easy-to-use plantuml cli for everyone.

Install

Install from official pypi

pip install plantumlcli

Install from source code

git clone https://github.com/HansBug/plantumlcli
cd plantumlcli && pip install .

Python 3.7+ is required, pypy is also tested to be okay.

If you need to export the diagrams to PDF format, just install like this

pip install plantumlcli[pdf]

Using with cli

Basic Usage

Show version of plantumlcli

plantumlcli -v

Show help information of plantumlcli

plantumlcli -h

Check the local plantuml environment and remote plantuml host

plantumlcli -c   # check both environments
plantumlcli -cL  # check local environment only
plantumlcli -cR  # check remote environment only

In default, no local plantuml jar can be used, the remote host is set to the official one (http://www.plantuml.com/plantuml). But don't worry, you can specify your plantuml jar file or remote host by environment variables or command lines.

plantumlcli -c                                             # local not okay, remote okay
PLANTUML_HOST=http://plantuml.example.com plantumlcli -cR  # remote okay
plantumlcli -cR -r http://plantuml.example.com             # remote okay
PLANTUML_JAR=/my/path/plantuml.jar plantumlcli -cL         # local okay
plantumlcli -cL -p /my/path/plantuml.jar                   # local okay

Build image from plantuml source code

plantumlcli source.puml                # the target image will be named as 'source.png'
plantumlcli -o image.png source.puml   # the target image will be named as 'image.png'
plantumlcli -t eps source.puml         # eps format is supported
plantumlcli source1.puml source2.puml  # 2 source codes, the images' names will be 'source1.png' and 'source2.png'
plantumlcli -o image1.png -o image2.png source1.puml source2.puml  # 2 source codes, image will be 'image1.png' and 'image2.png'

PLANTUML_JAR=/my/path/plantuml.jar plantumlcli source.puml     # use local plantuml jar to build png
PLANTUML_JAR=/my/path/plantuml.jar plantumlcli -L source.puml  # force use local plantuml jar to build png
PLANTUML_HOST=http://plantuml.example.com plantuml source.puml     # use your plantuml host to build png
PLANTUML_HOST=http://plantuml.example.com plantuml -R source.puml  # force use your plantuml host to build png

You can also get the URL address of remote plantuml (in these cases, remote plantuml will be used regardless of -L and -R commands)

plantumlcli -u helloworld.puml              # get png URL of helloworld.puml
plantumlcli -u -t eps helloworld.puml       # get eps URL of helloworld.puml
plantumlcli --homepage-url helloworld.puml  # get online editor's URL of helloworld.puml
plantumlcli -u helloworld.puml common.puml  # get png URL of the 2 puml files (one line for one URL, in order)

Using from python

You can also use plantumlcli in python source code by import

# environment variables
# PLANTUML_JAR=/path/to/plantuml.jar
# PLANTUML_HOST=https://plantuml.example.com

from pathlib import Path
from plantumlcli import LocalPlantuml, RemotePlantuml

if __name__ == "__main__":
    code = Path('source.puml').read_text()

    local = LocalPlantuml.autoload()
    print(local.dump_txt(code))  # print text graph of code
    local.dump('/my/path/source_local.png', 'png', code)  # save png to /my/path/source_local.png
    local.dump('/my/path/source_local.eps', 'eps', code)  # save eps to /my/path/source_local.eps

    remote = RemotePlantuml.autoload()
    print(remote.dump_txt(code))  # print text graph of code
    remote.dump('/my/path/source_remote.png', 'png', code)  # save png to /my/path/source_remote.png
    remote.dump('/my/path/source_remote.eps', 'eps', code)  # save eps to /my/path/source_remote.eps
    print(remote.get_url('png', code))  # get png url from remote host
    print(remote.get_homepage_url(code))  # get online editor's url from remote host

Contributing

Thank you for considering contributing to plantumlcli!

We appreciate all contributions to improve plantumlcli, both logic and system designs. Please refer to CONTRIBUTING.md for more guides.

And users can join our slack communication channel, or contact the core developer HansBug for more detailed discussion.

Links

Github: https://github.com/HansBug/plantumlcli

Documentation(just readme yet, will be written soon): https://github.com/HansBug/plantumlcli/blob/main/README.md

Issue Tracker: https://github.com/HansBug/plantumlcli/issues

Pypi: https://pypi.org/project/plantumlcli/

Test pypi(pre-released versions can be found here): https://test.pypi.org/project/plantumlcli/

Change log

Version 0.0.3

Released 2021-10-8

  • Fix the problem when using official site.
  • click version requirement changed to >= 7.0, will not conflict with other packages any more.

Version 0.0.2

Released 2020-11-30

Version 0.0.1

Released 2020-11-29

  • The first official plantumlcli version, cheers!!! :beers:

Metadata

Release files for plantumlcli 0.2.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 plantumlcli 0.2.0
File Size Uploaded
plantumlcli-0.2.0.tar.gz 36.0 kB Details

Built distribution (wheel)

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

Total release size: 74.3 kB

Release files / plantumlcli-0.2.0.tar.gz

Download URL plantumlcli-0.2.0.tar.gz
Size 36.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9944d64ad4bce3bd93255eae760761ecf1a300c247efee2d6af305cee90e36e0
BLAKE2b-256 checksum
How to use checksums
4f491f4da600a19dc4fdbb84593b847c1cb9962320db1dafe89351c6d02f9b6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / plantumlcli-0.2.0-py3-none-any.whl

Download URL plantumlcli-0.2.0-py3-none-any.whl
Size 38.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
183264ea6f8c6c07c72762e932f4e53911c13e76957d559eb8b0e0b7ffd54d43
BLAKE2b-256 checksum
How to use checksums
b0189085857f1b4aea57ee1f04670c9cfe9669f7859299cc4e087e6765e82ac6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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