diff --git a/.gitignore b/.gitignore index fac5a315..1c90fcb1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /media +/examples .python-version diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 28d7b117..e099321a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,58 +8,52 @@ repos: hooks: - id: fix-byte-order-marker name: Fix Byte Order Marker - entry: hatch run check:fix-byte-order-marker + entry: hatch run hatch-static-analysis:fix-byte-order-marker language: system types: [text] - id: check-added-large-files name: Check for added large files - entry: hatch run check:check-added-large-files + entry: hatch run hatch-static-analysis:check-added-large-files language: system - id: check-toml name: Check Toml - entry: hatch run check:check-toml + entry: hatch run hatch-static-analysis:check-toml language: system types: [toml] - id: check-yaml name: Check Yaml - entry: hatch run check:check-yaml + entry: hatch run hatch-static-analysis:check-yaml language: system types: [yaml] - id: trailing-whitespace name: Trim Trailing Whitespace - entry: hatch run check:trailing-whitespace-fixer + entry: hatch run hatch-static-analysis:trailing-whitespace-fixer language: system types: [text] stages: [commit, push, manual] - id: end-of-file-fixer name: Fix End of Files - entry: hatch run check:end-of-file-fixer + entry: hatch run hatch-static-analysis:end-of-file-fixer language: system types: [text] stages: [commit, push, manual] - - id: ssort - name: ssort - entry: hatch run check:ssort + - id: ruff + name: ruff check + entry: hatch run hatch-static-analysis:ruff check + args: ["--fix"] language: system types: [python] require_serial: true - id: black - name: black - entry: hatch run check:black - language: system - types: [python] - require_serial: true - - id: ruff - name: ruff - entry: hatch run check:ruff - args: ["--fix"] + name: ruff format + entry: hatch run hatch-static-analysis:ruff format language: system types: [python] require_serial: true - id: codespell name: codespell description: Checks for common misspellings in text files. - entry: hatch run check:codespell + entry: hatch run hatch-static-analysis:codespell language: system types: [text] - id: tests diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 80bdd4b3..f5a40a5d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,24 +4,365 @@ Changelog Notable changes to this project will be documented in this file. -******** -Upcoming -******** + +******************* +v2.8.1 (2024-03-01) +******************* + +Fixed +===== + +- Prevent pager mime selection issue +- Fix ``Tab`` key when numlock is enabled in kitty + +---- + +******************* +v2.8.0 (2024-03-01) +******************* Added ===== +- Support Python 3.12 +- Implement LSP server support +- Add new ``--force-graphics`` option, to allow using the graphics protocol even if not supported by the terminal +- Automatically disable mouse support on scroll-up in console to allow for terminal scrollback buffer scrolling. Mouse support is re-enabled on the next key-press. + +Changed +======= + +- Euporie now can use any external code formatting tool instead of a limited ranger of Python code formatters + +Fixed +===== + +- Hide input overflow margin if line wrapping is turned on +- Do not load clipboard until app starts +- Make menu widget more a11y friendly by position cursor on selected menu-item +- Prompt to save dirty text files +- Prevent flickering in ``euporie-hub`` clients on server log output +- Notify of dead kernel immediately +- Handle non-existent file in the text file editor +- Fix issue with Select widget not scrolling beyond selection with scrollbar + +---- + +******************* +v2.7.0 (2024-01-15) +******************* + +Added +===== + +- Implement CSS blink +- Implement progressive rendering in webview +- Pre-render terminal graphics to speed up notebook scrolling +- Add support for ``ruff`` code formatter +- Add support for inline LaTeX math in markdown +- Add ``ziamath`` LaTeX to SVG converter +- Set scroll offset to 1 on cell inputs + +Changed +======= + +- Rename ``--tmux-graphics`` option to ``--multiplexer-passthrough``, and make it additionally work with GNU screen +- Improve ``imagemagick`` detection so it works on Debian + +Fixed +===== + +- Top line of app no longer disappears sometimes when opening file +- Redraw app on theme update +- Fix ``PgUp`` and ``PgDn`` keybindings in ``ScrollingContainer`` +- Fix issue with black code formatter when an unprintable character is entered +- Fix issue with image tearing when using ``chafa.py`` to render images +- Do not highlight brackets if a kernel input is not focused +- Use private color registers for sixel graphics +- Print the entirety of a scrolled input in euporie-console after running the input +- Greatly improved responsiveness when scrolling large cells +- Fix issue when moving cursor up between cells cursor, where cursor moved to second last character + +---- + +******************* +v2.6.2 (2023-11-23) +******************* + +Fixed +===== + +- Fix terminal graphics in euporie-console + +---- + +******************* +v2.6.1 (2023-11-17) +******************* + +Fixed +===== + +- Do not expand ipywidget HTML widgets (improves appearance of ``tqdm.notebook`` progress bars) +- Fix data update callbacks for HTML & Image ipywidgets +- Fix running multiple cells +- Prevent exception when extending cell selection to include last cell +- Prevent notebook app freezing when copying cell outputs + +---- + +******************* +v2.6.0 (2023-11-13) +******************* + +Added +===== + +- Allow scrolling to top of first cell and bottom of last cell with :kbd:`up` and :kbd:`down` if not visible +- Display inline images in markdown and HTML using terminal graphics + +Fixed +===== + +- Kitty graphics now appear when using non-default color schemes +- Prevent disabled forms being focused +- Prevent rare error when closing a tab +- Prevent error dialog collapsing at small terminal sizes +- Correct error in escape code for querying terminal dimensions +- Fix cell output wrap toggle shortcut + +---- + +******************* +v2.5.3 (2023-10-19) +******************* + +Added +===== + +- Use `justify_content` for alignment in `flex` elements in HTML renderer +- Option to use OSC52 for clipboard + +Fixed +===== + +- Ensure the color of drop-shadows gets updated if the color scheme is changed while the app is running + +---- + +******************* +v2.5.2 (2023-10-14) +******************* + +Fixed +===== + +- Fix graphic cropping in webview +- Prevent rare error on format conversion failure + +---- + +******************* +v2.5.1 (2023-10-13) +******************* + +Fixed +===== + +- Ensure extended key support is disabled at correct point in rendering process for apps running in alternate screen + +---- + +******************* +v2.5.0 (2023-10-13) +******************* + +Added +===== + +- Allow wrapping cell outputs +- Add support for ``%load`` and ``%edit`` magics +- Make icons in file browser configurable +- Implement ``display: grid`` support in HTML renderer +- Add terminal graphics support to webview +- Redirect kernel output to log + +Fixed +===== + +- Prevent entry of typed escape sequence codes into text areas +- Reset the terminal extended key mode at exit +- Limit horizontal scrolling of display areas +- Prevent error when commenting an empty cell +- Prevent moving through history in vi navigation mode +- Launch kernels from base prefix by default unless ``ipykernel`` is installed inside euporie's environment +- Use ``.md`` filename suffix when editing markdown cells in external editor +- Improve CSI-u escape sequence detection + +Changed +======= + +- Perform format conversions asynchronously +- Rename ``reset-tab`` command to ``refresh-tab`` + +---- + +******************* +v2.4.3 (2023-06-07) +******************* + +Fixed +===== + +- Fix "Wrong color format" error when suggesting dictionary key completions + +---- + +******************* +v2.4.2 (2023-06-05) +******************* + +Changed +======= + +- Add common SVG namespaces to HTML inline SVGs before conversion + +Fixed +===== + +- Force block graphic output from ``viu`` +- Fix calling asynchronous commands (e.g. converting console session to a notebook) + +---- + +******************* +v2.4.1 (2023-05-25) +******************* + +Fixed +===== + +- Fix dependency version conflict between ``platformdirs`` and ``typing-extensions`` + +---- + +******************* +v2.4.0 (2023-05-24) +******************* + +Changed +======= + +- Change from `appdirs` to `platformdirs` for resolving user configuration path +- Improve changes of successful format conversion by trying all conversion routes +- Improvements to responsiveness when opening files +- Update completion menu style +- Changed name of ``hub`` configuration item ```no_auth`` to ``auth`` with inverse logic + +Added +===== + +- Add web viewer tab for sufing the world wide web +- Add JSON viewer tab +- Add ability to open remote files from "open" dialog +- Add ability to select file open method +- Add support for opening scripts & markdown documents as notebooks using Jupytext +- Show full file-browser file path in status-bar +- Make all scrollbars clickable +- Add ability to select an existing kernel when changing a notebook's kernel +- Add "*.desktop" files +- Select text on find-next +- Add support for saving changes to text files + +Fixed +===== + +- Fix pandas dataframe HTML output formatting with row multi-indices +- Prevent every ``euporie-consle`` run clearing the screen in ``Konsole`` +- Replace tabs with spaces in ANSI text output +- ``SelectMultiple`` widget is now styled consistently with other widgets +- Restore terminal state on unexpected exit signal +- Prevent ``KeyError: 'log_file'`` error when launching apps via ``euporie`` app +- Prevent unknown markdown code block language causing rendering error +- Fix unexpected cropped graphics when using ``timg`` with character aspects ≠ 0.5 +- Make clickable scrollbars work correctly with Window containers +- Render cells when converted to markdown +- Prevent crash when connecting to ``euporie-hub`` +- Improve mime-type detection +- Make saving safer by saving to a temporary file first + +---- + +******************* +v2.3.2 (2023-03-21) +******************* + +Added +===== + +- Add :kbd:`Ctrl+up` and :kbd:`Ctrl+down` as key-bindings to move through kernel history in the console +- Allow closing notebook tabs with the middle mouse button +- Notify the user if the kernel dies unexpectedly + +Fixed +===== + +- Re-enable display of large images in console +- Fix HTML table colspan border rendering issue +- Fix minor notebook scrolling issues +- Fix scrollbar dragging on tiled notebooks +- Prevent exception if kernel requests an unknown lexer +- Improve handling of kernel startup errors and reliability of changing kernels +- Rendering of LaTeX as terminal graphics + +---- + +******************* +v2.3.1 (2023-02-05) +******************* + +Added +===== + +- Warn about unrecognised configuration options in the log + +Fixed +===== + +- Fix minor issue with ``chafa.py`` image renderer + +******************* +v2.3.0 (2023-02-03) +******************* + +Added +===== + +- Add ``cahfa.py`` image renderer +- Add command to clear screen +- Add a "Restart kernel and clear all output" command +- Add commands for clearing cell outputs +- The ``scroll-up-5-lines`` and ``scroll-down-5-lines`` commands now scroll to the top or bottom of the document if less than 5 lines remain +- "Open" and "Save As" dialogs now include a file browser +- Added a side-bar, which currently shows a file browser - Add file display tab -- Minor ussability improvements to widgets +- Minor usability improvements to widgets - Partially obscured images are now rendered using terminal graphics Fixed ===== +- Change "toggle cell inputs" / "toggle cell outputs" click area to just prompt number +- Focus notebook page on click - Add global dragging to slider widgets - Fixed crash when merging last two cells in a notebook - Relaxed dependency specification constraints +Changed +======= + +- Major re-write of HTML renderer (there is still work to be done on rendering the contents of inline elements). + ---- ******************* diff --git a/LICENSE b/LICENSE index b592d958..aa289b78 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 Josiah Outram Halstead +Copyright (c) 2023 Josiah Outram Halstead Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.rst b/README.rst index 7e9d390e..a6c613ee 100644 --- a/README.rst +++ b/README.rst @@ -15,6 +15,8 @@ euporie Euporie's apps allow you to interact with Jupyter kernels, and run Jupyter notebooks - entirely from the terminal. +If you're working with Jupyter notebooks in a terminal only environment, like an SSH server or a container, or just prefer working in the terminal, then euporie is the tool for you! + .. list-table:: :align: center :widths: 25 25 25 25 @@ -25,8 +27,8 @@ Euporie's apps allow you to interact with Jupyter kernels, and run Jupyter noteb - `Preview `_ - `Hub `_ -.. image:: https://user-images.githubusercontent.com/12154190/182201621-9c3e4b04-1b1e-46e3-b852-b43f16adfc7b.png - :target: https://user-images.githubusercontent.com/12154190/182201621-9c3e4b04-1b1e-46e3-b852-b43f16adfc7b.png +.. image:: https://github.com/joouha/euporie/assets/12154190/c8ea6e23-11bb-4ffc-a9e5-111f788c51ae + :target: https://github.com/joouha/euporie/assets/12154190/c8ea6e23-11bb-4ffc-a9e5-111f788c51ae `View more screenshots here `_ diff --git a/docs/_extensions/video.py b/docs/_extensions/video.py index 79469a82..803b16ed 100644 --- a/docs/_extensions/video.py +++ b/docs/_extensions/video.py @@ -6,35 +6,32 @@ from __future__ import annotations -import os +from pathlib import Path from typing import TYPE_CHECKING from docutils import nodes from docutils.parsers.rst import Directive, directives if TYPE_CHECKING: - from typing import Any + from typing import Any, ClassVar from docutils.writers._html_base import HTMLTranslator from sphinx.application import Sphinx -def get_option(options: "dict[str, Any]", key: "str", default: "Any") -> "Any": +def get_option(options: dict[str, Any], key: str, default: Any) -> Any: """Get an option.""" - if key not in options.keys(): + if key not in options: return default if isinstance(default, bool): return True - else: - return options[key] + return options[key] class video(nodes.General, nodes.Element): """A video node.""" - pass - class Video(Directive): """A docutils video directive.""" @@ -43,7 +40,12 @@ class Video(Directive): required_arguments = 1 optional_arguments = 5 final_argument_whitespace = False - option_spec = { + option_spec: ClassVar[ + dict[ + str, + Directive, + ] + ] = { "alt": directives.unchanged, "width": directives.unchanged, "height": directives.unchanged, @@ -51,7 +53,7 @@ class Video(Directive): "nocontrols": directives.flag, } - def run(self) -> "list[video]": + def run(self) -> list[video]: """Return the nodes generated from this directive.""" alt = get_option(self.options, "alt", "Video") width = get_option(self.options, "width", "") @@ -71,9 +73,9 @@ def run(self) -> "list[video]": ] -def visit_video_node(self: "HTMLTranslator", node: "video") -> "None": +def visit_video_node(self: HTMLTranslator, node: video) -> None: """Return an HTML block when the video node is visited.""" - extension = os.path.splitext(node["path"])[1][1:] + extension = Path(node["path"]).suffix[1:] html_block = """