Skip to content

Commit

Permalink
Remove even more sphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
pabera committed Nov 4, 2023
1 parent 23abee3 commit 6f55597
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 238 deletions.
2 changes: 0 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ filename = *.py,*.py.*
extend-exclude =
# Ignore all scratch development directories
scratch*,
# The conf file is mostly autogenerated, ignore it
docs/sphinx/conf.py,
# Ignore dirs and files that have not been ported yet
*/jukebox/NvManager.py
# ignore GitHub Codespaces
Expand Down
13 changes: 1 addition & 12 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,7 @@ if [[ -n $PY_FILES ]]; then
echo "Flake8 return code: $flake8_code"
fi

DOC_FILES="$(git diff --diff-filter=d --staged --name-only -- docs/sphinx/*)"
sphinx_code=0
if [[ -n $DOC_FILES || -n $PY_FILES ]]; then
echo -e "\n**************************************************************"
echo -e "Files for documentation modified. Testing re-build of docs ... \n"
echo -e "**************************************************************\n"
./run_sphinx.sh -c
sphinx_code=$?
echo "Sphinx return code: $sphinx_code"
fi

code=$(( flake8_code + sphinx_code ))
code=$(( flake8_code ))

if [[ code -gt 0 ]]; then
echo -e "\n**************************************************************"
Expand Down
13 changes: 1 addition & 12 deletions .github/workflows/pythonpackage_future3.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Python + Docs Checks and Tests
name: Python Checks and Tests

on:
push:
Expand All @@ -7,14 +7,12 @@ on:
paths:
- '**.py'
- '**.py.*'
- 'docs/sphinx/**'
pull_request:
branches:
- 'future3/**'
paths:
- '**.py'
- '**.py.*'
- 'docs/sphinx/**'

