Giter VIP home page Giter VIP logo

plantweb's Introduction

Plantweb

Plantweb is a project that provides a command line interface, Sphinx directives and an API that allows to render powerful plain text UML diagrams, ASCII diagrams and complex graphs.

It is a Python client for the PlantUML server and thus it can render PlantUML, Graphviz and Ditaa diagrams without the need to install them.

Plantweb features a local cache that prevents requesting the server for previously rendered diagrams, speeding up building documentation with lots of diagrams.

Finally, being pure Python, non-local rendering, Plantweb is an excellent way to display and render PlantUML, Graphviz and Ditaa diagrams in ReadTheDocs published documentation.

Documentation

https://plantweb.readthedocs.io/

Changelog

1.2.1 (Sep 18, 2019)

Fixes

  • Fix #15 so that directive works on Windows.
  • Fix #16 so that the executable is available on Windows.

1.2.0 (Sep 18, 2019)

Warning

Bad release. Do not use it. Ups.

1.1.0 (Jul 11, 2017)

New

  • Added documentation on how to run a PlantUML docker container to simplify deployment.

Fixes

  • Fix #9 passing source files to the Sphinx directive as an absolute path.
  • Fix #7 source files passed as argument to the Sphinx directive failed to render correctly.
  • Fixed test suite to be compatible with newer versions of Sphinx.
  • Fixed several PEP8 violations.

Changes

  • Improved algorithm to gather configuration for a git repository root.
  • Test suite now test Python 3 with Python 3.5 instead of Python 3.4.

1.0.1 (Mar 20, 2017)

Fixes

  • Fix #1 that caused diagrams rendering to fail with a 404 in Windows OSes.

1.0.0 (Jun 27, 2016)

New

  • Sphinx directives now support passing a source file as argument.

0.4.0 (Jun 23, 2016)

New

  • Added a set of Sphinx directives uml, graph and diagram.

0.3.0 (Jun 22, 2016)

New

  • Default options can now be overriden with a .plantwebrc file in the user home or in the git repository root.

0.2.0 (Jun 22, 2016)

Fixes

  • Fixed bug when calling render_cache that returned a non-tuple.

Changes

  • Documentation was greatly improved.

0.1.0 (Jun 9, 2016)

New

  • Initial public release.

License

Copyright (C) 2016-2017 Carlos Jenkins

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.

plantweb's People

Contributors

carlos-jenkins avatar gregerspoulsen avatar jessetan avatar datadavev avatar

Stargazers

Marcos Assuncao avatar Alexander Mann-Wahrenberg avatar  avatar Michael Ludwig avatar buribu pinheiro avatar Ben avatar ling.yue avatar myxvisual avatar GAURAV avatar Andre Bossert avatar Guillaume Gelin avatar tg-z avatar Steve Taylor avatar Weslley Ribeiro avatar Marco A Rojas avatar Kyle Stapp avatar Rolando Garza avatar Harshad Sharma avatar freezed avatar Pike avatar Brad Anderson avatar Rohit Yadav avatar Nick Meyer avatar Pedro Cuadra avatar Andy Bulka avatar Perry Bhandal avatar Damian Quiroga avatar

Watchers

James Cloos avatar  avatar  avatar

plantweb's Issues

Unable to determine git root directory

Trying to use plantweb as a library, from a Jupyter notebook, this was logged:

ERROR: Unable to determine git root directory

It would be nice if the project didn't assume I'm running it from a git project and that the git tool is available. I think it's good that it can do that. But IMHO it shouldn't be the default behavior. Users could be running some different VCS, such as mercurial, or none at all.

Using plantweb 1.0.0 and python 3.6.0.

1.2.1: documentation not ready for sphinx 6.1.x

Looks like plantweb documentation cannot be generated using sphinx 6.1.x

+ PYTHONPATH=$PWD/lib /usr/bin/sphinx-build -n -T -b man doc build/sphinx/man
Running Sphinx v6.1.3
WARNING: Invalid configuration value found: 'language = None'. Update your configuration to a valid language code. Falling back to 'en' (English).
making output directory... done

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 237, in __init__
    self.config.setup(self)
  File "/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/doc/conf.py", line 300, in setup
    app.add_stylesheet('styles/custom.css')
