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

Various Documentation Improvements #6682

Merged
merged 4 commits into from
Apr 8, 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions doc/tutorials/basic/align.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,12 @@ image = pn.pane.PNG("https://assets.holoviz.org/panel/tutorials/wind_turbine.png

card1 = pn.Card(image, title='Turbine 1', height=150, width=200, align="center")
card2 = pn.Card(image, title='Turbine 2', height=150, width=200, align="center")
spacer = pn.Spacer(height=33)
spacer1 = pn.Spacer(height=33)
spacer2 = pn.Spacer(height=33)
spacer3 = pn.Spacer(height=33)

pn.Column(
spacer, card1, spacer, card2,
spacer1, card1, spacer2, card2, spacer3,
sizing_mode="fixed", width=400, height=400, styles={"border": "1px solid black"}
).servable()
```
Expand Down
2 changes: 0 additions & 2 deletions doc/tutorials/basic/progressive_layouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ def classify(image):
return random.choice(OPTIONS)

# Reactive expressions
has_result = result.rx.pipe(bool)

def _show_submit_message(result, is_running):
return not result and not is_running

Expand Down
42 changes: 38 additions & 4 deletions doc/tutorials/intermediate/develop_editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

In this section you will learn more advances techniques to develop efficiently in an editor:

- Resetting the cache with `pn.state.clear_caches()` or `some_cached_func.clear()`.
- Debug with [Pdb](https://docs.python.org/3/library/pdb.html) by inserting a `breakpoint()`

:::{note}
Expand All @@ -12,6 +13,38 @@ This guide builds upon the [Develop in an Editor (beginner)](../basic/develop_ed
Some of the features demonstrated in this guide might require special configuration of your editor. For configuration we refer you to the [Resources](#resources) section below and general resources on the web.
:::

## Resetting the Cache

When developing with the `--autoreload` option and utilizing caching, you may need to reset the cache. You have the option to clear either the entire cache or just the cache for a specific function.

Execute the code below:

```python
import panel as pn
from datetime import datetime

pn.extension()

# To clear the entire cache, uncomment the following line:
# pn.state.clear_caches()

@pn.cache
def get_data():
return datetime.now()

# To clear the cache for this specific function, uncomment:
# get_data.clear()

pn.panel(get_data).servable()
```

To reset the cache, uncomment and use either `pn.state.clear_caches()` for the entire cache or `get_data.clear()` for the specific function's cache. Below is a video demonstrating this process:

<video muted controls loop poster="../../_static/images/clear-cache-with-autoreload.png" style="max-height: 400px; max-width: 100%;">
<source src="https://assets.holoviz.org/panel/tutorials/clear-cache-with-autoreload.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>

## Debug your App with Pdb

A simple way to debug your apps that works in any editor is to insert a `breakpoint()`.
Expand Down Expand Up @@ -95,6 +128,7 @@ For *integrated debugging* in your editor, please refer to the [Resources](#reso

You have learned to

- Reset the cache with `pn.state.clear_caches()` or `some_cached_func.clear()`.
- Debug with [Pdb](https://docs.python.org/3/library/pdb.html) by inserting a `breakpoint()`

## Resources
Expand All @@ -103,11 +137,11 @@ You have learned to

- [Develop in an Editor (Beginner)](../basic/develop_editor.md)

## Explanation

- [Develop Seamlessly](../../explanation/develop_seamlessly.md)

### How-to

- [Configure PyCharm](../../how_to/editor/pycharm_configure.md)
- [Configure VS Code](../../how_to/editor/vscode_configure.md)

## Explanation

- [Develop Seamlessly](../../explanation/develop_seamlessly.md)