Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension is given by the notebook metadata stdin notebooks #1284

Merged
merged 3 commits into from
Dec 15, 2024
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ Jupytext ChangeLog
**Fixed**
- The `rst2md` tests have been fixed by requiring `sphinx<8` ([#1266](https://github.com/mwouts/jupytext/issues/1266))
- Some dependencies of the JupyterLab extensions were updated ([#1272](https://github.com/mwouts/jupytext/issues/1272), [#1273](https://github.com/mwouts/jupytext/issues/1273), [#1280](https://github.com/mwouts/jupytext/issues/1280), [#1285](https://github.com/mwouts/jupytext/issues/1285), [#1290](https://github.com/mwouts/jupytext/issues/1290))
- The pre-commit hook is now compatible with log.showsignature=True (#1281). Thanks to [Justin Lecher](https://github.com/jlec) for this fix.
- The pre-commit hook is now compatible with log.showsignature=True ([#1281](https://github.com/mwouts/jupytext/issues/1281)). Thanks to [Justin Lecher](https://github.com/jlec) for this fix.

**Added**
- Jupytext is now tested with Python 3.13 ([#1242](https://github.com/mwouts/jupytext/issues/1242)). Thanks to [Jerry James](https://github.com/jamesjer) for the suggested fixes!
- The extension of a notebook piped into stdin will be taken in the notebook metadata ([#1282](https://github.com/mwouts/jupytext/issues/1282))


1.16.4 (2024-07-12)
Expand Down
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: jupytext-dev
channels:
- defaults
- conda-forge
dependencies:
- python>=3.8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.4.3+dev

Some dependencies of the JupyterLab extensions were updated ([#1272](https://github.com/mwouts/jupytext/issues/1272), [#1273](https://github.com/mwouts/jupytext/issues/1273), [#1280](https://github.com/mwouts/jupytext/issues/1280), [#1285](https://github.com/mwouts/jupytext/issues/1285), [#1290](https://github.com/mwouts/jupytext/issues/1290))

# 1.4.3 (2024-05-05)

- JupyterLab's dependency `ejs` was updated from 3.1.9 to 3.1.10 ([#1231](https://github.com/mwouts/jupytext/issues/1231))
Expand Down
12 changes: 8 additions & 4 deletions src/jupytext/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,14 @@
if not insert_or_test_version_number():
return

_, ext = os.path.splitext(source_path)
assert not ext.endswith(".ipynb"), "source_path={} should be a text file".format(
source_path
)
if source_path == "-":
# https://github.com/mwouts/jupytext/issues/1282
ext = notebook.metadata["jupytext"]["text_representation"]["extension"]

Check warning on line 423 in src/jupytext/formats.py

View check run for this annotation

Codecov / codecov/patch

src/jupytext/formats.py#L423

Added line #L423 was not covered by tests
else:
_, ext = os.path.splitext(source_path)
assert not ext.endswith(
".ipynb"
), "source_path={} should be a text file".format(source_path)

version = (
notebook.metadata.get("jupytext", {})
Expand Down
Loading