Skip to content

Commit

Permalink
updating documantation to reflect new default format percent ploomber…
Browse files Browse the repository at this point in the history
  • Loading branch information
hypefi committed Feb 10, 2022
1 parent 707a1c8 commit 9b63b11
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 26 deletions.
Binary file modified doc/_static/img/basics/py-and-ipynb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions doc/api/spec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -635,10 +635,10 @@ Python/R scripts/notebooks receive a ``product`` variable in the
.. code-block:: py
:class: text-editor
# + tags=["parameters"]
# %% tags=["parameters"]
product = None
# + tags=["injected-parameters"]
# %% tags=["injected-parameters"]
product = '/path/to/output/data.csv'
# your code...
Expand Down Expand Up @@ -696,10 +696,10 @@ Python/R scripts/notebooks receive them in the "injected-parameters" cell:
.. code-block:: py
:class: text-editor
# + tags=["parameters"]
# %% tags=["parameters"]
my_param = None
# + tags=["injected-parameters"]
# %% tags=["injected-parameters"]
my_param = 42
# your code...
Expand Down Expand Up @@ -1064,4 +1064,4 @@ to override this behavior:
# scripts/my-script.py in Jupyter
input_path: '{{here}}/some/path/file.json'
For more on parametrized pipelines, check out the guide: :doc:`../user-guide/parametrized`.
For more on parametrized pipelines, check out the guide: :doc:`../user-guide/parametrized`.
18 changes: 9 additions & 9 deletions doc/get-started/basic-concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ as ``.py`` (script) and as a ``.ipynb`` (notebook) file:
:target: /_static/img/basics/py-and-ipynb.png
:alt: py-and-ipynb

Note that the ``.py`` script has some ``# +`` comments. Such markers allow us
Note that the ``.py`` script has some ``# %%`` comments. Such markers allow us
to delimit code cells and render the ``.py`` file as a notebook.

.. note::

The ``# +`` is just one way of representing ``.py`` as notebooks. Ploomber
uses jupytext to perform the conversion, so other popular formats such as the
"percent" (``# %%``) format work. Editors such as VS Code, Spyder, and
The ``# %%`` is one way of representing ``.py`` as notebooks. Ploomber
uses jupytext to perform the conversion, other formats such as the
"light" (``# +``) format work too. Editors such as VS Code, Spyder, and
PyCharm support the "percent" format.


Expand Down Expand Up @@ -146,10 +146,9 @@ editing. If a script/notebook has no dependencies, set ``upstream = None``.
:class: text-editor
:name: clean-py
# + tags=["parameters"]
# %% tags=["parameters"]
upstream = ['raw'] # this means: execute raw.py, then clean.py
product = None
# -
.. important::
Expand All @@ -160,7 +159,7 @@ editing. If a script/notebook has no dependencies, set ``upstream = None``.

.. note::

the ``# +`` and ``# -`` markers only apply to scripts.
the ``# %%`` markers only apply to scripts.
`Click here <https://docs.ploomber.io/en/latest/user-guide/faq_index.html#parameterizing-notebooks>`_
for information on adding tags to ``.ipynb`` files.

Expand All @@ -175,14 +174,15 @@ Let's review the contents a sample ``clean.py`` file:
import pandas as pd
# + tags=["parameters"]
# %% tags=["parameters"]
upstream = ["raw"]
product = None
# -
# %%
df = pd.read_csv(upstream['get']['data'])
# some data cleaning code...
# %%
# store clean data
df.to_csv(str(product['data']), index=False)
Expand Down
13 changes: 6 additions & 7 deletions doc/user-guide/faq/parameterize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,27 @@ the ``upstream`` parameter, which contains a list of task dependencies.
Parameterizing ``.py`` files
*****************************

For ``.py`` files, include the ``# + tags=["parameters]`` comment before declaring your default variables or parameters.
The ``# +`` marker denotes the beginning of a cell, and ``# -`` marker indicates the end of the cell. Your cell should look like this:
For ``.py`` files, include the ``# %% tags=["parameters]`` comment before declaring your default variables or parameters.


.. code-block:: python
:class: text-editor
# + tags=["parameters"]
# %% tags=["parameters"]
upstream = None
product = None
# -
Note that Ploomber is compatible with all ``.py`` formats supported by jupytext. Another common alternative is the percent format:
Note that Ploomber is compatible with all ``.py`` formats supported by jupytext. Another common alternative is the light format.
The ``# +`` marker denotes the beginning of a cell, and ``# -`` marker indicates the end of the cell. Your cell should look like this:


.. code-block:: python
:class: text-editor
# %% tags=["parameters"]
# + tags=["parameters"]
upstream = None
product = None
# -
If you're using another format, check out `jupytext's documentation <https://jupytext.readthedocs.io/en/latest/formats.html>`_.

Expand Down
6 changes: 3 additions & 3 deletions doc/user-guide/r-support.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ If you prefer, you can also use plain R scripts:
:class: text-editor
:name: task-R
# + tags=["parameters"]
# %% tags=["parameters"]
upstream = list('one_task', 'another_task')
# -
#
If your script doesn't have dependencies: ``upstream = NULL``
Expand Down Expand Up @@ -98,4 +98,4 @@ but takes about a minute to be ready):
.. image:: https://img.shields.io/badge/launch-session-579ACA.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAABZCAMAAABi1XidAAAB8lBMVEX///9XmsrmZYH1olJXmsr1olJXmsrmZYH1olJXmsr1olJXmsrmZYH1olL1olJXmsr1olJXmsrmZYH1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olJXmsrmZYH1olL1olL0nFf1olJXmsrmZYH1olJXmsq8dZb1olJXmsrmZYH1olJXmspXmspXmsr1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olLeaIVXmsrmZYH1olL1olL1olJXmsrmZYH1olLna31Xmsr1olJXmsr1olJXmsrmZYH1olLqoVr1olJXmsr1olJXmsrmZYH1olL1olKkfaPobXvviGabgadXmsqThKuofKHmZ4Dobnr1olJXmsr1olJXmspXmsr1olJXmsrfZ4TuhWn1olL1olJXmsqBi7X1olJXmspZmslbmMhbmsdemsVfl8ZgmsNim8Jpk8F0m7R4m7F5nLB6jbh7jbiDirOEibOGnKaMhq+PnaCVg6qWg6qegKaff6WhnpKofKGtnomxeZy3noG6dZi+n3vCcpPDcpPGn3bLb4/Mb47UbIrVa4rYoGjdaIbeaIXhoWHmZYHobXvpcHjqdHXreHLroVrsfG/uhGnuh2bwj2Hxk17yl1vzmljzm1j0nlX1olL3AJXWAAAAbXRSTlMAEBAQHx8gICAuLjAwMDw9PUBAQEpQUFBXV1hgYG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HGJc2R5hS219IiF6PnTusOqcMl57gm0Z8kanKMAQg0qSyuZfn7zItsbGyO9QlnxY0eCuD1XL2ys/MsrQhltE7Ug0uFOzufJFE2PxBo/YAx8XPPdDwWN0MrDRYIZF0mSMKCNHgaIVFoBbNoLJ7tEQDKxGF0kcLQimojCZopv0OkNOyWCCg9XMVAi7ARJzQdM2QUh0gmBozjc3Skg6dSBRqDGYSUOu66Zg+I2fNZs/M3/f/Grl/XnyF1Gw3VKCez0PN5IUfFLqvgUN4C0qNqYs5YhPL+aVZYDE4IpUk57oSFnJm4FyCqqOE0jhY2SMyLFoo56zyo6becOS5UVDdj7Vih0zp+tcMhwRpBeLyqtIjlJKAIZSbI8SGSF3k0pA3mR5tHuwPFoa7N7reoq2bqCsAk1HqCu5uvI1n6JuRXI+S1Mco54YmYTwcn6Aeic+kssXi8XpXC4V3t7/ADuTNKaQJdScAAAAAElFTkSuQmCC
:target: https://mybinder.org/v2/gh/ploomber/binder-env/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252Fploomber%252Fprojects%26urlpath%3Dlab%252Ftree%252Fprojects%252Ftemplates/spec-api-r%252FREADME.ipynb%26branch%3Dmaster

`Example source code <https://github.com/ploomber/projects/tree/master/templates/spec-api-r>`_
`Example source code <https://github.com/ploomber/projects/tree/master/templates/spec-api-r>`_
4 changes: 2 additions & 2 deletions doc/user-guide/spec-vs-python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ scripts support this, for example:
:class: text-editor
:name: task-py
# + tags=["parameters"]
# %% tags=["parameters"]
product = {'nb': 'output.ipynb', 'data': 'output.csv'}
upstream = ['a_task']
# -
#
# continues...
Expand Down

0 comments on commit 9b63b11

Please sign in to comment.