METADATA 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. Metadata-Version: 2.1
  2. Name: terminado
  3. Version: 0.18.1
  4. Summary: Tornado websocket backend for the Xterm.js Javascript terminal emulator library.
  5. Project-URL: Homepage, https://github.com/jupyter/terminado
  6. Author-email: Jupyter Development Team <jupyter@googlegroups.com>
  7. License: BSD 2-Clause License
  8. - Copyright (c) 2014-, Jupyter development team
  9. - Copyright (c) 2014, Ramalingam Saravanan <sarava@sarava.net>
  10. All rights reserved.
  11. Redistribution and use in source and binary forms, with or without
  12. modification, are permitted provided that the following conditions are met:
  13. 1. Redistributions of source code must retain the above copyright notice, this
  14. list of conditions and the following disclaimer.
  15. 2. Redistributions in binary form must reproduce the above copyright notice,
  16. this list of conditions and the following disclaimer in the documentation
  17. and/or other materials provided with the distribution.
  18. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  19. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  21. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  22. FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  24. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  25. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  27. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. License-File: LICENSE
  29. Classifier: Environment :: Web Environment
  30. Classifier: License :: OSI Approved :: BSD License
  31. Classifier: Programming Language :: Python :: 3
  32. Classifier: Topic :: Terminals :: Terminal Emulators/X Terminals
  33. Requires-Python: >=3.8
  34. Requires-Dist: ptyprocess; os_name != 'nt'
  35. Requires-Dist: pywinpty>=1.1.0; os_name == 'nt'
  36. Requires-Dist: tornado>=6.1.0
  37. Provides-Extra: docs
  38. Requires-Dist: myst-parser; extra == 'docs'
  39. Requires-Dist: pydata-sphinx-theme; extra == 'docs'
  40. Requires-Dist: sphinx; extra == 'docs'
  41. Provides-Extra: test
  42. Requires-Dist: pre-commit; extra == 'test'
  43. Requires-Dist: pytest-timeout; extra == 'test'
  44. Requires-Dist: pytest>=7.0; extra == 'test'
  45. Provides-Extra: typing
  46. Requires-Dist: mypy~=1.6; extra == 'typing'
  47. Requires-Dist: traitlets>=5.11.1; extra == 'typing'
  48. Description-Content-Type: text/markdown
  49. # Terminado
  50. [![Build Status](https://github.com/jupyter/terminado/actions/workflows/test.yml/badge.svg?query=branch%3Amain++)](https://github.com/jupyter/terminado/actions/workflows/test.yml/badge.svg?query=branch%3Amain++)
  51. [![Documentation Status](https://readthedocs.org/projects/terminado/badge/?version=latest)](http://terminado.readthedocs.io/en/latest/?badge=latest)
  52. This is a [Tornado](http://tornadoweb.org/) websocket backend for the
  53. [Xterm.js](https://xtermjs.org/) Javascript terminal emulator library.
  54. It evolved out of [pyxterm](https://github.com/mitotic/pyxterm), which
  55. was part of [GraphTerm](https://github.com/mitotic/graphterm) (as
  56. lineterm.py), v0.57.0 (2014-07-18), and ultimately derived from the
  57. public-domain [Ajaxterm](http://antony.lesuisse.org/software/ajaxterm/)
  58. code, v0.11 (2008-11-13) (also on Github as part of
  59. [QWeb](https://github.com/antonylesuisse/qweb)).
  60. Modules:
  61. - `terminado.management`: controls launching virtual terminals,
  62. connecting them to Tornado's event loop, and closing them down.
  63. - `terminado.websocket`: Provides a websocket handler for
  64. communicating with a terminal.
  65. - `terminado.uimodule`: Provides a `Terminal` Tornado [UI
  66. Module](http://www.tornadoweb.org/en/stable/guide/templates.html#ui-modules).
  67. JS:
  68. - `terminado/_static/terminado.js`: A lightweight wrapper to set up a
  69. term.js terminal with a websocket.
  70. Local Installation:
  71. > $ pip install -e .\[test\]
  72. Usage example:
  73. ```python
  74. import os.path
  75. import tornado.web
  76. import tornado.ioloop
  77. # This demo requires tornado_xstatic and XStatic-term.js
  78. import tornado_xstatic
  79. import terminado
  80. STATIC_DIR = os.path.join(os.path.dirname(terminado.__file__), "_static")
  81. class TerminalPageHandler(tornado.web.RequestHandler):
  82. def get(self):
  83. return self.render(
  84. "termpage.html",
  85. static=self.static_url,
  86. xstatic=self.application.settings["xstatic_url"],
  87. ws_url_path="/websocket",
  88. )
  89. if __name__ == "__main__":
  90. term_manager = terminado.SingleTermManager(shell_command=["bash"])
  91. handlers = [
  92. (r"/websocket", terminado.TermSocket, {"term_manager": term_manager}),
  93. (r"/", TerminalPageHandler),
  94. (
  95. r"/xstatic/(.*)",
  96. tornado_xstatic.XStaticFileHandler,
  97. {"allowed_modules": ["termjs"]},
  98. ),
  99. ]
  100. app = tornado.web.Application(
  101. handlers,
  102. static_path=STATIC_DIR,
  103. xstatic_url=tornado_xstatic.url_maker("/xstatic/"),
  104. )
  105. # Serve at http://localhost:8765/ N.B. Leaving out 'localhost' here will
  106. # work, but it will listen on the public network interface as well.
  107. # Given what terminado does, that would be rather a security hole.
  108. app.listen(8765, "localhost")
  109. try:
  110. tornado.ioloop.IOLoop.instance().start()
  111. finally:
  112. term_manager.shutdown()
  113. ```
  114. See the [demos
  115. directory](https://github.com/takluyver/terminado/tree/master/demos) for
  116. more examples. This is a simplified version of the `single.py` demo.
  117. Run the unit tests with:
  118. > $ pytest