Skip to content
Merged
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v1.0.1 (Unreleased)

- Fixed compatibility with Cyclopts v4.
- Fixed compatibility with pygments v2.20+.

## v1.0.0 (2025-02-15)

This release involves major changes to reprexlite. There is a significant refactoring of the library internals and also many changes to the API. This enabled new feature and more customizability.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"

[project]
name = "reprexlite"
version = "1.0.0"
version = "1.0.1"
description = "Render reproducible examples of Python code for sharing."
readme = "README.md"
authors = [{ name = "Jay Qi", email = "jayqi.opensource@gmail.com" }]
Expand Down
6 changes: 6 additions & 0 deletions reprexlite/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ def get_help():
),
)

# cyclopts v4 defaults to sys.exit-ing with the command's return value. We call app()
# programmatically from the IPython magics, so we need the return value itself. cyclopts v3, which
# is still resolved on Python 3.9, always does this and has no such attribute.
if hasattr(app, "result_action"):
app.result_action = "return_value"


def launch_ipython(config: ReprexConfig):
try:
Expand Down
4 changes: 3 additions & 1 deletion reprexlite/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ def format_as_html(reprex_str: str, config: Optional[ReprexConfig] = None) -> st
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonLexer

formatter = HtmlFormatter(style="friendly", lineanchors=True, linenos=True, wrapcode=True)
formatter = HtmlFormatter(
style="friendly", lineanchors="line", linenos=True, wrapcode=True
)
out.append(f"<style>{formatter.get_style_defs('.highlight')}</style>")
out.append(highlight(str(reprex_str), PythonLexer(), formatter))
except ImportError:
Expand Down
6 changes: 3 additions & 3 deletions tests/assets/ad/html.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions tests/assets/html.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions tests/assets/no_ad/html.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions tests/assets/session_info/html.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading