Skip to content

Commit

Permalink
Improve callgraph (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
bollwyvl authored Jul 14, 2024
1 parent 94ed3fc commit 20f7666
Show file tree
Hide file tree
Showing 17 changed files with 772 additions and 329 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ jobs:
with:
pixi-version: v0.25.0
cache: true
environments: build docs
environments: build docs test test-oldest
- run: pixi run dist
- run: pixi run test
- run: pixi run docs-lite
- run: pixi run docs
- uses: actions/upload-pages-artifact@v3
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

## Install

### From PyPI

> **This package is not yet released.**
>
> ```bash
Expand All @@ -30,4 +32,9 @@
## Screenshots
> TODO
| note | screenshot |
| ------------------------------------------------------------------- | :-----------------------------: |
| viewing `pyinstrument` profile data with `speedscope` and `mermaid` | [![screenshot-1]][screenshot-1] |
[screenshot-1]:
https://private-user-images.githubusercontent.com/45380/348560542-ea0f7649-e35e-482b-971b-80d54ec2678d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA5Nzg2MTcsIm5iZiI6MTcyMDk3ODMxNywicGF0aCI6Ii80NTM4MC8zNDg1NjA1NDItZWEwZjc2NDktZTM1ZS00ODJiLTk3MWItODBkNTRlYzI2NzhkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE0VDE3MzE1N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY5YTI5MTY1ODdkMDk2ODVhYzc1ZTQ5ZDNmYjAzZmI5ZjlmMzE2YmMyYTE2NDQ2NGM4YmQzMjY5YTg5NGEzYWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.28eNu41jxBbyNIJB-KxQHFqBJJGa2MLOXbdNkjI1V00
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
ROOT = HERE.parent
PYPROJ = ROOT / "pyproject.toml"
PIXI = ROOT / "pixi.toml"
REPORTS = ROOT / "build/reports"

if os.getenv(RTD) == "True":
# provide a fake root doc
Expand Down Expand Up @@ -51,6 +52,7 @@ def _run_pixi(*_args: Any) -> None:
)

intersphinx_mapping = {k: (v, None) for k, v in _intersphinx_mapping.items()}
REPORTS.mkdir(parents=True, exist_ok=True)


# RTD will inject more config below here
46 changes: 6 additions & 40 deletions examples/files/02_python.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "b82ac82a-e6d5-4f74-8be8-c5e5aa095be6",
"metadata": {},
"source": [
"## Profiling Python\n",
"# Profiling Python\n",
"\n",
"Python (and `IPython`) provide built-in tools for profiling, enhanced for interactive computing by `IPython`', with a number of third-party tools like `pyinstrument` that refine and extend these tools. `ipyprofile` provides [`Pyinstrument`](#Pyinstrument), building on top of these tools."
]
Expand Down Expand Up @@ -66,18 +66,6 @@
"This magic also cannot handle \"top-level `await`\", increasingly seen even in interactive computing. "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0c2df3cc-1d8e-483f-96d8-4032fd30be48",
"metadata": {},
"outputs": [],
"source": [
"import asyncio\n",
"\n",
"loop = asyncio.get_running_loop()"
]
},
{
"cell_type": "markdown",
"id": "eab89b16-34b6-4832-b981-d0f7f8ff4f74",
Expand Down Expand Up @@ -166,7 +154,7 @@
"id": "ba2dc53f-6bd3-417b-839f-fd64388db996",
"metadata": {},
"source": [
"While this provides additional insights, `pyinstrument` _also_ provides support for `speedscope` JSON, allowing it to to be used directly with `Flamegraph`, as well as its own JSON format."
"While `pyinstrument` provides additional insights, and has a detailed JSON format, and _also_ provides support for `speedscope` JSON, allowing it to to be used directly with the `Flamegraph` widget."
]
},
{
Expand All @@ -184,7 +172,7 @@
"id": "c6ad2d8b-393d-477e-ac46-8b74ced7a4a6",
"metadata": {},
"source": [
"## Basic Example\n",
"### Basic Example\n",
"\n",
"For simplicity, the `Pyinstrument` examples below use the naive Fibonacci sequence (`fib`) and its asynchronous counterpart (`afib`), defined above."
]
Expand Down Expand Up @@ -229,18 +217,6 @@
" fib(15)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "56dbbb1c-e01a-4be9-8950-d7d8e8e776a8",
"metadata": {},
"outputs": [],
"source": [
"with ps.callgraph.hold_sync():\n",
" ps.callgraph.use_elk = ps.callgraph.show_time = ps.callgraph.group_by_file = 1\n",
" ps.callgraph.direction = \"left_to_right\""
]
},
{
"cell_type": "markdown",
"id": "cedae0ac-7d44-4438-b4b8-1ce6d688b0d4",
Expand Down Expand Up @@ -273,7 +249,7 @@
"id": "95db9b9c-6aa4-4e19-8918-2f4afc95d7a5",
"metadata": {},
"source": [
"`Pypseedscope` and `.profile` expose a few additional options:"
"`Pyinstrument` and `.profile` expose a few additional options:"
]
},
{
Expand Down Expand Up @@ -309,7 +285,7 @@
"id": "326d8b31-919e-4767-9bb7-304549546a25",
"metadata": {},
"source": [
"## Asynchronous Code"
"### Asynchronous Code"
]
},
{
Expand Down Expand Up @@ -338,7 +314,7 @@
"id": "885a97d0-7b3d-4517-a2b3-ae5eab2017ca",
"metadata": {},
"source": [
"## Multiple Cells\n",
"### Multiple Cells\n",
"\n",
"Profiling a single block of code with the `.profile` context manager will usually show the most useful output, but setting the `.profiling` member directly is possible. This will show the mechanics of `IPython` and `ipykernel` along with the code of interest."
]
Expand Down Expand Up @@ -388,16 +364,6 @@
"mps.tabs()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "19794eee-e8eb-4458-9097-3f64c8e35137",
"metadata": {},
"outputs": [],
"source": [
"mps.callgraph.show_options()"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
2 changes: 1 addition & 1 deletion js/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const VERSION = PKG.version;
import { Token } from '@lumino/coreutils';

export interface IFlameGraph {
//
// nothing here yet.
}

export const IFlameGraph = new Token<IFlameGraph>(`${NAME}:plugin`);
Expand Down
Loading

0 comments on commit 20f7666

Please sign in to comment.