# plantumlcli
[![PyPI](https://img.shields.io/pypi/v/plantumlcli)](https://pypi.org/project/plantumlcli/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/plantumlcli)
![PyPI - Implementation](https://img.shields.io/pypi/implementation/plantumlcli)
![Loc](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/HansBug/b0362248ec0e7574ab22ea80df775197/raw/loc.json)
![Comments](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/HansBug/b0362248ec0e7574ab22ea80df775197/raw/comments.json)
[![Docs Deploy](https://github.com/hansbug/plantumlcli/workflows/Docs%20Deploy/badge.svg)](https://github.com/hansbug/plantumlcli/actions?query=workflow%3A%22Docs+Deploy%22)
[![Code Test](https://github.com/hansbug/plantumlcli/workflows/Code%20Test/badge.svg)](https://github.com/hansbug/plantumlcli/actions?query=workflow%3A%22Code+Test%22)
[![Badge Creation](https://github.com/hansbug/plantumlcli/workflows/Badge%20Creation/badge.svg)](https://github.com/hansbug/plantumlcli/actions?query=workflow%3A%22Badge+Creation%22)
[![Package Release](https://github.com/hansbug/plantumlcli/workflows/Package%20Release/badge.svg)](https://github.com/hansbug/plantumlcli/actions?query=workflow%3A%22Package+Release%22)
[![codecov](https://codecov.io/gh/hansbug/plantumlcli/branch/main/graph/badge.svg?token=XJVDP4EFAT)](https://codecov.io/gh/hansbug/plantumlcli)
[![GitHub stars](https://img.shields.io/github/stars/hansbug/plantumlcli)](https://github.com/hansbug/plantumlcli/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/hansbug/plantumlcli)](https://github.com/hansbug/plantumlcli/network)
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/hansbug/plantumlcli)
[![GitHub issues](https://img.shields.io/github/issues/hansbug/plantumlcli)](https://github.com/hansbug/plantumlcli/issues)
[![GitHub pulls](https://img.shields.io/github/issues-pr/hansbug/plantumlcli)](https://github.com/hansbug/plantumlcli/pulls)
[![Contributors](https://img.shields.io/github/contributors/hansbug/plantumlcli)](https://github.com/hansbug/plantumlcli/graphs/contributors)
[![GitHub license](https://img.shields.io/github/license/hansbug/plantumlcli)](https://github.com/hansbug/plantumlcli/blob/master/LICENSE)
An easy-to-use plantuml cli for everyone.
## Install
Install from official pypi
```bash
pip install plantumlcli
```
Install from source code
```bash
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
```bash
pip install plantumlcli[pdf]
```
## Using with cli
### Basic Usage
Show version of `plantumlcli`
```bash
plantumlcli -v
```
Show help information of `plantumlcli`
```bash
plantumlcli -h
```
Check the local plantuml environment and remote plantuml host
```bash
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.
```bash
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
```bash
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)
```bash
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`
```python
# 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](https://join.slack.com/t/hansbug/shared_invite/zt-z3rtyooz-Rf6QZ9eNy6t5vvUGnicfdw), or
contact the core developer [HansBug](https://github.com/HansBug) for more detailed discussion.
## Links
Github: [https://github.com/HansBug/plantumlcli](https://github.com/HansBug/plantumlcli)
Documentation(just readme yet, will be written
soon): [https://github.com/HansBug/plantumlcli/blob/main/README.md](https://github.com/HansBug/plantumlcli/blob/main/README.md)
Issue Tracker: [https://github.com/HansBug/plantumlcli/issues](https://github.com/HansBug/plantumlcli/issues)
Pypi: [https://pypi.org/project/plantumlcli/](https://pypi.org/project/plantumlcli/)
Test pypi(pre-released versions can be found
here): [https://test.pypi.org/project/plantumlcli/](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
* Fix a bug on windows platform,
issue: [https://github.com/HansBug/plantumlcli/issues/1](https://github.com/HansBug/plantumlcli/issues/1)
### Version 0.0.1
Released 2020-11-29
* The first official `plantumlcli` version, cheers!!! :beers:
Raw data
{
"_id": null,
"home_page": "https://github.com/HansBug/plantumlcli",
"name": "plantumlcli",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "python,plantuml,diagrams",
"author": "HansBug",
"author_email": "hansbug@buaa.edu.cn",
"download_url": "https://files.pythonhosted.org/packages/36/03/cce944c2c50532ac5a0a8eb49094689f2ffc722cc2f21be5d6a2bfb54a64/plantumlcli-0.1.2.tar.gz",
"platform": null,
"description": "# plantumlcli\n\n[![PyPI](https://img.shields.io/pypi/v/plantumlcli)](https://pypi.org/project/plantumlcli/)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/plantumlcli)\n![PyPI - Implementation](https://img.shields.io/pypi/implementation/plantumlcli)\n![Loc](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/HansBug/b0362248ec0e7574ab22ea80df775197/raw/loc.json)\n![Comments](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/HansBug/b0362248ec0e7574ab22ea80df775197/raw/comments.json)\n\n[![Docs Deploy](https://github.com/hansbug/plantumlcli/workflows/Docs%20Deploy/badge.svg)](https://github.com/hansbug/plantumlcli/actions?query=workflow%3A%22Docs+Deploy%22)\n[![Code Test](https://github.com/hansbug/plantumlcli/workflows/Code%20Test/badge.svg)](https://github.com/hansbug/plantumlcli/actions?query=workflow%3A%22Code+Test%22)\n[![Badge Creation](https://github.com/hansbug/plantumlcli/workflows/Badge%20Creation/badge.svg)](https://github.com/hansbug/plantumlcli/actions?query=workflow%3A%22Badge+Creation%22)\n[![Package Release](https://github.com/hansbug/plantumlcli/workflows/Package%20Release/badge.svg)](https://github.com/hansbug/plantumlcli/actions?query=workflow%3A%22Package+Release%22)\n[![codecov](https://codecov.io/gh/hansbug/plantumlcli/branch/main/graph/badge.svg?token=XJVDP4EFAT)](https://codecov.io/gh/hansbug/plantumlcli)\n\n[![GitHub stars](https://img.shields.io/github/stars/hansbug/plantumlcli)](https://github.com/hansbug/plantumlcli/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/hansbug/plantumlcli)](https://github.com/hansbug/plantumlcli/network)\n![GitHub commit activity](https://img.shields.io/github/commit-activity/m/hansbug/plantumlcli)\n[![GitHub issues](https://img.shields.io/github/issues/hansbug/plantumlcli)](https://github.com/hansbug/plantumlcli/issues)\n[![GitHub pulls](https://img.shields.io/github/issues-pr/hansbug/plantumlcli)](https://github.com/hansbug/plantumlcli/pulls)\n[![Contributors](https://img.shields.io/github/contributors/hansbug/plantumlcli)](https://github.com/hansbug/plantumlcli/graphs/contributors)\n[![GitHub license](https://img.shields.io/github/license/hansbug/plantumlcli)](https://github.com/hansbug/plantumlcli/blob/master/LICENSE)\n\nAn easy-to-use plantuml cli for everyone.\n\n## Install\n\nInstall from official pypi\n\n```bash\npip install plantumlcli\n```\n\nInstall from source code\n\n```bash\ngit clone https://github.com/HansBug/plantumlcli\ncd plantumlcli && pip install .\n```\n\nPython 3.7+ is required, pypy is also tested to be okay.\n\nIf you need to export the diagrams to PDF format, just install like this\n\n```bash\npip install plantumlcli[pdf]\n```\n\n## Using with cli\n\n### Basic Usage\n\nShow version of `plantumlcli`\n\n```bash\nplantumlcli -v\n```\n\nShow help information of `plantumlcli`\n\n```bash\nplantumlcli -h\n```\n\nCheck the local plantuml environment and remote plantuml host\n\n```bash\nplantumlcli -c # check both environments\nplantumlcli -cL # check local environment only\nplantumlcli -cR # check remote environment only\n```\n\nIn default, no local plantuml jar can be used, the remote host is set to the official\none (http://www.plantuml.com/plantuml). But don't worry, you can specify your plantuml jar file or remote host by\nenvironment variables or command lines.\n\n```bash\nplantumlcli -c # local not okay, remote okay\nPLANTUML_HOST=http://plantuml.example.com plantumlcli -cR # remote okay\nplantumlcli -cR -r http://plantuml.example.com # remote okay\nPLANTUML_JAR=/my/path/plantuml.jar plantumlcli -cL # local okay\nplantumlcli -cL -p /my/path/plantuml.jar # local okay\n```\n\nBuild image from plantuml source code\n\n```bash\nplantumlcli source.puml # the target image will be named as 'source.png'\nplantumlcli -o image.png source.puml # the target image will be named as 'image.png'\nplantumlcli -t eps source.puml # eps format is supported\nplantumlcli source1.puml source2.puml # 2 source codes, the images' names will be 'source1.png' and 'source2.png'\nplantumlcli -o image1.png -o image2.png source1.puml source2.puml # 2 source codes, image will be 'image1.png' and 'image2.png'\n\nPLANTUML_JAR=/my/path/plantuml.jar plantumlcli source.puml # use local plantuml jar to build png\nPLANTUML_JAR=/my/path/plantuml.jar plantumlcli -L source.puml # force use local plantuml jar to build png\nPLANTUML_HOST=http://plantuml.example.com plantuml source.puml # use your plantuml host to build png\nPLANTUML_HOST=http://plantuml.example.com plantuml -R source.puml # force use your plantuml host to build png\n```\n\nYou can also get the URL address of remote plantuml (in these cases, remote plantuml will be used regardless of `-L`\nand `-R` commands)\n\n```bash\nplantumlcli -u helloworld.puml # get png URL of helloworld.puml\nplantumlcli -u -t eps helloworld.puml # get eps URL of helloworld.puml\nplantumlcli --homepage-url helloworld.puml # get online editor's URL of helloworld.puml\nplantumlcli -u helloworld.puml common.puml # get png URL of the 2 puml files (one line for one URL, in order)\n```\n\n## Using from python\n\nYou can also use plantumlcli in python source code by `import`\n\n```python\n# environment variables\n# PLANTUML_JAR=/path/to/plantuml.jar\n# PLANTUML_HOST=https://plantuml.example.com\n\nfrom pathlib import Path\nfrom plantumlcli import LocalPlantuml, RemotePlantuml\n\nif __name__ == \"__main__\":\n code = Path('source.puml').read_text()\n\n local = LocalPlantuml.autoload()\n print(local.dump_txt(code)) # print text graph of code\n local.dump('/my/path/source_local.png', 'png', code) # save png to /my/path/source_local.png\n local.dump('/my/path/source_local.eps', 'eps', code) # save eps to /my/path/source_local.eps\n\n remote = RemotePlantuml.autoload()\n print(remote.dump_txt(code)) # print text graph of code\n remote.dump('/my/path/source_remote.png', 'png', code) # save png to /my/path/source_remote.png\n remote.dump('/my/path/source_remote.eps', 'eps', code) # save eps to /my/path/source_remote.eps\n print(remote.get_url('png', code)) # get png url from remote host\n print(remote.get_homepage_url(code)) # get online editor's url from remote host\n\n```\n\n## Contributing\n\nThank you for considering contributing to plantumlcli!\n\nWe appreciate all contributions to improve plantumlcli, both logic and system designs. Please refer to CONTRIBUTING.md\nfor more guides.\n\nAnd users can join\nour [slack communication channel](https://join.slack.com/t/hansbug/shared_invite/zt-z3rtyooz-Rf6QZ9eNy6t5vvUGnicfdw), or\ncontact the core developer [HansBug](https://github.com/HansBug) for more detailed discussion.\n\n## Links\n\nGithub: [https://github.com/HansBug/plantumlcli](https://github.com/HansBug/plantumlcli)\n\nDocumentation(just readme yet, will be written\nsoon): [https://github.com/HansBug/plantumlcli/blob/main/README.md](https://github.com/HansBug/plantumlcli/blob/main/README.md)\n\nIssue Tracker: [https://github.com/HansBug/plantumlcli/issues](https://github.com/HansBug/plantumlcli/issues)\n\nPypi: [https://pypi.org/project/plantumlcli/](https://pypi.org/project/plantumlcli/)\n\nTest pypi(pre-released versions can be found\nhere): [https://test.pypi.org/project/plantumlcli/](https://test.pypi.org/project/plantumlcli/)\n\n## Change log\n\n### Version 0.0.3\n\nReleased 2021-10-8\n\n* Fix the problem when using official site.\n* click version requirement changed to >= 7.0, will not conflict with other packages any more.\n\n### Version 0.0.2\n\nReleased 2020-11-30\n\n* Fix a bug on windows platform,\n issue: [https://github.com/HansBug/plantumlcli/issues/1](https://github.com/HansBug/plantumlcli/issues/1)\n\n### Version 0.0.1\n\nReleased 2020-11-29\n\n* The first official `plantumlcli` version, cheers!!! :beers:\n\n",
"bugtrack_url": null,
"license": "Apache License, Version 2.0",
"summary": "An easy-to-use plantuml cli for everyone.",
"version": "0.1.2",
"project_urls": {
"Documentation": "https://github.com/HansBug/plantumlcli/blob/main/README.md",
"Homepage": "https://github.com/HansBug/plantumlcli",
"Issue tracker": "https://github.com/HansBug/plantumlcli/issues",
"Source": "https://github.com/HansBug/plantumlcli"
},
"split_keywords": [
"python",
"plantuml",
"diagrams"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f7f16953c2a849dbee4a03cc9b2a76abd57279f58e0574e4508b489f72693975",
"md5": "5a95a7e3493a93cde5e595de635f9b45",
"sha256": "4b2ffff62e164a75f70a42e662fcb72dbe3c69bc04d4a9fdcae41825060e16e4"
},
"downloads": -1,
"filename": "plantumlcli-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5a95a7e3493a93cde5e595de635f9b45",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 24914,
"upload_time": "2023-05-07T08:00:35",
"upload_time_iso_8601": "2023-05-07T08:00:35.784184Z",
"url": "https://files.pythonhosted.org/packages/f7/f1/6953c2a849dbee4a03cc9b2a76abd57279f58e0574e4508b489f72693975/plantumlcli-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3603cce944c2c50532ac5a0a8eb49094689f2ffc722cc2f21be5d6a2bfb54a64",
"md5": "f56687738fada4525beafca7caac3808",
"sha256": "e16a8fb30c99684f0c7a53e3abffba9ab06736ca7d8514051ae53b42f5dcad8a"
},
"downloads": -1,
"filename": "plantumlcli-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "f56687738fada4525beafca7caac3808",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 22280,
"upload_time": "2023-05-07T08:00:37",
"upload_time_iso_8601": "2023-05-07T08:00:37.225490Z",
"url": "https://files.pythonhosted.org/packages/36/03/cce944c2c50532ac5a0a8eb49094689f2ffc722cc2f21be5d6a2bfb54a64/plantumlcli-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-07 08:00:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "HansBug",
"github_project": "plantumlcli",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "plantumlcli"
}