diff --git a/.dockerignore b/.dockerignore index 90d811ef..47806789 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,8 +2,8 @@ *.pyc # Setuptools distribution folder. -dist/ -build/ +_dist/ +_build/ doc/ # Python egg metadata, regenerated from source files by setuptools. diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 63e6ef85..e275912c 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -93,8 +93,16 @@ jobs: # Manual build documentation # Follow https://github.com/ammaraskar/sphinx-action/issues/43#issuecomment-1218439431 run: | - pip install travis-sphinx sphinx sphinx-rtd-theme m2r mistune - sphinx-build -D todo_include_todos=0 docs/source ./docs/build/html/ + # Upgrade pip + # https://github.com/actions/setup-python/issues/225 + sudo -H env "PATH=$PATH" python -m pip install --upgrade pip + # Install jtop + sudo -H env "PATH=$PATH" pip install -v -e . + # Install sphinx requirements + sudo -H env "PATH=$PATH" pip install -r docs/requirements.txt + # Run sphinx + cd docs + sphinx-build -b html -W . _build/html - name: Deploy on branch if: startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/tags/') # Follow: https://github.com/marketplace/actions/deploy-to-github-pages @@ -102,7 +110,7 @@ jobs: with: ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} BRANCH: gh-pages # The branch the action should deploy to. - FOLDER: docs/build/html # The folder the action should deploy. + FOLDER: docs/_build/html # The folder the action should deploy. update_docker_description: name: Update docker description diff --git a/.gitignore b/.gitignore index 8772176d..a7b93004 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,8 @@ *.pyc # Setuptools distribution folder. +_build/ dist/ -build/ doc/ # Python egg metadata, regenerated from source files by setuptools. diff --git a/README.md b/README.md index bd6ae547..6dcee930 100644 --- a/README.md +++ b/README.md @@ -1,186 +1,81 @@ -# Jetson stats -[![PyPI - Downloads](https://img.shields.io/pypi/dw/jetson-stats.svg)](https://pypistats.org/packages/jetson-stats) [![PyPI version](https://badge.fury.io/py/jetson-stats.svg)](https://badge.fury.io/py/jetson-stats) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/jetson-stats.svg)](https://www.python.org/) [![PyPI - Format](https://img.shields.io/pypi/format/jetson-stats.svg)](https://pypi.org/project/jetson-stats/) [![GitHub](https://img.shields.io/github/license/rbonghi/jetson_stats)](/LICENSE) [![Docker Pulls](https://img.shields.io/docker/pulls/rbonghi/jetson_stats)](https://hub.docker.com/r/rbonghi/jetson_stats) [![CI & CD](https://github.com/rbonghi/jetson_stats/workflows/CI%20&%20CD/badge.svg)](https://github.com/rbonghi/jetson_stats/actions?query=workflow%3A%22CI+%26+CD%22) +

-[![Twitter Follow](https://img.shields.io/twitter/follow/raffaello86?style=social)](https://twitter.com/raffaello86) [![robo.panther](https://img.shields.io/badge/Follow:-robo.panther-E4405F?style=social&logo=instagram)](https://www.instagram.com/robo.panther/) [![Discord](https://img.shields.io/discord/1060563771048861817)](https://discord.gg/BFbuJNhYzS) +![jtop](docs/images/jtop.png) -**jetson-stats** is a package for **monitoring** and **control** your [NVIDIA Jetson][NVIDIA Jetson] [Orin, Xavier, Nano, TX] series. Works with all NVIDIA Jetson [ecosystem](#compability). +

-**Consider to** [:sparkling_heart: **Sponsor** jetson-stats](https://github.com/sponsors/rbonghi) +

+ PyPI - Downloads + PyPI version + PyPI - Python Version + PyPI - Format + GitHub + jetson-stats + Docker Pulls + CI & CD + CodeQL +

-When you install jetson-stats are included: -- [Jetson stats](#jetson-stats) -- [Install](#install) - - [Virtual environment](#virtual-environment) - - [Docker](#docker) - - [Troubleshooting](#troubleshooting) -- [jtop](#jtop) - - [Pages](#pages) - - [Controls](#controls) -- [jetson\_config](#jetson_config) -- [jetson\_release](#jetson_release) -- [jetson\_swap](#jetson_swap) -- [jetson variables](#jetson-variables) -- [Compability](#compability) +

+ Twitter Follow + robo.panther + Join our Discord +

-Read the [Wiki](https://github.com/rbonghi/jetson_stat/wiki) for more detailed information or read the package [documentation](https://rnext.it/jetson_stats). +**jetson-stats** is a package for **monitoring** and **control** your [NVIDIA Jetson](https://developer.nvidia.com/buy-jetson) [Orin, Xavier, Nano, TX] series. -# Install +## Install + +jetson-stats can be installed with [pip](https://pip.pypa.io), but need **superuser**: ```console sudo -H pip3 install -U jetson-stats ``` -**🚀 That's it! 🚀** - -_PS: Don't forget to **reboot** your board_ -**You can run jtop in your python script [read here][library]** +**🚀 That's it! 🚀** -## Virtual environment +_PS: Don't forget to **logout** or **reboot** your board_ -If you need to install in a virtual environment like *virtualenv*, you **must** install before in your host **and after** in your environment, like: -``` -virtualenv venv -source venv/bin/activate -pip install -U jetson-stats -``` +## Run -## Docker +Start jtop it's pretty simple just write `jtop`! -You can run jtop from a docker container, but you **must** install jetsons-stats as well on your host! Try with the command below: ```console -docker run --rm -it -v /run/jtop.sock:/run/jtop.sock rbonghi/jetson_stats:latest +jtop ``` -or you can add in your Dockerfile writing: +A simple interface will appear on your terminal -```docker -FROM python:3-buster -RUN pip install -U jetson-stats -``` +
-## Troubleshooting +![jtop](docs/images/jtop.gif) -If you reach the error below: +
-**sudo: pip: command not found** +## Library -You need to install **pip** before to install jetson-stats +You can use jtop such a python library to integrate in your software -```console -sudo apt-get install python3-pip -sudo -H pip3 install -U jetson-stats -``` +```python +from jtop import jtop -**REMIND** to pass `/run/jtop.sock:/run/jtop.sock` when you run your docker container. +with jtop() as jetson: + # jetson.ok() will provide the proper update frequency + while jetson.ok(): + # Read tegra stats + print(jetson.stats) +``` -# [jtop][jtop] -It is a system monitoring utility that runs on the terminal and see and **control** realtime the status of your [NVIDIA Jetson][NVIDIA Jetson]. CPU, RAM, GPU status and frequency and other... +More information available at [advanced usage](https://rnext.it/jetson_stats/advanced-usage.html) page. -The prompt interface will be show like this image, **now clickable!**: -![jtop](https://github.com/rbonghi/jetson_stats/wiki/images/jtop.gif) +## Sponsorship -You can run the jtop simple using a simple command `jtop` +If your company benefits from this library, please consider [:sparkling_heart: sponsoring its development](https://github.com/sponsors/rbonghi). -YES! Sudo is **not** more required! -```console -nvidia@agx-orin:~/$ jtop -``` +## Documentation -Other options are available with `-h` option: -```console -nvidia@agx-orin:~/$ jtop -h -usage: jtop [-h] [--no-warnings] [--restore] [--loop] [--color-filter] [-r REFRESH] [-p PAGE] [-v] - -jtop is system monitoring utility and runs on terminal - -optional arguments: - -h, --help show this help message and exit - --no-warnings Do not show warnings (default: False) - --restore Reset Jetson configuration (default: False) - --loop Automatically switch page every 5s (default: False) - --color-filter Change jtop base colors, you can use also JTOP_COLOR_FILTER=True (default: False) - -r REFRESH, --refresh REFRESH - refresh interval (default: 500) - -p PAGE, --page PAGE Open fix page (default: 1) - -v, --version show program's version number and exit -``` -You can change page using _left_, _right_ arrow or _TAB_ to change page. -## Pages -**jtop** have four different pages to control your NVIDIA Jetson: -1. **ALL** Are collected all information about your board: CPUs status, Memory, *GPU*, disk, fan and all status about jetson_clocks, NVPmodel and other -2. **GPU** A real time GPU history about your NVIDIA Jetson -3. **CPU** A real time CPU plot of NVIDIA Jetson -4. **MEM** A real time Memory chart and swap monitor -5. **CTRL** Enable/Disable **jetson_clocks**, **nvpmodel** or **fan** directly from here -6. **INFO** All information about libraries, CUDA, Serial Number, interfaces, ... -## Controls -To control the your NVIDIA Jetson are available this keyboard commands: - -In page **4 MEM**: -* **c** Clear cache -* **s** Enable/Disable extra swap -* **+** and **-** Increase and decrease swap size - -In page **5 CTRL**: -* **a** Start/Stop jetson_clocks service (Note: jetson_clocks start only after 60s from up time) -* **e** Enable/Disable jetson_clocks on board boot -* **+** and **-** Increase and decrease the NVPmodel -* **f** Manual/jetson_clocks mode for your fan -* **p** and **m** Increase and decrease the Fan speed - -# [jetson_config][jetson_config] - -Check _jetson-stats_ **health**, enable/disable **desktop**, enable/disable **jetson_clocks**, improve the performance of your **wifi** are available only in one click using **jetson_config** - -![jetson_config](https://github.com/rbonghi/jetson_stats/wiki/images/jetson_config.png) -# [jetson_release][jetson_release] -The command show the status and all information about your [NVIDIA Jetson][NVIDIA Jetson] - -![jtop](https://github.com/rbonghi/jetson_stats/wiki/images/jetson_release.png) -# [jetson_swap][jetson_swap] -Simple manager to switch on and switch off a swapfile in your jetson. +jetson-stats documentation has usage and reference documentation at . -```console -nvidia@jetson-nano:~/$ sudo jetson_swap -h -usage: createSwapFile [[[-d directory ] [-s size] -a] | [-h] | [--off]] - -d | --dir Directory to place swapfile - -n | --name Name swap file - -s | --size - -a | --auto Enable swap on boot in /etc/fstab - -t | --status Check if the swap is currently active - --off Switch off the swap - -h | --help This message -``` +## Community -# [jetson variables][jetson_variables] -When you install jetson-stats in your bash will be available a list of new environment variables to know which which hardware version is available are you working, which Jetpack is installed and other variable show below - -![jtop](https://github.com/rbonghi/jetson_stats/wiki/images/jetson_env.png) - -[library]: https://github.com/rbonghi/jetson_stats/wiki/library -[jtop]: https://github.com/rbonghi/jetson_stats/wiki/jtop -[jetson_config]: https://github.com/rbonghi/jetson_stats/wiki/jetson_config -[jetson_swap]: https://github.com/rbonghi/jetson_stats/wiki/jetson_swap -[jetson_variables]: https://github.com/rbonghi/jetson_stats/wiki/jetson_variables -[jetson_release]: https://github.com/rbonghi/jetson_stats/wiki/jetson_release -[jetson_performance]: https://github.com/rbonghi/jetson_stats/wiki/jetson_performance -[jetson_docker]: https://github.com/rbonghi/jetson_stats/wiki/jetson_docker -[NVIDIA]: https://www.nvidia.com/ -[NVIDIA Jetson]: https://developer.nvidia.com/buy-jetson - -# Compability - -jetson-stats is compatibile with: -* NVIDIA Jetson AGX Orin -* NVIDIA Jetson Orin Series -* NVIDIA Jetson AGX Xavier Industrial -* NVIDIA Jetson AGX Xavier -* NVIDIA Jetson Xavier NX -* NVIDIA Jetson Xavier Series -* NVIDIA Jetson Nano -* NVIDIA Jetson TX2 NX -* NVIDIA Jetson TX2i -* NVIDIA Jetson TX2 -* NVIDIA Jetson TX1 - -If you need a specific compability open an [issue](https://github.com/rbonghi/jetson_stats/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=) +jetson-stats has a [community Discord channel](https://discord.gg/BFbuJNhYzS) for asking questions and collaborating with other contributors. Drop by and say hello 👋 diff --git a/docs/Makefile b/docs/Makefile index d0c3cbf1..fc13183c 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -3,18 +3,129 @@ # You can set these variables from the command line, and also # from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = source -BUILDDIR = build +SPHINXOPTS = '-W' +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# Internal variables +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest -# Put it first so that "make" without argument is like "make help". help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + -rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/urllib3.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/urllib3.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/urllib3" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/urllib3" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." -.PHONY: help Makefile +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." \ No newline at end of file diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html new file mode 100644 index 00000000..1963ef04 --- /dev/null +++ b/docs/_templates/layout.html @@ -0,0 +1,27 @@ +{% extends "!layout.html" %} + +{%- block extrahead %} +{{ super() }} + +{% endblock %} + +{% block footer %} +{{ super() }} + +{% endblock %} \ No newline at end of file diff --git a/docs/advanced-usage.rst b/docs/advanced-usage.rst new file mode 100644 index 00000000..680da92d --- /dev/null +++ b/docs/advanced-usage.rst @@ -0,0 +1,34 @@ +Advanced Usage +============== + +.. currentmodule:: jtop + +YOu can install jtop in a virtual environment or in a docker following the guidelines below + +Virtual environment +------------------- + +If you need to install in a virtual environment like *virtualenv*, you **must** install before in your host **and after** in your environment, like: + +.. code-block:: bash + + virtualenv venv + source venv/bin/activate + pip install -U jetson-stats + + +Docker +---------- + +You can run jtop from a docker container, but you **must** install jetsons-stats as well on your host! Try with the command below: + +.. code-block:: bash + + docker run --rm -it -v /run/jtop.sock:/run/jtop.sock rbonghi/jetson_stats:latest + +or you can add in your Dockerfile writing: + +.. code-block:: docker + + FROM python:3-buster + RUN pip install -U jetson-stats \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 00000000..cf7268fb --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,102 @@ +from __future__ import annotations + +import os +import sys +from datetime import date + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) +sys.path.insert(0, root_path) + +# -- Project information ----------------------------------------------------- + +import jtop + +project = 'jetson-stats' +author = 'Raffaello Bonghi' +copyright = f"2019-{date.today().year}, {author}" + + +# The short X.Y version. +version = jtop.__version__ +# The full version, including alpha/beta/rc tags. +release = version + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx_copybutton", + "sphinx.ext.doctest", + "sphinx.ext.intersphinx", +] + +source_suffix = ['.rst'] + +# The master toctree document. +master_doc = "index" + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ["_build"] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = "friendly" + +intersphinx_mapping = {"python": ("https://docs.python.org/3", None)} + +# Show typehints as content of the function or method +autodoc_typehints = "description" + +copybutton_selector = "div:not(.no-copybutton) > div.highlight > pre" + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = "furo" +html_favicon = "images/favicon.png" + +html_title = f"{project} {version}" + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = [] + +html_theme_options = { + "announcement": """ + + 💖 Support jetson-stats on GitHub Sponsors + + """, + "footer_icons": [ + { + "name": "GitHub", + "url": "https://github.com/rbonghi/jetson_stats", + "html": """ + + + + """, + "class": "", + }, + ], + "source_repository": "https://github.com/rbonghi/jetson_stats", + "source_branch": "master", + "source_directory": "docs/", +} +# EOF diff --git a/docs/contributing.rst b/docs/contributing.rst new file mode 100644 index 00000000..e4724a37 --- /dev/null +++ b/docs/contributing.rst @@ -0,0 +1,16 @@ +Contributing +============ + +jetson-stats is a community-maintained project and we happily accept contributions. + +If you wish to add a new feature or fix a bug: + +#. `Check for open issues `_ or open + a fresh issue to start a discussion around a feature idea or a bug. There is + a *Contributor Friendly* tag for issues that should be ideal for people who + are not very familiar with the codebase yet. +#. Fork the `jetson-stats repository on Github `_ + to start making your changes. +#. Write a test which shows that the bug was fixed or that the feature works + as expected. +#. Send a pull request and bug the maintainer until it gets merged and published. diff --git a/docs/images/favicon.png b/docs/images/favicon.png new file mode 100644 index 00000000..3881e6eb Binary files /dev/null and b/docs/images/favicon.png differ diff --git a/docs/images/jtop.gif b/docs/images/jtop.gif new file mode 100644 index 00000000..86556ee8 Binary files /dev/null and b/docs/images/jtop.gif differ diff --git a/docs/images/jtop.png b/docs/images/jtop.png new file mode 100644 index 00000000..e66f69cd Binary files /dev/null and b/docs/images/jtop.png differ diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 00000000..36722c73 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,93 @@ +jetson-stats +============ + +.. toctree:: + :hidden: + :maxdepth: 3 + + rnext.it + Community Discord + sponsors + jtop + advanced-usage + reference + other-tools/index + contributing + +.. toctree:: + :hidden: + :caption: Project + + ros_jetson_stats + ros2_jetson_stats + + +jetson-stats is a package for monitoring and control your NVIDIA Jetson [Orin, Xavier, Nano, TX] series. Works with all NVIDIA Jetson ecosystem. + +.. image:: images/jtop.gif + :align: center + +Installing +---------- + +jetson-stats can be installed with `pip `_ + +.. code-block:: bash + + sudo -H pip3 install -U jetson-stats + +**🚀 That's it! 🚀** + +Don't forget to **logout** or **reboot** your board + + +Usage +----- + +The :doc:`jtop` is the place to go to learn how to use the the core tool and monitoring your board. +The more in-depth :doc:`advanced-usage` guide is the place to jtop such a python library and use for your project. + +.. code-block:: python + + from jtop import jtop + + with jtop() as jetson: + # jetson.ok() will provide the proper update frequency + while jetson.ok(): + # Read tegra stats + print(jetson.stats) + +The :doc:`reference` documentation provides API-level documentation. + + +Compatibility +------------- + +jetson-stats is compatible with: + +* NVIDIA Jetson Orin Series + * NVIDIA Jetson AGX Orin +* NVIDIA Jetson Xavier Series + * NVIDIA Jetson AGX Xavier Industrial + * NVIDIA Jetson AGX Xavier + * NVIDIA Jetson Xavier NX +* NVIDIA Jetson Nano +* NVIDIA Jetson TX Series + * NVIDIA Jetson TX2 NX + * NVIDIA Jetson TX2i + * NVIDIA Jetson TX2 + * NVIDIA Jetson TX1 + +If you need a specific Compatibility open an `issue `_. + + +License +------- + +jetson-stats is made available under the AGPL-3.0 license. For more details, see `LICENSE `_. + + +Contributing +------------ + +We happily welcome contributions, please see :doc:`contributing` for details. \ No newline at end of file diff --git a/docs/jtop.rst b/docs/jtop.rst new file mode 100644 index 00000000..bc745742 --- /dev/null +++ b/docs/jtop.rst @@ -0,0 +1,81 @@ +jtop +========== + +.. currentmodule:: jtop + +Installing +---------- + +jtop can be installed with `pip `_ + +.. code-block:: bash + + sudo -H pip3 install -U jetson-stats + +Don't forget to **logout** or **reboot** your board + +Running +------- + +Simple and fast! You can write on your shell **jtop** and that's it! + +.. code-block:: bash + + jtop + +.. image:: images/jtop.png + :align: center + +Other options are available with `-h` option: + +.. code-block:: bash + :class: no-copybutton + + nvidia@agx-orin:~/$ jtop -h + usage: jtop [-h] [--no-warnings] [--restore] [--loop] [--color-filter] [-r REFRESH] [-p PAGE] [-v] + + jtop is system monitoring utility and runs on terminal + + optional arguments: + -h, --help show this help message and exit + --no-warnings Do not show warnings (default: False) + --restore Reset Jetson configuration (default: False) + --loop Automatically switch page every 5s (default: False) + --color-filter Change jtop base colors, you can use also JTOP_COLOR_FILTER=True (default: False) + -r REFRESH, --refresh REFRESH + refresh interval (default: 500) + -p PAGE, --page PAGE Open fix page (default: 1) + -v, --version show program\'s version number and exit + +You can change page using *left*, *right* arrow or *TAB* to change page. + +Pages +^^^^^ + +**jtop** have four different pages to control your NVIDIA Jetson: + +1. **ALL** Are collected all information about your board: CPUs status, Memory, *GPU*, disk, fan and all status about jetson_clocks, NVPmodel and other +2. **GPU** A real time GPU history about your NVIDIA Jetson +3. **CPU** A real time CPU plot of NVIDIA Jetson +4. **MEM** A real time Memory chart and swap monitor +5. **CTRL** Enable/Disable **jetson_clocks**, **nvpmodel** or **fan** directly from here +6. **INFO** All information about libraries, CUDA, Serial Number, interfaces, ... + +Controls +^^^^^^^^ + +To control the your NVIDIA Jetson are available this keyboard commands: + +In page **4 MEM**: + +* **c** Clear cache +* **s** Enable/Disable extra swap +* **+** and **-** Increase and decrease swap size + +In page **5 CTRL**: + +* **a** Start/Stop jetson_clocks service (Note: jetson_clocks start only after 60s from up time) +* **e** Enable/Disable jetson_clocks on board boot +* **+** and **-** Increase and decrease the NVPmodel +* **f** Manual/jetson_clocks mode for your fan +* **p** and **m** Increase and decrease the Fan speed \ No newline at end of file diff --git a/docs/make.bat b/docs/make.bat index 6247f7e2..8cbb719d 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -1,35 +1,170 @@ @ECHO OFF -pushd %~dp0 - REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) -set SOURCEDIR=source -set BUILDDIR=build +set BUILDDIR=_build +set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . +if NOT "%PAPER%" == "" ( + set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% +) if "%1" == "" goto help -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( +if "%1" == "help" ( + :help + echo.Please use `make ^` where ^ is one of + echo. html to make standalone HTML files + echo. dirhtml to make HTML files named index.html in directories + echo. singlehtml to make a single large HTML file + echo. pickle to make pickle files + echo. json to make JSON files + echo. htmlhelp to make HTML files and a HTML help project + echo. qthelp to make HTML files and a qthelp project + echo. devhelp to make HTML files and a Devhelp project + echo. epub to make an epub + echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter + echo. text to make text files + echo. man to make manual pages + echo. changes to make an overview over all changed/added/deprecated items + echo. linkcheck to check all external links for integrity + echo. doctest to run all doctests embedded in the documentation if enabled + goto end +) + +if "%1" == "clean" ( + for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i + del /q /s %BUILDDIR%\* + goto end +) + +if "%1" == "html" ( + %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html + if errorlevel 1 exit /b 1 echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. + echo.Build finished. The HTML pages are in %BUILDDIR%/html. + goto end +) + +if "%1" == "dirhtml" ( + %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml + if errorlevel 1 exit /b 1 echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 + echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. + goto end ) -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end +if "%1" == "singlehtml" ( + %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. + goto end +) -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +if "%1" == "pickle" ( + %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the pickle files. + goto end +) + +if "%1" == "json" ( + %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the JSON files. + goto end +) + +if "%1" == "htmlhelp" ( + %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run HTML Help Workshop with the ^ +.hhp project file in %BUILDDIR%/htmlhelp. + goto end +) + +if "%1" == "qthelp" ( + %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run "qcollectiongenerator" with the ^ +.qhcp project file in %BUILDDIR%/qthelp, like this: + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\urllib3.qhcp + echo.To view the help file: + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\urllib3.ghc + goto end +) + +if "%1" == "devhelp" ( + %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. + goto end +) + +if "%1" == "epub" ( + %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The epub file is in %BUILDDIR%/epub. + goto end +) + +if "%1" == "latex" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "text" ( + %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The text files are in %BUILDDIR%/text. + goto end +) + +if "%1" == "man" ( + %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The manual pages are in %BUILDDIR%/man. + goto end +) + +if "%1" == "changes" ( + %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes + if errorlevel 1 exit /b 1 + echo. + echo.The overview file is in %BUILDDIR%/changes. + goto end +) + +if "%1" == "linkcheck" ( + %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + if errorlevel 1 exit /b 1 + echo. + echo.Link check complete; look for any errors in the above output ^ +or in %BUILDDIR%/linkcheck/output.txt. + goto end +) + +if "%1" == "doctest" ( + %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest + if errorlevel 1 exit /b 1 + echo. + echo.Testing of doctests in the sources finished, look at the ^ +results in %BUILDDIR%/doctest/output.txt. + goto end +) -:end -popd +:end \ No newline at end of file diff --git a/docs/other-tools/environment_variables.rst b/docs/other-tools/environment_variables.rst new file mode 100644 index 00000000..28962c88 --- /dev/null +++ b/docs/other-tools/environment_variables.rst @@ -0,0 +1,8 @@ +Environment variables +===================== + +This script generate the easy environment variables to know which is your +Hardware version of the Jetson and which Jetpack you have already installed. + +.. image:: https://github.com/rbonghi/jetson_stats/wiki/images/jetson_env.png + :align: center \ No newline at end of file diff --git a/docs/other-tools/index.rst b/docs/other-tools/index.rst new file mode 100644 index 00000000..f2366489 --- /dev/null +++ b/docs/other-tools/index.rst @@ -0,0 +1,11 @@ +Other tools +=========== + +When you install jetson-stats there are also other tools included + +.. toctree:: + + jetson_config + jetson_release + jetson_swap + environment_variables \ No newline at end of file diff --git a/docs/other-tools/jetson_config.rst b/docs/other-tools/jetson_config.rst new file mode 100644 index 00000000..1aad0dc8 --- /dev/null +++ b/docs/other-tools/jetson_config.rst @@ -0,0 +1,13 @@ +jetson_config +============= + +Check jetson-stats health, enable/disable desktop, enable/disable jetson_clocks, +improve the performance of your wifi are available only in one click using jetson_config + +.. code-block:: bash + + jetson_config + +.. image:: https://github.com/rbonghi/jetson_stats/wiki/images/jetson_config.png + :align: center + diff --git a/docs/other-tools/jetson_release.rst b/docs/other-tools/jetson_release.rst new file mode 100644 index 00000000..e72d53b6 --- /dev/null +++ b/docs/other-tools/jetson_release.rst @@ -0,0 +1,12 @@ +jetson_release +============== + +The command show the status and all information about your NVIDIA Jetson + +.. code-block:: bash + + jetson_release + +.. image:: https://github.com/rbonghi/jetson_stats/wiki/images/jetson_release.png + :align: center + diff --git a/docs/other-tools/jetson_swap.rst b/docs/other-tools/jetson_swap.rst new file mode 100644 index 00000000..f1fe1692 --- /dev/null +++ b/docs/other-tools/jetson_swap.rst @@ -0,0 +1,23 @@ +jetson_swap +=========== + +Simple manager to switch on and switch off a swapfile in your jetson. + +.. code-block:: bash + + jetson_release + +All options available + +.. code-block:: bash + :class: no-copybutton + + nvidia@jetson-nano:~/$ sudo jetson_swap -h + usage: createSwapFile [[[-d directory ] [-s size] -a] | [-h] | [--off]] + -d | --dir Directory to place swapfile + -n | --name Name swap file + -s | --size + -a | --auto Enable swap on boot in /etc/fstab + -t | --status Check if the swap is currently active + --off Switch off the swap + -h | --help This message diff --git a/docs/reference.rst b/docs/reference.rst new file mode 100644 index 00000000..6edc5305 --- /dev/null +++ b/docs/reference.rst @@ -0,0 +1,7 @@ +API Reference +============= + +.. autoclass:: jtop.jtop + :members: + :show-inheritance: + diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 00000000..b726a73b --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,5 @@ +sphinx>3.0.0 +requests +furo +sphinx-copybutton +sphinx-autobuild \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py deleted file mode 100644 index 11901b27..00000000 --- a/docs/source/conf.py +++ /dev/null @@ -1,64 +0,0 @@ -# Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. For a full -# list see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -import os -import sys -sys.path.insert(0, os.path.abspath('../../')) - -# -- Project information ----------------------------------------------------- - -# Fix travis -# https://github.com/readthedocs/readthedocs.org/issues/2569 -master_doc = 'index' - -project = 'jetson-stats' -copyright = '2019-2023, Raffaello Bonghi' -author = 'Raffaello Bonghi' - -# The full version, including alpha/beta/rc tags -release = '4.0.0' - -# -- General configuration --------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.todo', - 'sphinx.ext.mathjax', - 'sphinx.ext.githubpages', - 'm2r', -] - -source_suffix = ['.rst', '.md'] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. -exclude_patterns = [] - - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'sphinx_rtd_theme' - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = [] -# EOF diff --git a/docs/source/index.rst b/docs/source/index.rst deleted file mode 100644 index f13e1aba..00000000 --- a/docs/source/index.rst +++ /dev/null @@ -1,22 +0,0 @@ -.. jetson-stats documentation master file, created by - sphinx-quickstart on Sat Feb 8 18:51:29 2020. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to jetson-stats's documentation! -======================================== - -.. toctree:: - :maxdepth: 2 - :caption: Contents: - - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - -.. mdinclude:: ../../README.md \ No newline at end of file diff --git a/docs/source/jtop.rst b/docs/source/jtop.rst deleted file mode 100644 index 343b3b4b..00000000 --- a/docs/source/jtop.rst +++ /dev/null @@ -1,19 +0,0 @@ -jtop package -============ - -jtop.jtop module ----------------- - -.. automodule:: jtop.jtop - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: jtop - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/modules.rst b/docs/source/modules.rst deleted file mode 100644 index c69de605..00000000 --- a/docs/source/modules.rst +++ /dev/null @@ -1,7 +0,0 @@ -jetson_stats -============ - -.. toctree:: - :maxdepth: 4 - - jtop diff --git a/docs/sponsors.rst b/docs/sponsors.rst new file mode 100644 index 00000000..86d4e0bd --- /dev/null +++ b/docs/sponsors.rst @@ -0,0 +1,12 @@ +Sponsor +============= + +Please consider sponsoring jetson-stats development, especially if your company benefits from this library. + +Your contribution will go towards adding new features to jetson-stats and making sure all functionality continues to meet our high quality standards. + +.. important:: + + `Get in contact `_ for additional + details on sponsorship and perks before making a contribution + through `GitHub Sponsors `_ if you have questions. diff --git a/jtop/jtop.py b/jtop/jtop.py index 4475d7b7..92990d5b 100644 --- a/jtop/jtop.py +++ b/jtop/jtop.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . """ -jtop is a simple package to monitoring and control your NVIDIA Jetson [Xavier NX, Nano, AGX Xavier, TX1, TX2]. +jtop is a simple package to monitoring and control your NVIDIA Jetson [Orin, Xavier, Nano, TX] series. It read the status of your board using different native processes: * tegrastats @@ -52,7 +52,7 @@ def read_stats(jetson): jetson.attach(read_stats) jetson.loop_for_ever() -Other example are availables on https://github.com/rbonghi/jetson_stats/tree/master/examples +Other example are available on https://github.com/rbonghi/jetson_stats/tree/master/examples Follow the next attributes to know in detail how you can you in your python project. """ import logging diff --git a/tests/Dockerfile.sphinx b/tests/Dockerfile.sphinx index 95b2fba3..06559b91 100644 --- a/tests/Dockerfile.sphinx +++ b/tests/Dockerfile.sphinx @@ -18,13 +18,22 @@ ARG PYTHON_VERSION=3.8 FROM python:${PYTHON_VERSION} -RUN apt update && \ - apt install -y bc && \ +RUN apt-get update && \ + apt-get install -y sudo bc && \ + sudo -H python -m pip install --upgrade pip && \ rm -rf /var/lib/apt/lists/* COPY . /jetson_stats WORKDIR /jetson_stats -RUN pip install travis-sphinx sphinx sphinx-rtd-theme m2r mistune && \ - sphinx-build -D todo_include_todos=0 docs/source ./docs/build/html/ \ No newline at end of file +# Install jtop +RUN sudo -H pip3 install -v -e . +# Install sphinx requirements +RUN pip install -r docs/requirements.txt + +WORKDIR /jetson_stats/docs + +RUN sphinx-build -b html -W . _build/html + +CMD ["bash"] \ No newline at end of file diff --git a/tests/Dockerfile.tox b/tests/Dockerfile.tox index 3f8c96a7..eadfcb25 100644 --- a/tests/Dockerfile.tox +++ b/tests/Dockerfile.tox @@ -18,8 +18,8 @@ ARG PYTHON_VERSION=3.8 FROM python:${PYTHON_VERSION} -RUN apt update && \ - apt install -y sudo bc && \ +RUN apt-get update && \ + apt-get install -y sudo bc && \ rm -rf /var/lib/apt/lists/* COPY . /jetson_stats @@ -31,4 +31,7 @@ RUN sudo groupadd jtop && \ sudo -H python -m pip install --upgrade pip && \ sudo -H pip install tox -ENTRYPOINT ["sudo", "tox"] \ No newline at end of file +# Run tox +RUN sudo tox -e py$PYTHON_VERSION + +CMD ["bash"] \ No newline at end of file diff --git a/tests/local_test.sh b/tests/local_test.sh index af10dacb..ace0e458 100755 --- a/tests/local_test.sh +++ b/tests/local_test.sh @@ -34,19 +34,19 @@ usage() echo "$0 [options]" echo "options," echo " -h|--help | This help" - echo " --debug [PYHTON] | Debug a specific python version, example PYTHON=3.9" + echo " --debug | Run image" echo " -py|--python [PYHTON] | Set a specific python version, example PYTHON=3.9" - echo " --doc-only | Run and build ONLY the documentation" - echo " --only-run | Run tox without build the docker image" + echo " --doc | Run and build ONLY the documentation" } main() { - local DOCKER_DOCUMENTATION_BUILD=true local DOCKER_BUILD=true + local DOCUMENTATION_BUILD=true local PYTHON_LIST="2.7 3.6 3.8 3.9 3.10 3.11" - local PYTHON_DEBUG="" + local PYTHON_DEBUG=false + local DOCUMENTATION=false # Decode all information from startup while [ -n "$1" ]; do @@ -56,23 +56,20 @@ main() usage exit 0 ;; - --doc-only) - PYTHON_LIST="" + --doc) DOCKER_BUILD=false + DOCUMENTATION=true ;; --debug) - PYTHON_DEBUG=$2 - DOCKER_DOCUMENTATION_BUILD=false - shift 1 + PYTHON_DEBUG=true + DOCUMENTATION_BUILD=false + DOCKER_BUILD=false ;; -py|--python) PYTHON_LIST=$2 - DOCKER_DOCUMENTATION_BUILD=false + DOCUMENTATION_BUILD=false shift 1 ;; - --only-run) - DOCKER_BUILD=false - ;; *) usage "[ERROR] Unknown option: $1" exit 1 @@ -81,34 +78,31 @@ main() shift 1 done + + if $DOCUMENTATION_BUILD ; then + echo "- ${green}Build and compile jetson-stats documentation with sphinx${reset}" + docker build -t rbonghi/jetson-stats:doc -f tests/Dockerfile.sphinx . || { echo "${red}docker build failure!${reset}"; exit 1; } + fi + if $DOCKER_BUILD ; then - # Build specific version only if debug - if [ ! -z "$PYTHON_DEBUG" ] ; then - PYTHON_LIST=$PYTHON_DEBUG - fi # Build all images for PYTHON_VERSION in $PYTHON_LIST; do - echo "- ${green}Build Dockerfile image with python:${bold}$PYTHON_VERSION${reset}" + echo "- ${green}Build and test image with python:${bold}$PYTHON_VERSION${reset}" docker build -t rbonghi/jetson-stats:tox-py$PYTHON_VERSION --build-arg "PYTHON_VERSION=$PYTHON_VERSION" -f tests/Dockerfile.tox . || { echo "${red}docker build failure!${reset}"; exit 1; } done fi - if [ ! -z "$PYTHON_DEBUG" ] ; then - echo "- ${yellow}Debug Image with python:${bold}$PYTHON_DEBUG${reset}" - docker run -v $(pwd):/jetson_stats -it --rm --entrypoint bash rbonghi/jetson-stats:tox-py$PYTHON_DEBUG - exit 0 + if $PYTHON_DEBUG ; then + if $DOCUMENTATION ; then + echo "- ${yellow}Debug documentation image${reset}" + docker run -v $(pwd):/jetson_stats -it --rm rbonghi/jetson-stats:doc + else + PYTHON_VERSION=$PYTHON_LIST + echo "- ${yellow}Debug Image with python:${bold}$PYTHON_VERSION${reset}" + docker run -v $(pwd):/jetson_stats -it --rm rbonghi/jetson-stats:tox-py$PYTHON_VERSION + fi fi - # Run all images - for PYTHON_VERSION in $PYTHON_LIST; do - echo "- ${green}Run Image and test with python:${bold}$PYTHON_VERSION${reset}" - docker run --rm -t rbonghi/jetson-stats:tox-py$PYTHON_VERSION -e py$PYTHON_VERSION || { echo "${red}Failure TOX $PYTHON_VERSION!${reset}"; exit 1; } - done - - if $DOCKER_DOCUMENTATION_BUILD ; then - echo "- ${green}Build and compile jetson-stats documentation with sphinx${reset}" - docker build -t rbonghi/jetson-stats:doc -f tests/Dockerfile.sphinx . || { echo "${red}docker build failure!${reset}"; exit 1; } - fi } main $@