Export#
Constants#
constants for ipydrawio-export
.
- ipydrawio_export.constants.DRAWIO_APP = '../labextensions/@deathbeds/ipydrawio-webpack/static/dio'#
a path to the drawio static assets
- ipydrawio_export.constants.ENV_IPYDRAWIO_DATA_DIR = 'IPYDRAWIO_DATA_DIR'#
environment variable for a custom data directory for
ipydrawio-export
- ipydrawio_export.constants.ENV_JUPYTER_DATA_DIR = 'JUPYTER_DATA_DIR'#
environment variable for the well-known Jupyter data directory environment variable
- ipydrawio_export.constants.PNG_DRAWIO_INFO = 'mxfile'#
the header to look for in PNG metadata
- ipydrawio_export.constants.WORK_DIR = 'ipydrawio_export'#
always appended to
*_DATA_DIR
Manager#
ipdrawio-export
manager.
- class ipydrawio_export.manager.IPyDrawioExportManager(**kwargs)#
Bases:
LoggingConfigurable
manager of (currently) another node-based server.
- attach_xml c.IPyDrawioExportManager.attach_xml = Bool(False)#
attach source XML to PDF document
- attachment_name c.IPyDrawioExportManager.attachment_name = Unicode('diagram.drawio')#
name of document to attach
- attachments(pdf_path)#
Iterate over the name, attachment pairs in the PDF.
- core_params c.IPyDrawioExportManager.core_params = Dict()#
URL parameters for export
- drawing_name c.IPyDrawioExportManager.drawing_name = Unicode('drawing.dio.xml')#
name for temporary XML
- property drawio_export_app#
- property drawio_export_chromium#
- property drawio_export_integrity#
- property drawio_export_node_modules#
- property drawio_export_puppeteer#
- drawio_export_workdir c.IPyDrawioExportManager.drawio_export_workdir = Unicode('')#
working directory for the drawio server
- drawio_port c.IPyDrawioExportManager.drawio_port = Int(0)#
port for the drawio server
- drawio_server_url c.IPyDrawioExportManager.drawio_server_url = Unicode('')#
URL for the drawio server
- executor c.IPyDrawioExportManager.drawio_server_url = Unicode('')#
- export_retries c.IPyDrawioExportManager.export_retries = Int(5)#
number of retries for export
- extract_diagrams(pdf_request)#
- get_unused_port()#
Get an unused port by trying to listen to any random port.
Probably could introduce race conditions if inside a tight loop.
- init_wait_sec c.IPyDrawioExportManager.init_wait_sec = Int(2)#
time to wait until contacting drawio server
- initialize()#
- property is_provisioned#
- is_provisioning Bool(False)#
- property is_running#
- is_starting Bool(False)#
- async pdf(pdf_requests)#
- pdf_cache c.IPyDrawioExportManager.pdf_cache = Unicode('')#
path to cache for generated PDF pages
- provision(force=False)#
- async start_server()#
- async status()#
- stop_server()#
- property url#
App#
CLI for ipydrawio-export.
- class ipydrawio_export.app.BaseApp(**kwargs)#
Bases:
Application
The base app for
ipydrawio-export
apps.- property description#
A trait for unicode strings.
- flags = {'debug': ({'Application': {'log_level': 10}}, 'set log level to logging.DEBUG (maximize logging output)')}#
- log_datefmt c.BaseApp.log_datefmt = Unicode('%Y-%m-%d %H:%M:%S')#
The date format used by logging formatters for %(asctime)s
- log_format c.BaseApp.log_format = Unicode('[%(name)s]%(highlevel)s %(message)s')#
The Logging format template
- log_level c.BaseApp.log_level = Enum(30)#
Set the log level by value or name.
- logging_config c.BaseApp.logging_config = Dict()#
Configure additional log handlers.
The default stderr logs handler is configured by the log_level, log_datefmt and log_format settings.
This configuration can be used to configure additional handlers (e.g. to output the log to a file) or for finer control over the default handlers.
If provided this should be a logging configuration dictionary, for more information see: https://docs.python.org/3/library/logging.config.html#logging-config-dictschema
This dictionary is merged with the base logging configuration which defines the following:
A logging formatter intended for interactive use called
console
.A logging handler that writes to stderr called
console
which uses the formatterconsole
.A logger with the name of this application set to
DEBUG
level.
This example adds a new handler that writes to a file:
c.Application.logging_config = { 'handlers': { 'file': { 'class': 'logging.FileHandler', 'level': 'DEBUG', 'filename': '<path/to/file>', } }, 'loggers': { '<application-name>': { 'level': 'DEBUG', # NOTE: if you don't list the default "console" # handler here then it will be disabled 'handlers': ['console', 'file'], }, } }
- show_config c.BaseApp.show_config = Bool(False)#
Instead of starting the Application, dump configuration to stdout
- show_config_json c.BaseApp.show_config_json = Bool(False)#
Instead of starting the Application, dump configuration to stdout (as JSON)
- version c.BaseApp.show_config_json = Bool(False)#
- class ipydrawio_export.app.DrawioExportApp(**kwargs)#
Bases:
BaseApp
ipydrawio
export tools.- log_datefmt c.DrawioExportApp.log_datefmt = Unicode('%Y-%m-%d %H:%M:%S')#
The date format used by logging formatters for %(asctime)s
- log_format c.DrawioExportApp.log_format = Unicode('[%(name)s]%(highlevel)s %(message)s')#
The Logging format template
- log_level c.DrawioExportApp.log_level = Enum(30)#
Set the log level by value or name.
- logging_config c.DrawioExportApp.logging_config = Dict()#
Configure additional log handlers.
The default stderr logs handler is configured by the log_level, log_datefmt and log_format settings.
This configuration can be used to configure additional handlers (e.g. to output the log to a file) or for finer control over the default handlers.
If provided this should be a logging configuration dictionary, for more information see: https://docs.python.org/3/library/logging.config.html#logging-config-dictschema
This dictionary is merged with the base logging configuration which defines the following:
A logging formatter intended for interactive use called
console
.A logging handler that writes to stderr called
console
which uses the formatterconsole
.A logger with the name of this application set to
DEBUG
level.
This example adds a new handler that writes to a file:
c.Application.logging_config = { 'handlers': { 'file': { 'class': 'logging.FileHandler', 'level': 'DEBUG', 'filename': '<path/to/file>', } }, 'loggers': { '<application-name>': { 'level': 'DEBUG', # NOTE: if you don't list the default "console" # handler here then it will be disabled 'handlers': ['console', 'file'], }, } }
- name c.DrawioExportApp.logging_config = Dict()#
- show_config c.DrawioExportApp.show_config = Bool(False)#
Instead of starting the Application, dump configuration to stdout
- show_config_json c.DrawioExportApp.show_config_json = Bool(False)#
Instead of starting the Application, dump configuration to stdout (as JSON)
- subcommands c.DrawioExportApp.show_config_json = Bool(False)#
- class ipydrawio_export.app.ManagedApp(**kwargs)#
Bases:
BaseApp
an
ipydrawio-export
app with a manager.- drawio_manager Instance()#
- io_loop Instance()#
- log_datefmt c.ManagedApp.log_datefmt = Unicode('%Y-%m-%d %H:%M:%S')#
The date format used by logging formatters for %(asctime)s
- log_format c.ManagedApp.log_format = Unicode('[%(name)s]%(highlevel)s %(message)s')#
The Logging format template
- log_level c.ManagedApp.log_level = Enum(30)#
Set the log level by value or name.
- logging_config c.ManagedApp.logging_config = Dict()#
Configure additional log handlers.
The default stderr logs handler is configured by the log_level, log_datefmt and log_format settings.
This configuration can be used to configure additional handlers (e.g. to output the log to a file) or for finer control over the default handlers.
If provided this should be a logging configuration dictionary, for more information see: https://docs.python.org/3/library/logging.config.html#logging-config-dictschema
This dictionary is merged with the base logging configuration which defines the following:
A logging formatter intended for interactive use called
console
.A logging handler that writes to stderr called
console
which uses the formatterconsole
.A logger with the name of this application set to
DEBUG
level.
This example adds a new handler that writes to a file:
c.Application.logging_config = { 'handlers': { 'file': { 'class': 'logging.FileHandler', 'level': 'DEBUG', 'filename': '<path/to/file>', } }, 'loggers': { '<application-name>': { 'level': 'DEBUG', # NOTE: if you don't list the default "console" # handler here then it will be disabled 'handlers': ['console', 'file'], }, } }
- show_config c.ManagedApp.show_config = Bool(False)#
Instead of starting the Application, dump configuration to stdout
- show_config_json c.ManagedApp.show_config_json = Bool(False)#
Instead of starting the Application, dump configuration to stdout (as JSON)
- start()#
Start the app mainloop.
Override in subclasses.
- stop()#
- class ipydrawio_export.app.PDFApp(**kwargs)#
Bases:
ManagedApp
export a drawio diagram as a PDF.
- dio_files Tuple()#
- log_datefmt c.PDFApp.log_datefmt = Unicode('%Y-%m-%d %H:%M:%S')#
The date format used by logging formatters for %(asctime)s
- log_format c.PDFApp.log_format = Unicode('[%(name)s]%(highlevel)s %(message)s')#
The Logging format template
- log_level c.PDFApp.log_level = Enum(30)#
Set the log level by value or name.
- logging_config c.PDFApp.logging_config = Dict()#
Configure additional log handlers.
The default stderr logs handler is configured by the log_level, log_datefmt and log_format settings.
This configuration can be used to configure additional handlers (e.g. to output the log to a file) or for finer control over the default handlers.
If provided this should be a logging configuration dictionary, for more information see: https://docs.python.org/3/library/logging.config.html#logging-config-dictschema
This dictionary is merged with the base logging configuration which defines the following:
A logging formatter intended for interactive use called
console
.A logging handler that writes to stderr called
console
which uses the formatterconsole
.A logger with the name of this application set to
DEBUG
level.
This example adds a new handler that writes to a file:
c.Application.logging_config = { 'handlers': { 'file': { 'class': 'logging.FileHandler', 'level': 'DEBUG', 'filename': '<path/to/file>', } }, 'loggers': { '<application-name>': { 'level': 'DEBUG', # NOTE: if you don't list the default "console" # handler here then it will be disabled 'handlers': ['console', 'file'], }, } }
- parse_command_line(argv=None)#
Parse the command line arguments.
- show_config c.PDFApp.show_config = Bool(False)#
Instead of starting the Application, dump configuration to stdout
- show_config_json c.PDFApp.show_config_json = Bool(False)#
Instead of starting the Application, dump configuration to stdout (as JSON)
- async start_async()#
- class ipydrawio_export.app.ProvisionApp(**kwargs)#
Bases:
ManagedApp
pre-provision drawio export tools.
- flags c.PDFApp.show_config_json = Bool(False)#
- log_datefmt c.ProvisionApp.log_datefmt = Unicode('%Y-%m-%d %H:%M:%S')#
The date format used by logging formatters for %(asctime)s
- log_format c.ProvisionApp.log_format = Unicode('[%(name)s]%(highlevel)s %(message)s')#
The Logging format template
- log_level c.ProvisionApp.log_level = Enum(30)#
Set the log level by value or name.
- logging_config c.ProvisionApp.logging_config = Dict()#
Configure additional log handlers.
The default stderr logs handler is configured by the log_level, log_datefmt and log_format settings.
This configuration can be used to configure additional handlers (e.g. to output the log to a file) or for finer control over the default handlers.
If provided this should be a logging configuration dictionary, for more information see: https://docs.python.org/3/library/logging.config.html#logging-config-dictschema
This dictionary is merged with the base logging configuration which defines the following:
A logging formatter intended for interactive use called
console
.A logging handler that writes to stderr called
console
which uses the formatterconsole
.A logger with the name of this application set to
DEBUG
level.
This example adds a new handler that writes to a file:
c.Application.logging_config = { 'handlers': { 'file': { 'class': 'logging.FileHandler', 'level': 'DEBUG', 'filename': '<path/to/file>', } }, 'loggers': { '<application-name>': { 'level': 'DEBUG', # NOTE: if you don't list the default "console" # handler here then it will be disabled 'handlers': ['console', 'file'], }, } }
- show_config c.ProvisionApp.show_config = Bool(False)#
Instead of starting the Application, dump configuration to stdout
- show_config_json c.ProvisionApp.show_config_json = Bool(False)#
Instead of starting the Application, dump configuration to stdout (as JSON)
- show_workdir c.ProvisionApp.show_workdir = Bool(False)#
also print out the working location
- async start_async()#
Handlers#
tornado handlers for managing and communicating with drawio export server.
- class ipydrawio_export.handlers.BaseHandler(application, request, **kwargs)#
Bases:
JupyterHandler
- initialize(manager)#
- manager = None#
- class ipydrawio_export.handlers.PDFHandler(application, request, **kwargs)#
Bases:
BaseHandler
- post(url=None)#
- class ipydrawio_export.handlers.ProvisionHandler(application, request, **kwargs)#
Bases:
BaseHandler
- post()#
- class ipydrawio_export.handlers.StatusHandler(application, request, **kwargs)#
Bases:
BaseHandler
- get()#
- ipydrawio_export.handlers.add_handlers(app)#
Add ipydrawio routes to the notebook server web application.
Extension#
add drawio support to a running jupyter application.
- ipydrawio_export.serverextension.load_jupyter_server_extension(app)#
Create a IPyDrawioExportManager and add handlers.