AttributeError: 'Sphinx' object has no attribute 'add_stylesheet'

Exception occurred:
  File "/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/doc/conf.py", line 300, in setup
    app.add_stylesheet('styles/custom.css')
AttributeError: 'Sphinx' object has no attribute 'add_stylesheet'
The full traceback has been saved in /tmp/sphinx-err-xm2r1zjd.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!

Feature request: specify output directory

When inputting an absolute path I expected the output file to be at the same location.

Could this a) be the default or b) be implemented as a --output-dir option?

1.2.1: sphinx warnings `reference target not found`

On building my packages I'm using sphinx-build command with -n switch which shows warmings about missing references. These are not critical issues.

There are few other warnings as well. Here is the output with warnings:

+ /usr/bin/sphinx-build -n -T -b man doc build/sphinx/man
Running Sphinx v5.0.2
WARNING: Invalid configuration value found: 'language = None'. Update your configuration to a valid langauge code. Falling back to 'en' (English).
making output directory... done
WARNING: while setting up extension conf.py: The app.add_stylesheet() is deprecated. Please use app.add_css_file() instead.
loading intersphinx inventory from https://docs.python.org/3.5/objects.inv...
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
updating environment: [new config] 11 added, 0 changed, 0 removed
reading sources... [100%] plantweb/plantweb.render
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
writing... python-plantweb.3 { examples developer plantweb/plantweb plantweb/plantweb.__main__ plantweb/plantweb.args plantweb/plantweb.defaults plantweb/plantweb.directive plantweb/plantweb.main plantweb/plantweb.plantuml plantweb/plantweb.render } /home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/lib/plantweb/directive.py:docstring of plantweb.directive.defaults_provider:6: WARNING: py:data reference target not found: DEFAULT_CONFIG
docstring of plantweb.directive.Plantweb.required_arguments:2: WARNING: py:class reference target not found: docutils.parsers.rst.directives.images.Image
docstring of plantweb.directive.Plantweb.required_arguments:2: WARNING: py:class reference target not found: docutils.parsers.rst.Directive
/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/doc/plantweb/plantweb.directive.rst:61: WARNING: py:class reference target not found: docutils.parsers.rst.directives.images.Image
/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/doc/plantweb/plantweb.directive.rst:61: WARNING: py:class reference target not found: docutils.parsers.rst.Directive
/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/doc/plantweb/plantweb.directive.rst:68: WARNING: py:class reference target not found: docutils.parsers.rst.directives.images.Image
/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/doc/plantweb/plantweb.directive.rst:68: WARNING: py:class reference target not found: docutils.parsers.rst.Directive
/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/doc/plantweb/plantweb.directive.rst:75: WARNING: py:class reference target not found: docutils.parsers.rst.directives.images.Image
/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/doc/plantweb/plantweb.directive.rst:75: WARNING: py:class reference target not found: docutils.parsers.rst.Directive
done
build succeeded, 11 warnings.

You can peak on fixes that kind of issues in other projects
latchset/jwcrypto#289
click-contrib/sphinx-click@abc31069
latchset/jwcrypto#289
RDFLib/rdflib-sqlalchemy#95
sissaschool/elementpath@bf869d9e
jaraco/cssutils#21
pywbem/pywbem#2895

AttributeError: 'BuildEnvironment' object has no attribute 'confdir'

Using the file format in a sphinx-docs project:

.. uml:: /uml/deploy-prd.uml

The following error occurs:

Exception occurred:
  File "c:\python27\lib\site-packages\plantweb\directive.py", line 119, in run
    srcpath = join(env.confdir, srcfile)
AttributeError: 'BuildEnvironment' object has no attribute 'confdir'
The full traceback has been saved in c:\users\taylors\appdata\local\temp\sphinx-err-_wwbww.log, if you want to report the issue to the developers.

Improve documentation:

  • Add documentation to deploy plantweb with docker.
  • Add the statement that plantweb is Python 2 and 3 safe (install documentation implies Python3 only).
  • Correct some typos (usefulL, etc).

404 error trying to render a PlantUML diagram

Hi,

Cool project.

I decided to give it a try and started by copying an example from the docs, but got a:

HTTPError: 404 Client Error: Not Found for url: http://www.plantuml.com/plantuml/svg%5CJSwx3O0m30JG_gRm0XJy6WgKYWbOm90KI11BYIdO7a90IdbwyfrDL0vw7Zl0gqgWIQJ68gUt7AwK6gpYDSYUGWldTTCNEbXMNZYwb7gaIwh6zuO6ceN-cfBQJ5zdALsMF512d-5V0uppzddv1W00

Using plantweb 1.0.0 and python 3.6.0.

Any help appreciated.

This is the code I ran:

from plantweb.render import render


CONTENT = """
actor Foo1
boundary Foo2
control Foo3
entity Foo4
database Foo5
Foo1 -> Foo2 : To boundary
Foo1 -> Foo3 : To control
Foo1 -> Foo4 : To entity
Foo1 -> Foo5 : To database
"""


print('==> INPUT:')
print(CONTENT)

output = render(
    CONTENT,
    engine='plantuml',
    format='svg',
    cacheopts={
        'use_cache': False
    }
)

print('==> OUTPUT:')
print(output)

Add support for different file format for LaTeX output

It is currently possible to choose between svg and png output, which is fine for HTML output, but is not ideal for LaTeX (and PDF) output, which should use PlantUMLs -teps option to generate eps.
It would be nice if Plantweb supported a new option to choose the output format for use with LaTeX, similar to plantuml_latex_output_format in sphinxcontrib-plantuml.

1.2.1: `plantweb` documentation is not sphinx 4.x ready?

Looks like plantweb documentation is not sphinx 4.x ready

[tkloczko@barrel plantweb-1.2.1]$ sphinx-build -b man -d plantweb docs .

Application error:
Cannot find source directory (/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/docs)
[tkloczko@barrel plantweb-1.2.1]$ sphinx-build -b man -d plantweb doc .
Running Sphinx v4.1.2

Exception occurred:
  File "/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/doc/conf.py", line 299, in setup
    app.add_stylesheet('styles/custom.css')
AttributeError: 'Sphinx' object has no attribute 'add_stylesheet'
The full traceback has been saved in /tmp/sphinx-err-flyvy_yg.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
[tkloczko@barrel plantweb-1.2.1]$ cat /tmp/sphinx-err-flyvy_yg.log
# Sphinx version: 4.1.2
# Python version: 3.8.12 (CPython)
# Docutils version: 0.17.1 release
# Jinja2 version: 3.0.1
# Last messages:

# Loaded extensions:
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 276, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 251, in __init__
    self.config.setup(self)
  File "/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/doc/conf.py", line 299, in setup
    app.add_stylesheet('styles/custom.css')
AttributeError: 'Sphinx' object has no attribute 'add_stylesheet'

1.2.1: pytest is failing with errors

I'm trying to package your module as an rpm package. So I'm using the typical build, install and test cycle used on building packages from non-root account.

  • "setup.py build"
  • "setup.py install --root </install/prefix>"
  • "pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

May I ask for help because few units are failing:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-plantweb-1.2.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-plantweb-1.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
Using --randomly-seed=3831724006
rootdir: /home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1, configfile: tox.ini
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, aspectlib-1.5.2, toolbox-0.5, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, xprocess-0.18.1, black-0.3.12, anyio-3.3.0, asyncio-0.15.1, trio-0.7.0, subtests-0.5.0, isort-2.0.0, hypothesis-6.14.6, mock-3.6.1, profiling-1.7.0, randomly-3.8.0, Faker-8.12.1, nose2pytest-1.0.8, pyfakefs-4.5.1, tornado-0.8.1, twisted-1.13.3
collected 9 items / 8 errors / 1 selected

