Metadata-Version: 2.1
Name: litrepl
Version: 3.14.1
Summary: Litrepl evaluates code from LaTeX/Markdown verbatim sections.
Home-page: https://github.com/sergei-mironov/litrepl
Author: Sergei Mironov
Author-email: sergei.v.mironov@proton.me
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: POSIX :: Linux
Classifier: Topic :: Software Development :: Build Tools
Classifier: Intended Audience :: Developers
Classifier: Development Status :: 3 - Alpha
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: lark
Requires-Dist: psutil


<!--
vim: tw=80
-->
Changelog
=========

Version 3.14.0
--------------

1. **Python**
   - Fixed leaking stdout in on-demand interpreter start mode and now raise an
     explicit error on double-start.
   - Added the `--keep-readout` debugging option for retaining interpreter output.
   - Performed extra `fsync` operations to make file handling more robust.
   - Improved error handling and reporting, including printing a clear error
     when `litrepl` is called from a TTY without arguments.
   - Recognize IPython command lines more reliably as IPython and set up IPython
     in a safer way, omitting log files and performing initial configuration
     in-stream.
   - Added support for relative section indexing.
   - Refactored Python code style: converted CamelCase function names to
     `snake_case` and replaced bare `assert` with an `assert_()` helper.
   - Updated the `aicli` interpreter to require explicit `/ask` endings and to
     avoid modifying verbosity settings.

2. **Environment**
   - Removed `aicli` from the Nix flake to break a mutual dependency, deferring
     a cleaner integration to later.
   - Updated inline help formatting, completed remaining help TODOs, and
     corrected the manual page section from 5 to 1.

3. **Vim**
   - No Vim-related changes in this release.

Version 3.13.0
--------------

1. **Python**
   - Improved backward compatibility by fixing issues related to spurious
     newlines on empty inputs.
   - Accept `codeai` code section for AI interpreters, in addition to `ai`.
   - Introduced a new command `print-auxdir`.

2. **Environment**
   - Added support for generating coverage reports with updates to the Makefile.
   - Added dependency on coverage-badge, enhancing reporting capabilities.
   - Modified settings to ignore empty `LITREPL_` environment variables.

3. **Vim**
   - Enhanced the indentation feature in Litrepl to preserve empty lines.
   - Updated the status command to print the auxiliary directory and fixed an
     unwanted exception.

Version 3.12.0
--------------

1. **Python**
   - Fix the hashing algorithm to exclude the unstable `hash()` output from
     digests thus fixed an issue with handling a `None` suffix in digests,
     improving the stability and accuracy of digest computations.
   - Section addressing has been adjusted to start from 1 instead of 0 for
     readability.
   - Made `eval-sections` the default command, reflecting a focus on ease of use
     and user interaction.

