Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ The available extras are:
+--------------+-------------------------------------------+
| ``labelme`` | LabelMe JSON annotation reader support |
+--------------+-------------------------------------------+
| ``tool`` | ``IPython`` and ``pygments``, needed to |
| | run the ``mvtbtool`` interactive shell |
+--------------+-------------------------------------------+
| ``all`` | All of the above |
+--------------+-------------------------------------------+

Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,14 @@ dependencies = [
# open3d - open3d support (open3d generally won't work with latest Python)
# all - all runtime optional features below
# ocr - OCR support via pytesseract
# tool - dependencies for the mvtbtool interactive shell

dev = ["pytest", "coverage", "ruff", "nbmake"]

ros = ["rosbags", "roslibpy", "websockets"]

tool = ["ipython", "pygments"]

docs = [
"sphinx",
"pydata-sphinx-theme",
Expand Down Expand Up @@ -98,6 +101,8 @@ all = [
"rosbags",
"roslibpy",
"websockets",
"ipython",
"pygments",
]

[tool.pytest.ini_options]
Expand Down
17 changes: 12 additions & 5 deletions src/machinevisiontoolbox/bin/mvtbtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,18 @@ def make_banner(args, optional_modules=None):


def main():
try:
import IPython
from IPython.terminal.prompts import Prompts
from pygments.token import Token
from traitlets.config import Config
except ImportError as e:
sys.exit(
f"mvtbtool requires IPython and pygments, which are not "
f"installed ({e}).\nInstall them with:\n\n"
" pip install machinevision-toolbox-python[tool]\n"
)

args, ipython_args = parse_arguments()
torch_modules, torch_warnings = optional_torch_imports(args.torch)

Expand All @@ -281,11 +293,6 @@ def main():
# exec(path.read_text())

## drop into IPython
import IPython
from IPython.terminal.prompts import ClassicPrompts, Prompts
from pygments.token import Token
from traitlets.config import Config

class MyPrompt(Prompts):
def in_prompt_tokens(self, cli=None):
return [(Token.Prompt, args.prompt)]
Expand Down
Loading