================================================================================== ERRORS ==================================================================================
________________________________________________________________ ERROR collecting lib/plantweb/__main__.py _________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('plantweb.__main__', '/home/tkloczko/rpmbuild/BUILDROOT/python-plantweb-1.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/plantweb/__main__.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/lib/plantweb/__main__.py'))
__________________________________________________________________ ERROR collecting lib/plantweb/args.py ___________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('plantweb.args', '/home/tkloczko/rpmbuild/BUILDROOT/python-plantweb-1.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/plantweb/args.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/lib/plantweb/args.py'))
________________________________________________________________ ERROR collecting lib/plantweb/defaults.py _________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('plantweb.defaults', '/home/tkloczko/rpmbuild/BUILDROOT/python-plantweb-1.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/plantweb/defaults.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/lib/plantweb/defaults.py'))
________________________________________________________________ ERROR collecting lib/plantweb/directive.py ________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('plantweb.directive', '/home/tkloczko/rpmbuild/BUILDROOT/python-plantweb-1.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/plantweb/directive.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/lib/plantweb/directive.py'))
__________________________________________________________________ ERROR collecting lib/plantweb/main.py ___________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('plantweb.main', '/home/tkloczko/rpmbuild/BUILDROOT/python-plantweb-1.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/plantweb/main.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/lib/plantweb/main.py'))
________________________________________________________________ ERROR collecting lib/plantweb/plantuml.py _________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('plantweb.plantuml', '/home/tkloczko/rpmbuild/BUILDROOT/python-plantweb-1.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/plantweb/plantuml.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/lib/plantweb/plantuml.py'))
_________________________________________________________________ ERROR collecting lib/plantweb/render.py __________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('plantweb.render', '/home/tkloczko/rpmbuild/BUILDROOT/python-plantweb-1.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/plantweb/render.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/lib/plantweb/render.py'))
_________________________________________________________________ ERROR collecting test/sphinxconf/conf.py _________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:311: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/doctest.py:532: in collect
    module = import_path(self.fspath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:544: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('conf', '/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/doc/conf.py', PosixPath('/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/test/sphinxconf/conf.py'))
========================================================================= short test summary info ==========================================================================
ERROR lib/plantweb/__main__.py - _pytest.pathlib.ImportPathMismatchError: ('plantweb.__main__', '/home/tkloczko/rpmbuild/BUILDROOT/python-plantweb-1.2.1-2.fc35.x86_64/us...
ERROR lib/plantweb/args.py - _pytest.pathlib.ImportPathMismatchError: ('plantweb.args', '/home/tkloczko/rpmbuild/BUILDROOT/python-plantweb-1.2.1-2.fc35.x86_64/usr/lib/py...
ERROR lib/plantweb/defaults.py - _pytest.pathlib.ImportPathMismatchError: ('plantweb.defaults', '/home/tkloczko/rpmbuild/BUILDROOT/python-plantweb-1.2.1-2.fc35.x86_64/us...
ERROR lib/plantweb/directive.py - _pytest.pathlib.ImportPathMismatchError: ('plantweb.directive', '/home/tkloczko/rpmbuild/BUILDROOT/python-plantweb-1.2.1-2.fc35.x86_64/...
ERROR lib/plantweb/main.py - _pytest.pathlib.ImportPathMismatchError: ('plantweb.main', '/home/tkloczko/rpmbuild/BUILDROOT/python-plantweb-1.2.1-2.fc35.x86_64/usr/lib/py...
ERROR lib/plantweb/plantuml.py - _pytest.pathlib.ImportPathMismatchError: ('plantweb.plantuml', '/home/tkloczko/rpmbuild/BUILDROOT/python-plantweb-1.2.1-2.fc35.x86_64/us...
ERROR lib/plantweb/render.py - _pytest.pathlib.ImportPathMismatchError: ('plantweb.render', '/home/tkloczko/rpmbuild/BUILDROOT/python-plantweb-1.2.1-2.fc35.x86_64/usr/li...
ERROR test/sphinxconf/conf.py - _pytest.pathlib.ImportPathMismatchError: ('conf', '/home/tkloczko/rpmbuild/BUILD/plantweb-1.2.1/doc/conf.py', PosixPath('/home/tkloczko/r...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 8 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================ 8 errors in 0.71s =============================================================================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<pr

Allow to skip SSL validation

I have a plantuml server behind TLS which I know is tested and strong, and publicly signed (though internal to my group). When I try to use it I get errors.

This might be you, it might be sphinx-doc? python2.7?

[I redacted mydomain. :)]

plantweb_defaults = {
    'server': 'https://pcamweb01.mydomain/plantuml/'
}
WARNING: C:\work\ART\cam-docs-art-system\environments\PRD.rst:22: (ERROR/3) Traceback (most recent call last):
  File "c:\python27\lib\site-packages\plantweb\directive.py", line 140, in run
    engine=self._get_engine_name()
  File "c:\python27\lib\site-packages\plantweb\render.py", line 199, in render
    output, sha = render_cached(server, format, content, **cacheopts)
  File "c:\python27\lib\site-packages\plantweb\render.py", line 122, in render_cached
    output = plantuml(server, format, content)
  File "c:\python27\lib\site-packages\plantweb\plantuml.py", line 123, in plantuml
    response = get(url)
  File "c:\python27\lib\site-packages\requests\api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "c:\python27\lib\site-packages\requests\api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "c:\python27\lib\site-packages\requests\sessions.py", line 502, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\python27\lib\site-packages\requests\sessions.py", line 612, in send
    r = adapter.send(request, **kwargs)
  File "c:\python27\lib\site-packages\requests\adapters.py", line 514, in send
    raise SSLError(e, request=request)
SSLError: ("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",)

Thank you!

Remove dependency on distutils

The dependency on distutils should be removed as it will be deprecated in Python 3.12. Current warning when using render and defaults:

DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives

Caption support

It is not possible to add a caption to a diagram. In Sphinx, this is done using the directive contents, but since the uml directive accepts uml as content, it would be better to use a :caption: option.

Implementation idea:
Make class Plantweb inherit from Figure instead of Image and set the value of :caption: as the Figure directive contents. May change current behavior since Figure!=Image.
Alternatively, just build and append a caption node in a way similar to Figure or sphinxcontrib-plantuml.

Make render fail if server returns an error

Splitting from #7

Currently the call to the PlantUML server asserts that the servers returns a non-error HTTP code:

response = get(url)

Nevertheless, PlantUML reports always 200 OK even if the diagram fails to render. Errors are reported by the X-PlantUML-Diagram-Error response header.

For example:

$ curl -D - http://www.plantuml.com/plantuml/png/AqWiAibCpYp8Ar58v7BAJrBGLN3CoKnELR1Io4ZDoSa70000 -o /dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: image/png
Expires: Tue, 18 Jul 2017 19:16:17 GMT
Date: Thu, 13 Jul 2017 19:16:17 GMT
Last-Modified: Mon, 03 Jul 2017 17:45:00 GMT
Cache-Control: public, max-age=432000
ETag: "1911Fn0eonQKK9-foqoXNnSom00"
X-PlantUML-Diagram-Description: (Error)
X-PlantUML-Diagram-Error: Syntax Error?
X-PlantUML-Diagram-Error-Line: 1
X-PlantUML-Diagram-Error: Syntax Error?
X-PlantUML-Diagram-Error-Line: 1
X-PlantUML-Diagram-Error: Syntax Error?
X-PlantUML-Diagram-Error-Line: 1
X-Powered-By: PlantUML Version 1.2017.16beta1
X-Patreon: Support us on http://plantuml.com/patreon
X-Donate: http://plantuml.com/paypal
X-Quote: You have died of dysentery.
X-PlantUML-Measure: 1/56/171
X-PlantUML-Diagram-Width: 565
X-PlantUML-Diagram-Height: 309
Content-Length: 15327
Server: PlantUML/0.6
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
Age: 569

100 15327  100 15327    0     0  20757      0 --:--:-- --:--:-- --:--:-- 20768

So, in other words, change logic to assert presence of this headers.

source file as argument to sphinx directive does not work

On my local setup, using a Sphinx directive with content works, but not when given a filename as argument.

This works:

.. uml:: 

    @startuml
    bob->alice: hi
    @enduml

This doesn't:

.. uml:: mydiagram.puml

It looks like the directive content is a list of strings, which is converted to a single string with breaks using '\n'.join(content) before the call to render(). If a filename is given, it is read as a single string with linebreaks. Adding more linebreaks with '\n'.join(content) will send the following to the PlantUML server:

@
s
t
a
r
t
u
m
l
(etc)

The resulting png will complain about a syntax error.

It is possible that this is due to my local setup, but I'll file a quick MR in case I'm not the only one.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.