2. **Environment**
   - Underscores have been removed from auxiliary directory file names.
   - Add a link to the arXiv [paper](https://arxiv.org/abs/2501.10738).

3. **Vim**
   - Added new options for ignoring specific LaTeX sections with the `lignore`
     feature, enhancing customization for LaTeX users.
   - Updated the Vim async tag pattern `BG` -> `LR`.


Version 3.11.0
--------------

1. **Python**
   - The interpreters have been refactored into their own submodule, improving
     code organization.
   - Added preliminary support for
     [shell](./python/litrepl/interpreters/shell.py) interpreters, allowing the
     system to handle shell commands.
   - Introduced new commands: `print-grammar` to output the grammar and
     `print-regexp` for regular expression management.
   - Introduced adjustable code section labels, removing the default `lcode`
     sections support.
   - Improved debugging and configuration support in IPython by ensuring
     expanded paths and correct handling of the DEBUG setting.
   - Support for automatic file type detection with `--filetype=auto` has been
     implemented.
   - The support for `--irreproducible-exitcode` argument was added

2. **Vim**
   - Fixed cursor handling issues in `LEvalMon`, improving text navigation and
     evaluation feedback within Vim.
   - Improve error reporting performed by the `LOpenErr` command.

Version 3.10.1
--------------

Minor environment changes

Version 3.10.0
--------------

1. **Python**
   - Code refactoring for better code management and efficiency: moved main
     logic in `litrepl` from `python/bin/litrepl` to a new file
     [python/litrepl/main.py](./python/litrepl/main.py).
   - Improved handling of subprocess management for the Python and AI
     interpreters, ensuring proper cleanup and output management. Additionally,
     calls to `os.system` were mostly replaced with native Python calls.
   - Added robust error handling and message retrieval for the interpreter
     interface, providing clearer errors when the interpreter fails.

2. **Vim**
   - Introduced the default environment variable check for `LITREPL_WORKDIR`,
     `LITREPL_PYTHON_AUXDIR`, `LITREPL_AI_AUXDIR` etc. environment variables.
   - Updated Vim functions to consider both buffer and global settings,
     improving flexibility in command generation (`LitReplGet` helper function).
   - Updated commands related to AI tasks like `:LAIStyle`, `:LAIFile`, and
     `:LAICode` to handle rephrasing and AI interaction more efficiently.
   - Adjusted internal Vim functions to handle text width settings and cursor
     positionings.

3. **Environment**
   - Replaced `test.sh` with [runtests.sh](./sh/runtests.sh) in the build and test
     process for enhanced test execution flow.
   - Allowed more environment configuration by introducing more settings that
     default from environment variables, streamlining setup customization.
   - Updated Nix build script ([default.nix](./default.nix)) to reflect changes
     in the test script location and hash updates for source verification.
   - Added this changelog and the AI-powered changelog helper script
     [diffchanges.sh](./sh/diffchanges.sh).

Version 3.9.0
-------------

1. **Python**
   - Added assertions to ensure a successful attachment to the interpreter,
     enhancing error handling robustness.

2. **Vim**
   - Enhanced [vim/plugin/litrepl.vim](./vim/plugin/litrepl.vim) by preserving
     caret positions and restructuring comments for function alignment.
   - Significant expansions in
     [vim/plugin/litrepl_extras.vim](./vim/plugin/litrepl_extras.vim) with
     multiple new functions for region handling, AI task management, and
     interaction across different scopes, substantially improving user
     experience with AI functionalities in Vim. Several new commands such as
     `LAITell`, `LAICont`, `LAIStyle`, `LAIFile`, and `LAICode` are introduced
     to support a wide range of code and AI-related tasks.

3. **Environment**
   - Added a new markdown file `./doc/screencast.md` with examples for
     evaluating Python code in Vim, offering insights into the screencast
     documentation process.
   - Adjusted `screencast.sh` to be executable and made improvements to
     accommodate a target file parameter.
   - Introduced a new test function `test_vim_ai_query` in `test.sh`,
     facilitating new test coverage for AI query functionality.


<div align="center">
<h1>
⌨️ LitRepl ⌨️
</h1>

[Changelog](./CHANGELOG.md) | [Installation](https://sergei-mironov.github.io/litrepl/installation) | [Usage](https://sergei-mironov.github.io/litrepl/usage/general-concepts/) | [Gallery](#-gallery)

[![](./img/coverage.svg)](./docs/coverage.md)
[![Litrepl tests](https://github.com/sergei-mironov/litrepl/actions/workflows/testing.yaml/badge.svg)](https://github.com/sergei-mironov/litrepl/actions/workflows/testing.yaml)

</div>

<!--
``` python
!echo -n Litrepl is a
!cat docs/static/description.md | sed '/^\#/d;/^$/d'
```
-->
<!--result-->
Litrepl is acommand-line processor for *Markdown* or *LaTeX* documents with
**literate programming** code sections. Instructed by its arguments, it
evaluates and updates sections via background interpreters. Interpreters can
stay active for a **read-eval-paste-loop** style.
<!--noresult-->

<div align="center">

![Peek 2024-07-18 20-50-2](https://github.com/user-attachments/assets/8e2b2c8c-3412-4bf6-b75d-d5bd1adaf7ea)

</div>


_Notes:_
* _[Literate programming](https://en.wikipedia.org/wiki/Literate_programming)_
* _[Read-eval-print loop](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop)_


<table border="0">
  <tr>
    <td>
      <a href="https://arxiv.org/abs/2501.10738">
        <img src="img/adobe_pdf.png" alt="PDF Icon">
      </a>
    </td>
    <td>
      Preprint: <i>(2025, Sergei Mironov)</i>
      <ins>Litrepl: Literate Paper Processor Promoting Transparency More Than Reproducibility</ins>
      <a href="https://arxiv.org/abs/2501.10738">arXiv:2501.10738</a>
    </td>
  </tr>
</table>

Features
--------

* **Document formats** <br/>
  Markdown _(Example [[MD]](./docs/examples/example.md))_ **|**
  [LaTeX](https://www.latex-project.org/)
  _(Examples [[TEX]](./docs/examples/example.tex)[[PDF]](./docs/examples/example.pdf))_
* **Interpreters** <br/>
  [Sh](https://en.wikipedia.org/wiki/Bourne_shell) **|**
  [Bash](https://www.gnu.org/software/bash/) **|**
  [Python](https://www.python.org/) **|**
  [IPython](https://ipython.org/) **|**
  [Aicli](https://github.com/sergei-mironov/aicli)
* **Editor integration** <br/>
  [Vim](https://www.vim.org/scripts/script.php?script_id=6117) _(plugin source included)_

Requirements
------------

* **POSIX-compatible OS**, typically a Linux. The tool relies on POSIX
  operations, notably pipes, and depends on certain Shell commands.
* **lark-parser** and **psutil** Python packages.
* **[Socat](http://www.dest-unreach.org/socat/)** (Optional) Needed for
  `litrepl repl` and Vim's `LTerm` commands to work.

Documentation
-------------

* [Installation](https://sergei-mironov.github.io/litrepl/installation/)
* [Basic usage](https://sergei-mironov.github.io/litrepl/usage/general-concepts/)
* [Formatting documents](https://sergei-mironov.github.io/litrepl/usage/formatting/)


For full documentation, check out the project's [GitHub Pages
site](https://sergei-mironov.github.io/litrepl/).

Gallery
-------

<details>
<summary>Basic usage (Show GIF)</summary>

![Peek 2024-07-18 20-50-2](https://github.com/user-attachments/assets/8e2b2c8c-3412-4bf6-b75d-d5bd1adaf7ea)

</details>

<details>
<summary>(Outdated!) AI capabilities (Show GIF)</summary>

![Peek 2024-11-28 20-48](https://github.com/user-attachments/assets/c91e6ac5-4230-47ad-b1bd-12b3d4d5f7f6)

</details>


<details>
<summary>Vimtex integration (Show Video)</summary>

We utilize LitRepl alongside the [Vimtex](https://github.com/lervag/vimtex) plugin to edit and
preview LaTeX documents instantly.

<video controls src="https://user-images.githubusercontent.com/4477729/187065835-3302e93e-6fec-48a0-841d-97986636a347.mp4" muted="true"></video>

</details>


