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

performance.py file not found #33

Open
dstansby opened this issue Nov 20, 2023 · 1 comment
Open

performance.py file not found #33

dstansby opened this issue Nov 20, 2023 · 1 comment

Comments

@dstansby
Copy link
Contributor

I'm trying to use sphinx-analysis on a local sphinx project, but getting the following error:

% sphinx-analysis --project . --runtime --flamegraph

Running 1 test configurations.

───────────────────────────────────────────────────────────────────────────────────── Run 1/1 ──────────────────────────────────────────────────────────────────────────────────────
performance.py file not found
Errors in configuration. Skipping this run.

Starting snakeviz servers


Killing snakeviz server in 5 secs.
snakeviz: error: the path /Users/dstansby/software/sunpy/docs/runtime_all.prof does not exist

usage: snakeviz [-h] [-v] [-H ADDR] [-p PORT] [-b BROWSER_PATH] [-s] filename

Start SnakeViz to view a Python profile.

positional arguments:
  filename              Python profile to view

options:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -H ADDR, --hostname ADDR
                        hostname to bind to (default: 127.0.0.1)
  -p PORT, --port PORT  port to bind to; if this port is already in use a free port will be selected automatically (default: 8080)
  -b BROWSER_PATH, --browser BROWSER_PATH
                        name of webbrowser to launch as described in the documentation of Python's webbrowser module: https://docs.python.org/3/library/webbrowser.html
  -s, --server          start SnakeViz in server-only mode--no attempt will be made to open a browser
@ubmarco
Copy link
Member

ubmarco commented Nov 21, 2023

Using sphinx-performance directly on a custom project is not yet supported. Setting --project to a custom project path just means you are providing a custom project template that must conform to the structure of the others in https://github.com/useblocks/sphinx-performance/tree/main/sphinx_performance/projects. That means the path needs to contain the files

conf.template
index.template
page.template
performance.py
requirements.template

What you could do and what I've successfully done in the past is to:

  1. Rename your conf.py to conf.template
  2. Rename your root index.rst to index.template
  3. Create an empty page.template
  4. Create an empty requirements.template (sphinx-performance will install the listed dependencies to your active venv; if it already contains all project deps then you're fine)
  5. Copy and modify performance.py, so the values dummies, pages, folders and depth are set to 0.

This way you trick sphinx-performance in doing nothing but still get the support for memray and pyinstrument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants