A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
Update pygments version constraint in pyproject.toml (#8921)
Thomas Schmelzer40f32ebb9d5e
diff --git a/Makefile b/Makefileindex 7acf0ff501..4f654e56a0 100644--- a/Makefile+++ b/Makefile@@ -138,7 +138,8 @@ py-snapshots:uv run --group test pytest \tests/_server/templates/test_templates.py \tests/_server/api/endpoints/test_export.py \- tests/test_api.py+ tests/test_api.py \+ tests/test_project_dependencies.py############### Packaging #diff --git a/marimo/_output/md.py b/marimo/_output/md.pyindex 8c47acfb76..0b1c1efb15 100644--- a/marimo/_output/md.py+++ b/marimo/_output/md.py@@ -35,7 +35,7 @@ class PyconDetectorExtension(markdown.Extension):def extendMarkdown(self, md: markdown.Markdown) -> None:"""Add the preprocessor to the markdown instance."""processor = PyconDetectorPreprocessor(md)- md.preprocessors.register(processor, "pycon_detector", 30)+ md.preprocessors.register(processor, "pycon_detector", 175)class PyconDetectorPreprocessor(markdown.preprocessors.Preprocessor):@@ -53,9 +53,12 @@ class PyconDetectorPreprocessor(markdown.preprocessors.Preprocessor):def __init__(self, md: markdown.Markdown) -> None:super().__init__(md)- # Pattern to match fenced code blocks+ # Pattern to match fenced code blocks (backreference \2 ensures the+ # closing fence matches the opening fence marker, preventing greedy+ # over-consumption of adjacent fenced blocks)self.fence_pattern = re.compile(- r"^(\s*)```(\w*)\s*\n(.*?)^(\s*)```\s*$", re.MULTILINE | re.DOTALL+ r"^(\s*)(```+|~~~+)(\w*)\s*\n(.*?)^\s*\2\s*$",+ re.MULTILINE | re.DOTALL,)def run(self, lines: list[str]) -> list[str]:@@ -64,14 +67,14 @@ class PyconDetectorPreprocessor(markdown.preprocessors.Preprocessor):def replace_fence(match: re.Match[str]) -> str:indent = match.group(1)- language = match.group(2) or ""- code = match.group(3)+ fence = match.group(2)+ language = match.group(3) or ""+ code = match.group(4)# Only process if no language is specified- if not language:- if self._detect_pycon(code):- # Replace with pycon language- return f"{indent}```pycon\n{code}{indent}```"+ if not language and self._detect_pycon(code):+ # Replace with pycon language+ return f"{indent}{fence}pycon\n{code}{indent}{fence}"# Return originalreturn match.group(0)@@ -250,7 +253,10 @@ class _md(Html):text,extensions=_get_extensions(),extension_configs=_get_extension_configs(),- ).strip()+ )+ if html_text is None:+ html_text = ""+ html_text = html_text.strip()# replace <p> tags with <span> as HTML doesn't allow nested <div>s in <p>shtml_text = html_text.replace("<p>", '<span class="paragraph">'diff --git a/pyproject.toml b/pyproject.tomlindex 95cc088c00..c81318334f 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -17,10 +17,10 @@ dependencies = [# compile markdown to html"markdown>=3.6,<4",# add features to markdown- # Pinned to specific version for introduction of codeblock handling.- "pymdown-extensions>=10.15,<11",+ # 10.21.2+ required for compatibility with pygments>=2.20 (filename=None fix).+ "pymdown-extensions>=10.21.2,<11",# syntax highlighting of code in markdown- "pygments>=2.19,<3",+ "pygments>=2.20,<3",# for reading, writing configs"tomlkit>=0.12.0",# for managing frontmatter headers in markdowndiff --git a/tests/snapshots/dependencies.txt b/tests/snapshots/dependencies.txtindex 9524422e04..d5b610ef54 100644--- a/tests/snapshots/dependencies.txt+++ b/tests/snapshots/dependencies.txt@@ -8,8 +8,8 @@ msgspec>=0.20.0narwhals>=2.0.0packagingpsutil>=5.0-pygments>=2.19,<3-pymdown-extensions>=10.15,<11+pygments>=2.20,<3+pymdown-extensions>=10.21.2,<11pyyaml>=6.0.1pyzmq>=27.1.0; python_version < '3.15'starlette>=0.37.2