Debian Codegraph @

PKG-INFO

raw
1 Metadata-Version: 2.3
2 Name: jupytext
3 Version: 1.16.4
4 Summary: Jupyter notebooks as Markdown documents, Julia, Python or R scripts
5 Project-URL: Homepage, https://github.com/mwouts/jupytext
6 Project-URL: Source Code, https://github.com/mwouts/jupytext
7 Project-URL: Documentation, https://jupytext.readthedocs.io
8 Author-email: Marc Wouts <[email protected]>
9 License: MIT License
10
11 Copyright (c) 2018-2023 Marc Wouts
12
13 Permission is hereby granted, free of charge, to any person obtaining a copy
14 of this software and associated documentation files (the "Software"), to deal
15 in the Software without restriction, including without limitation the rights
16 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17 copies of the Software, and to permit persons to whom the Software is
18 furnished to do so, subject to the following conditions:
19
20 The above copyright notice and this permission notice shall be included in all
21 copies or substantial portions of the Software.
22
23 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 SOFTWARE.
30 License-File: LICENSE
31 Classifier: Development Status :: 5 - Production/Stable
32 Classifier: Environment :: Console
33 Classifier: Framework :: Jupyter
34 Classifier: Framework :: Jupyter :: JupyterLab :: 4
35 Classifier: Framework :: Jupyter :: JupyterLab :: Extensions
36 Classifier: Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt
37 Classifier: Intended Audience :: Developers
38 Classifier: Intended Audience :: Science/Research
39 Classifier: License :: OSI Approved :: MIT License
40 Classifier: Programming Language :: Python
41 Classifier: Programming Language :: Python :: 3
42 Classifier: Programming Language :: Python :: 3.8
43 Classifier: Programming Language :: Python :: 3.9
44 Classifier: Programming Language :: Python :: 3.10
45 Classifier: Programming Language :: Python :: 3.11
46 Classifier: Programming Language :: Python :: 3.12
47 Classifier: Topic :: Text Processing :: Markup
48 Requires-Python: >=3.8
49 Requires-Dist: markdown-it-py>=1.0
50 Requires-Dist: mdit-py-plugins
51 Requires-Dist: nbformat
52 Requires-Dist: packaging
53 Requires-Dist: pyyaml
54 Requires-Dist: tomli; python_version < '3.11'
55 Provides-Extra: dev
56 Requires-Dist: autopep8; extra == 'dev'
57 Requires-Dist: black; extra == 'dev'
58 Requires-Dist: flake8; extra == 'dev'
59 Requires-Dist: gitpython; extra == 'dev'
60 Requires-Dist: ipykernel; extra == 'dev'
61 Requires-Dist: isort; extra == 'dev'
62 Requires-Dist: jupyter-fs>=1.0; extra == 'dev'
63 Requires-Dist: jupyter-server!=2.11; extra == 'dev'
64 Requires-Dist: nbconvert; extra == 'dev'
65 Requires-Dist: pre-commit; extra == 'dev'
66 Requires-Dist: pytest; extra == 'dev'
67 Requires-Dist: pytest-cov>=2.6.1; extra == 'dev'
68 Requires-Dist: pytest-randomly; extra == 'dev'
69 Requires-Dist: pytest-xdist; extra == 'dev'
70 Requires-Dist: sphinx-gallery<0.8; extra == 'dev'
71 Provides-Extra: docs
72 Requires-Dist: myst-parser; extra == 'docs'
73 Requires-Dist: sphinx; extra == 'docs'
74 Requires-Dist: sphinx-copybutton; extra == 'docs'
75 Requires-Dist: sphinx-rtd-theme; extra == 'docs'
76 Provides-Extra: test
77 Requires-Dist: pytest; extra == 'test'
78 Requires-Dist: pytest-randomly; extra == 'test'
79 Requires-Dist: pytest-xdist; extra == 'test'
80 Provides-Extra: test-cov
81 Requires-Dist: ipykernel; extra == 'test-cov'
82 Requires-Dist: jupyter-server!=2.11; extra == 'test-cov'
83 Requires-Dist: nbconvert; extra == 'test-cov'
84 Requires-Dist: pytest; extra == 'test-cov'
85 Requires-Dist: pytest-cov>=2.6.1; extra == 'test-cov'
86 Requires-Dist: pytest-randomly; extra == 'test-cov'
87 Requires-Dist: pytest-xdist; extra == 'test-cov'
88 Provides-Extra: test-external
89 Requires-Dist: autopep8; extra == 'test-external'
90 Requires-Dist: black; extra == 'test-external'
91 Requires-Dist: flake8; extra == 'test-external'
92 Requires-Dist: gitpython; extra == 'test-external'
93 Requires-Dist: ipykernel; extra == 'test-external'
94 Requires-Dist: isort; extra == 'test-external'
95 Requires-Dist: jupyter-fs>=1.0; extra == 'test-external'
96 Requires-Dist: jupyter-server!=2.11; extra == 'test-external'
97 Requires-Dist: nbconvert; extra == 'test-external'
98 Requires-Dist: pre-commit; extra == 'test-external'
99 Requires-Dist: pytest; extra == 'test-external'
100 Requires-Dist: pytest-randomly; extra == 'test-external'
101 Requires-Dist: pytest-xdist; extra == 'test-external'
102 Requires-Dist: sphinx-gallery<0.8; extra == 'test-external'
103 Provides-Extra: test-functional
104 Requires-Dist: pytest; extra == 'test-functional'
105 Requires-Dist: pytest-randomly; extra == 'test-functional'
106 Requires-Dist: pytest-xdist; extra == 'test-functional'
107 Provides-Extra: test-integration
108 Requires-Dist: ipykernel; extra == 'test-integration'
109 Requires-Dist: jupyter-server!=2.11; extra == 'test-integration'
110 Requires-Dist: nbconvert; extra == 'test-integration'
111 Requires-Dist: pytest; extra == 'test-integration'
112 Requires-Dist: pytest-randomly; extra == 'test-integration'
113 Requires-Dist: pytest-xdist; extra == 'test-integration'
114 Provides-Extra: test-ui
115 Requires-Dist: calysto-bash; extra == 'test-ui'
116 Description-Content-Type: text/markdown
117
118 ![](https://github.com/mwouts/jupytext/blob/17aea37c612f33a4e27eeee4b81966f1506920fd/docs/images/logo_large.png?raw=true)
119
120 <!-- INDEX-START -->
121
122 [![CI](https://github.com/mwouts/jupytext/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/mwouts/jupytext/actions)
123 [![Documentation Status](https://readthedocs.org/projects/jupytext/badge/?version=latest)](https://jupytext.readthedocs.io/en/latest/?badge=latest)
124 [![codecov.io](https://codecov.io/github/mwouts/jupytext/coverage.svg?branch=main)](https://codecov.io/gh/mwouts/jupytext/branch/main)
125 [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
126 [![GitHub language count](https://img.shields.io/github/languages/count/mwouts/jupytext)](docs/languages.md)
127 [![Conda Version](https://img.shields.io/conda/vn/conda-forge/jupytext.svg)](https://anaconda.org/conda-forge/jupytext)
128 [![Pypi](https://img.shields.io/pypi/v/jupytext.svg)](https://pypi.python.org/pypi/jupytext)
129 [![pyversions](https://img.shields.io/pypi/pyversions/jupytext.svg)](https://pypi.python.org/pypi/jupytext)
130 [![Binder:lab](https://img.shields.io/badge/binder-jupyterlab-0172B2.svg)](https://mybinder.org/v2/gh/mwouts/jupytext/main?urlpath=lab/tree/demo/get_started.ipynb)
131 [![Binder:notebook](https://img.shields.io/badge/binder-notebook-0172B2.svg)](https://mybinder.org/v2/gh/mwouts/jupytext/main?filepath=demo)
132 [![launch - renku](https://renkulab.io/renku-badge.svg)](https://renkulab.io/projects/best-practices/jupytext/sessions/new?autostart=1)
133 [![](https://img.shields.io/badge/YouTube-JupyterCon%202020-red.svg)](https://www.youtube.com/watch?v=SDYdeVfMh48)
134
135 # Jupytext
136
137 Have you always wished Jupyter notebooks were plain text documents? Wished you could edit them in your favorite IDE? And get clear and meaningful diffs when doing version control? Then, Jupytext may well be the tool you're looking for!
138
139 ## Text Notebooks
140
141 A Python notebook encoded in the `py:percent` [format](docs/formats-scripts.md#the-percent-format) has a `.py` extension and looks like this:
142
143 ```
144 # %% [markdown]
145 # This is a markdown cell
146
147 # %%
148 def f(x):
149 return 3*x+1
150 ```
151
152 Only the notebook inputs (and optionally, the metadata) are included. Text notebooks are well suited for version control. You can also edit or refactor them in an IDE - the `.py` notebook above is a regular Python file.
153
154 We recommend the `percent` format for notebooks that mostly contain code. The `percent` format is available for Julia, Python, R and many other [languages](docs/languages.md).
155
156 If your notebook is documentation-oriented, a [Markdown-based format](docs/formats-markdown.md) (text notebooks with a `.md` extension) might be more appropriate. Depending on what you plan to do with your notebook, you might prefer the Myst Markdown format, which interoperates very well with Jupyter Book, or Quarto Markdown, or even Pandoc Markdown.
157
158 ## Installation
159
160 Install Jupytext in the Python environment that you use for Jupyter. Use either
161
162 pip install jupytext
163
164 or
165
166 conda install jupytext -c conda-forge
167
168 Then, restart your Jupyter Lab server, and make sure Jupytext is activated in Jupyter: `.py` and `.md` files have a Notebook icon, and you can open them as Notebooks with a right click in Jupyter Lab.
169
170 ![](https://github.com/mwouts/jupytext/blob/64b4be818508760116f91bf156342cb4cf724d93/docs/images/jupyterlab_right_click.png?raw=true)
171
172 ## Paired Notebooks
173
174 Text notebooks with a `.py` or `.md` extension are well suited for version control. They can be edited or authored conveniently in an IDE. You can open and run them as notebooks in Jupyter Lab with a right click. However, the notebook outputs are lost when the notebook is closed, as only the notebook inputs are saved in text notebooks.
175
176 A convenient alternative to text notebooks are [paired notebooks](docs/paired-notebooks.md). These are a set of two files, say `.ipynb` and `.py`, that contain the same notebook, but in different formats.
177
178 You can edit the `.py` version of the paired notebook, and get the edits back in Jupyter by selecting _reload notebook from disk_. The outputs will be reloaded from the `.ipynb` file, if it exists. The `.ipynb` version will be updated or recreated the next time you save the notebook in Jupyter.
179
180 To pair a notebook in Jupyter Lab, use the command `Pair Notebook with percent Script` from the Command Palette:
181
182 ![](https://github.com/mwouts/jupytext/blob/64b4be818508760116f91bf156342cb4cf724d93/docs/images/pair_commands.png?raw=true)
183
184 To pair all the notebooks in a certain directory, create a [configuration file](docs/config.md) with this content:
185
186 ```
187 # jupytext.toml at the root of your notebook directory
188 formats = "ipynb,py:percent"
189 ```
190
191 ## Command line
192
193 Jupytext is also available at the [command line](docs/using-cli.md). You can
194
195 - pair a notebook with `jupytext --set-formats ipynb,py:percent notebook.ipynb`
196 - synchronize the paired files with `jupytext --sync notebook.py` (the inputs are loaded from the most recent paired file)
197 - convert a notebook in one format to another with `jupytext --to ipynb notebook.py` (use `-o` if you want a specific output file)
198 - pipe a notebook to a linter with e.g. `jupytext --pipe black notebook.ipynb`
199
200 ## Sample use cases
201
202 ### Notebooks under version control
203
204 This is a quick how-to:
205 - Open your `.ipynb` notebook in Jupyter and [pair](docs/paired-notebooks.md) it to a `.py` notebook, using either the _pair_ command in Jupyter Lab, or a global [configuration file](docs/config.md)
206 - Save the notebook - this creates a `.py` notebook
207 - Add this `.py` notebook to version control
208
209 You might exclude `.ipynb` files from version control (unless you want to see the outputs versioned!). Jupytext will recreate the `.ipynb` files locally when the users open and save the `.py` notebooks.
210
211 ### Collaborating on notebooks with Git
212
213 Collaborating on Jupyter notebooks through Git becomes as easy as collaborating on text files.
214
215 Assume that you have your `.py` notebooks under version control (see above). Then,
216 - Your collaborator pulls the `.py` notebook
217 - They open it _as a notebook_ in Jupyter (right-click in Jupyter Lab)
218 - At that stage the notebook has no outputs. They run the notebook and save it. Outputs are regenerated, and a local `.ipynb` file is created
219 - They edit the notebook, and push the updated `notebook.py` file. The diff is nothing else than a standard diff on a Python script.
220 - You pull the updated `notebook.py` script, and refresh your browser. The input cells are updated based on the new content of `notebook.py`. The outputs are reloaded from your local `.ipynb` file. Finally, the kernel variables are untouched, so you have the option to run only the modified cells to get the new outputs.
221
222 ### Editing or refactoring a notebook in an IDE
223
224 Once your notebook is [paired](docs/paired-notebooks.md) with a `.py` file, you can easily edit or refactor the `.py` representation of the notebook in an IDE.
225
226 Once you are done editing the `.py` notebook, you will just have to _reload_ the notebook in Jupyter to get the latest edits there.
227
228 Note: It is simpler to close the `.ipynb` notebook in Jupyter when you edit the paired `.py` file. There is no obligation to do so; however, if you don't, you should be prepared to read carefully the pop-up messages. If Jupyter tries to save the notebook while the paired `.py` file has also been edited on disk since the last reload, a conflict will be detected and you will be asked to decide which version of the notebook (in memory or on disk) is the appropriate one.
229
230 ## More resources
231
232 Read more about Jupytext in the [documentation](https://jupytext.readthedocs.io).
233
234 If you're new to Jupytext, you may want to start with the [FAQ](docs/faq.md) or with the [Tutorials](docs/tutorials.md).
235
236 There is also this short introduction to Jupytext: [![](https://img.shields.io/badge/YouTube-JupyterCon%202020-red.svg)](https://www.youtube.com/watch?v=SDYdeVfMh48).