jobs:
build:
Expand All @@ -40,9 +38,6 @@ jobs:
pip3 install spidev
pip3 install -r requirements.txt
# For operation of the Jukebox, ZMQ must be compiled from sources due to Websocket support
# When just building the docs, the regular ZMQ package is sufficient
pip3 install -r docs/sphinx/requirements_pyzmq.txt
pip3 install -r docs/sphinx/requirements.txt
# Also install all optional dependencies
pip3 install -r src/jukebox/components/rfid/hardware/fake_reader_gui/requirements.txt
pip3 install -r src/jukebox/components/rfid/hardware/pn532_i2c_py532/requirements.txt
Expand All @@ -53,9 +48,3 @@ jobs:
pip3 install flake8
# Stop the build if linting fails
./run_flake8.sh
- name: Build the docs
working-directory: ./docs/sphinx
run: |
# Stop the build if documentation cannot be built
# Treat all warnings as errors
sphinx-build -W --keep-going -T -a -E -b html . _build
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
/shared/*.*
/shared/*

# Documentation builder
/docs/sphinx/_build/

# Application
/src/cli_client/pbc

Expand Down
28 changes: 0 additions & 28 deletions .readthedocs.yaml

This file was deleted.

16 changes: 3 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ The Jukebox core app is written entirely in Python. Therefore, we follow the [Py

* **Documentation**
* You are expected to write some Documentation. It's easy. **Very** easy actually with [Python Docstrings](https://www.geeksforgeeks.org/python-docstrings/)
* If you dare, you may add the python documentation reference to the Sphinx documentation build. But we are also ok with doing that for you

# Structure of files and folders

Inside the root folder or the repo, these folders are important:
Expand All @@ -38,8 +36,8 @@ Inside the root folder or the repo, these folders are important:
* contains the Python packages that are loaded using the plugin interface
* `src/webapp`
* contains the Web Interface
* `src/docs/sphinx`
* contains the documentation sources and build flow using Sphinx
* `src/documentation`
* contains the documentation sources

All folders on all hierarchy levels starting with `scratch*` are ignored by git and flake8. These are intended
as local, temporary scratch areas.
Expand Down Expand Up @@ -134,15 +132,7 @@ Let us know in the pull request - we will look at it.
### Documentation
When adding or improving documentation, build the documentation and look at it locally.
If you are contributing to existing Python modules, be aware that these are already included in the documentation flow.
Also run through this step in this case! Fix all warnings!
~~~bash
$ cd /home/pi/RPi-Jukebox-RFID/
$ ./run_sphinx.sh
# open and check the result: 'file:///path/to/RPi-Jukebox-RFID/docs/sphinx/_build/html/index.html'
~~~
TODO: Requires updates after Sphinx has been removed
### Tests
Expand Down
19 changes: 1 addition & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,7 @@ project check out the [documentation of Version 2](<https://github.com/MiczFlor/

## Where are the Help pages?

### Online

Read the documentation at [Readthedocs.io](https://rpi-jukebox-rfid.readthedocs.io/en/latest/)

### Local

Alternatively, build the help locally:

~~~bash
cd docs/sphinx
make
~~~

Then navigate your browser to

~~~bash
file:///path/to/RPi-Jukebox-RFID/docs/sphinx/_build/html/docs/index.html
~~~
Read the [documentation](./documentation/)

## Installation?

Expand Down
24 changes: 0 additions & 24 deletions installation/routines/customize_options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -188,29 +188,6 @@ ${DISABLE_ONBOARD_AUDIO_BACKUP} if things go pear-shaped.)

}

_option_build_local_docs() {
echo -e "Do you want to build the documentation locally and
make it available under http://ip.of.your.box/docs ?
Note:
- This will force enable=true for the WebApp
- Up to date documentation is also always available online
Build and serve docs locally? [y/N] " 1>&3
read -r response
case "$response" in
[yY])
ENABLE_LOCAL_DOCS=true
ENABLE_WEBAPP=true
;;
*)
;;
esac

echo "ENABLE_LOCAL_DOCS=${ENABLE_LOCAL_DOCS}"
echo "ENABLE_WEBAPP=${ENABLE_WEBAPP}"

}

_option_webapp_devel_build() {
# Let's detect if we are on the official release branch
if [[ "$GIT_BRANCH" != "${GIT_BRANCH_RELEASE}" || "$GIT_USER" != "$GIT_UPSTREAM_USER" ]]; then
Expand Down Expand Up @@ -250,7 +227,6 @@ customize_options() {
_option_disable_onboard_audio
_option_samba
_option_webapp
_option_build_local_docs
if [[ $ENABLE_WEBAPP == true ]] ; then
_option_kiosk_mode
_option_webapp_devel_build
Expand Down
9 changes: 0 additions & 9 deletions installation/routines/setup_jukebox_webapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ _jukebox_webapp_register_as_system_service_with_nginx() {
sudo service nginx restart
}

_jukebox_build_local_docs() {
echo " Build docs locally" | tee /dev/fd/3
"${INSTALLATION_PATH}/run_sphinx.sh" -c
}


setup_jukebox_webapp() {
echo "Install web application" | tee /dev/fd/3

Expand All @@ -88,9 +82,6 @@ setup_jukebox_webapp() {
# Needs to be done after reboot! There will be a message at the end of the installation process
# _jukebox_webapp_build
fi
if [[ $ENABLE_LOCAL_DOCS == true ]]; then
_jukebox_build_local_docs
fi
_jukebox_webapp_register_as_system_service_with_nginx

echo "DONE: setup_jukebox_webapp"
Expand Down
4 changes: 0 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ tornado
# On regular Linux PCs, Websocket is enabled in the Python package
# pyzmq

# Documentation build flow
sphinx
sphinx_rtd_theme

# Code quality
flake8>=4.0.0
pytest
Expand Down
38 changes: 7 additions & 31 deletions resources/default-settings/nginx.default
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,15 @@ server {
}


location /docs {
root /home/pi/RPi-Jukebox-RFID/docs/sphinx/_build/html;
try_files $uri $uri/ =404;
location = /docs/index.html {
error_page 404 = @runsphinx;
log_not_found off;
}
location = /docs {
error_page 404 = @runsphinx;
log_not_found off;
}
location = /docs/ {
error_page 404 = @runsphinx;
log_not_found off;
}

}

location /logs {
root /home/pi/RPi-Jukebox-RFID/shared;
location /logs {
root /home/pi/RPi-Jukebox-RFID/shared;

autoindex on;
autoindex_exact_size off;
autoindex_localtime on;

default_type text/plain;
}
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;

location @runsphinx {
root /home/pi/RPi-Jukebox-RFID/resources/html;
try_files /runsphinx.html =404;
internal;
}
default_type text/plain;
}

location @buildwebui {
root /home/pi/RPi-Jukebox-RFID/resources/html;
Expand Down
24 changes: 0 additions & 24 deletions resources/html/runsphinx.html

This file was deleted.

45 changes: 0 additions & 45 deletions run_sphinx.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ Your new reader is a python subpackage with these three mandatory files
+- description.py <-- A description module w/o dependencies. Do not change the filename!
+- README.rst <-- The Readme
The module documentation must go into a separate file so we can import it into the Sphinx document generation flow
without loading the Python module.
The module documentation must go into a separate file to generate it.

Conventions
^^^^^^^^^^^^^^^^^^
Expand Down
Loading

0 comments on commit 6f55597

Please sign in to comment.