Skip to content

Conversation

@lgirdwood
Copy link
Member

Build the sof docs outside of the source directory and within a Python virtual environment.

# this needs to run from the Zephyr python virtual environment
# so that the python packages are available (and more up to date than
# the system packages).
source ~/zephyrproject/.venv/bin/activate
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firstly I don't think a requirement of zephyrproject being called that way and being in $HOME should be imposed. This isn't just for docker images or DUTs, this is for developers, using these manually on their development machines, right? Secondly, I also use venv, I'm not against it in general, but has it become an absolute requirement yet? Thirdly, the venv directory doesn't necessarily have to be called .venv, I've seen multiple examples just using venv and that's also what I use FWIW. Wouldn't it be better, if we do want to enforce the use of venv, to just check that it's enabled and error out otherwise? In general, I'd leave it to the user to activate and deactivate the venv.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This really needs to be simple and align to the getting started documentation for both SOF and Zephyr. Going off track here just add complexity.

https://docs.zephyrproject.org/latest/develop/getting_started/index.html#get-zephyr-and-install-python-dependencies

Firstly I don't think a requirement of zephyrproject being called that way and being in $HOME should be imposed.

Zephyr is locked in as a hard requirement now and the path aligns with the instructions that most developers will use.

This isn't just for docker images or DUTs, this is for developers, using these manually on their development machines, right?

This is for developers, github runners and docker. Its really simple now to get the right ingredients to build docs.

Secondly, I also use venv, I'm not against it in general, but has it become an absolute requirement yet? Thirdly, the venv directory doesn't necessarily have to be called .venv, I've seen multiple examples just using venv and that's also what I use FWIW. Wouldn't it be better, if we do want to enforce the use of venv, to just check that it's enabled and error out otherwise? In general, I'd leave it to the user to activate and deactivate the venv.

Again this is following the default instructions. Yes a Python virtual environment is needed as pip is better managed for python support than apt-get based python packages. Leaving it to the user is just an extra step and then the system python packages could be used and fail (and hence developers may then waste time/effort debugging). This scripts are for convenience, developers can still manually invoke a venv and manually run make if they so desire.

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will surprise (e.g. all my working trees on all my machines), but I can live with making the default setup easier. We do have a "choose-your-workspace" approach in our own SOF docs https://thesofproject.github.io/latest/getting_started/build-guide/build-with-zephyr.html

lgirdwood and others added 2 commits April 1, 2025 15:11
System tools for sphinx etc tend to be behind the versions available
via pip. Prefer the pip version and automatically enable the Python
virtual environment when starting the script.

Signed-off-by: Liam Girdwood <liam.r.girdwood@intel.com>
Move the intermediate doxygen build output out of the source directory.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
@lgirdwood lgirdwood force-pushed the lrg/topic/sof-docs branch from 841e74f to 3e3ce61 Compare April 1, 2025 14:14
Copy link
Contributor

@jsarha jsarha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to build the sof-docs with this PR, but I am not sure if Zephyr's python virtual environment is better for the job than any other virtual environment. AFAIK sof-docs build does not need west or any other Zephyr dependencies, but it needs several other packages that are not in the Zephyr's python virtual environment.

Then again it I guess it does not matter which virtual environment is used, but it would be nice if the script would install the dependecies, and one would not need to do so one by one after hitting each of them. So could there be flag or test to check if running pip install for sphinx, sphinx_rtd_theme, breathe, sphinxcontrib.plantuml, and sphinxcontrib.blockdiag is needed?

In any case this gives a hint that a python virtual environment helps in building the docs, so this is an improvement.

@lgirdwood lgirdwood merged commit 3c2eb1d into thesofproject:main Apr 8, 2025
43 of 49 checks passed
@lgirdwood lgirdwood deleted the lrg/topic/sof-docs branch April 8, 2025 10:05
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

Successfully merging this pull request may close these issues.

5 participants