Commit 12ddccd64cbe5b94190ddfebfd565205191836be

Authored by Etienne Pallier
1 parent d9d66439
Exists in dev

sphinx doc auto generation v3

Dockerfile
... ... @@ -5,7 +5,9 @@ RUN apt-get update && apt-get install -y \
5 5 default-mysql-client \
6 6 git \
7 7 nano \
8   - vim
  8 + vim \
  9 + # for PNG diagrams generation with pyreverse (pylint)
  10 + graphviz
9 11  
10 12 # Get IRAP self signed certificate
11 13 RUN echo | openssl s_client -connect gitlab.irap.omp.eu:443 -servername gitlab.irap.omp.eu 2>/dev/null | openssl x509 > /etc/ssl/certs/gitlab.irap.omp.eu.crt
... ... @@ -34,4 +36,4 @@ ENV PATH "$PATH:/home/pyros_user/.local/bin"
34 36 RUN pip install --user click
35 37  
36 38 # installing packages required for PyROS
37   -RUN pip install --user -r ./install/requirements.txt
38 39 \ No newline at end of file
  40 +RUN pip install --user -r ./install/requirements.txt
... ...
doc/doc_rst/make_rst_then_html
... ... @@ -25,7 +25,7 @@ pwd
25 25 ######sphinx-apidoc -o source -a --separate --module-first --tocfile device_controller_package ../../src/device_controller
26 26  
27 27 # 3) pyros_django package
28   -sphinx-apidoc -f -o source/generated_api -a --separate --module-first --tocfile pyros_django_package ../../src/core/pyros_django
  28 +######sphinx-apidoc -f -o source/generated_api -a --separate --module-first --tocfile pyros_django_package ../../src/core/pyros_django
29 29 ##sphinx-apidoc -f -o source -a --separate --module-first --tocfile pyros_django_package ../../src/core/pyros_django
30 30 #sphinx-apidoc -f -o source --tocfile pyros_django_package ../../src/core/pyros_django
31 31  
... ...
doc/doc_rst/requirements.txt
1 1 Sphinx
2 2 sphinx-autodoc-typehints
3   -sphinx-pyreverse
4 3  
5 4 # Extensions
6 5 autodocsumm
... ... @@ -9,7 +8,24 @@ autodocsumm
9 8 #alabaster
10 9 sphinx-rtd-theme
11 10  
12   -# Builder
  11 +# Builder (pdf)
13 12 rst2pdf
14 13 #rstcheck
15 14  
  15 +# For pyreverse (included in pylint)
  16 +pylint
  17 +graphviz
  18 +pygraphviz
  19 +sphinx_pyreverse
  20 +
  21 +# Graphviz : for generating png diagrams from pyreverse
  22 +# Par défaut, seuls deux formats de sortie sont possibles : dot et vcg.
  23 +# Il est possible d'augmenter la quantité des formats de sortie avec l'installation de GraphViz
  24 +# See https://graphviz.org/download
  25 +# - Ubuntu & Debian :
  26 +#sudo apt install graphviz
  27 +# - Fedora & CentOS :
  28 +#sudo yum install graphviz
  29 +# - Mac :
  30 +#brew install graphviz
  31 +
... ...
doc/doc_rst/source/index.rst
... ... @@ -55,7 +55,7 @@ See in the `Execution & Configuration documentation - Observatory Configuration
55 55 4. PyROS API Source Code documentation
56 56 --------------------------------------
57 57  
58   -The PyROS :doc:`Packages, Classes, and Methods<generated_api/pyros_django_package>`
  58 +.. The PyROS :doc:`Packages, Classes, and Methods<generated_api/pyros_django_package>`
59 59  
60 60  
61 61  
... ... @@ -84,7 +84,10 @@ See in the `Guitastro documentation &lt;../../../../vendor/guitastro/doc_rst/build/
84 84 :caption: Contents:
85 85  
86 86 generated_api/codestyle_examples_package
87   - generated_api/pyros_django_package
  87 +
  88 +.. generated_api/pyros_django_package
  89 +
  90 +
88 91  
89 92 .. comment guitastro
90 93  
... ...
docker/HELP.md
... ... @@ -53,6 +53,7 @@ To install the database and instantiate initial data.
53 53 You should run this script the first time you are installing PyROS or if you want to reset your database according to the models and inject initial data.
54 54  
55 55 Before running this script, you should stop PyROS (website and other services) if it is running.
  56 +
56 57 3.2.4. PYROS_DOCKER_UPDATE
57 58  
58 59 This will update your project (by pulling the modification from the git repository), update the database structure (by running Django migrations), and update various diagrams.
... ...
install/requirements.txt
... ... @@ -27,7 +27,25 @@ sqlparse==0.4.2
27 27 Twisted==21.7.0
28 28 voevent-parse==1.0.3
29 29 zope.interface==5.4.0
30   -# For DEV
  30 +
  31 +
  32 +#
  33 +# For Celery:
  34 +#
  35 +##celery==3.1.23
  36 +##flower==0.9.2
  37 +##amqp==1.4.9
  38 +##amqplib==1.0.2
  39 +##billiard==3.3.0.23
  40 +##kombu==3.0.37
  41 +##django-celery==3.1.17
  42 +
  43 +
  44 +
  45 +#
  46 +# DEV only
  47 +#
  48 +
31 49 django-debug-toolbar==3.2.2
32 50 # Modifications 2021 :
33 51 # removing plantuml because we need a unofficial version (maybe we could force to go back on an old version where the bug wasn't happening
... ... @@ -42,19 +60,20 @@ PyYAML==6.0
42 60 # For SP TAC Assignation
43 61 matplotlib==3.4.3
44 62 numpy==1.21.4
45   -# For Celery:
46   -##celery==3.1.23
47   -##flower==0.9.2
48   -##amqp==1.4.9
49   -##amqplib==1.0.2
50   -##billiard==3.3.0.23
51   -##kombu==3.0.37
52   -##django-celery==3.1.17
  63 +
53 64 # For working with GIT within Python
54 65 GitPython==3.1.24
55 66 # For working with date
56 67 python-dateutil==2.8.2
  68 +
  69 +
  70 +
  71 +
  72 +# TODO: a virer car dans fichier requirements guitastro dédié
  73 +#
57 74 # Celme / guitastro packages
  75 +#
  76 +
58 77 # pypylon not available for 3.10 at 2021/11/10 (cf https://github.com/basler/pypylon#binary-installation)
59 78 pypylon==1.7.4
60 79 sep==1.2.0
... ...
pyros.py
... ... @@ -527,7 +527,7 @@ def install_or_update(UPDATE: bool = False, packages_only: bool = False, databas
527 527 except:
528 528 pip = "pip" if IS_WINDOWS else "pip3"
529 529 process = subprocess.Popen(
530   - pip + " install --upgrade GitPython", shell=True)
  530 + pip + " install --user --upgrade GitPython", shell=True)
531 531 process.wait()
532 532 if process.returncode == 0:
533 533 # self.addExecuted(self.current_command, command)
... ... @@ -716,7 +716,7 @@ def start(agent: str, configfile: str, observatory: str, unit: str):
716 716 # TODO: "python -m pip" au lieu de "pip"
717 717 pip = "pip" if IS_WINDOWS else "pip3"
718 718 process = subprocess.Popen(
719   - pip + " install --upgrade pykwalify", shell=True)
  719 + pip + " install --user --upgrade pykwalify", shell=True)
720 720 process.wait()
721 721 if process.returncode == 0:
722 722 # self.addExecuted(self.current_command, command)
... ... @@ -917,11 +917,11 @@ def stop(agent):
917 917  
918 918 def notused_update_python_packages_from_requirements():
919 919 # 1) Upgrade pip (if new version available)
920   - res = execProcessFromVenv("-m pip install --upgrade pip")
  920 + res = execProcessFromVenv("-m pip install --user --upgrade pip")
921 921 if not res:
922 922 return False
923 923 # 2) Install only "not yet installed" python packages
924   - res = execProcessFromVenv("-m pip install -r install/"+REQUIREMENTS)
  924 + res = execProcessFromVenv("-m pip install --user -r install/"+REQUIREMENTS)
925 925 return res
926 926  
927 927  
... ... @@ -945,6 +945,8 @@ def _update_plantuml_diags():
945 945 def _update_api_doc():
946 946 print(os.getcwd())
947 947 DOC_RST_PATH = "doc/doc_rst/"
  948 + # 0) Upgrade pip if new version available
  949 + os.system(VENV_PYTHON + ' -m pip install --user --upgrade pip')
948 950 # 1) install/update Sphinx requirements (only if not yet installed)
949 951 venv_pip_install2(DOC_RST_PATH+'requirements.txt', '-r')
950 952 # 2) make html doc from RST doc
... ... @@ -1119,11 +1121,11 @@ def notused_install_required():
1119 1121  
1120 1122  
1121 1123 def venv_pip_install(package_name: str, options: str = ''):
1122   - os.system(VENV_PIP + ' install ' + options + ' ' + package_name)
  1124 + os.system(VENV_PIP + ' install --user ' + options + ' ' + package_name)
1123 1125  
1124 1126  
1125 1127 def venv_pip_install2(package_name: str, options: str = ''):
1126   - os.system(VENV_PYTHON + ' -m ' + VENV_PIP + ' install '
  1128 + os.system(VENV_PYTHON + ' -m ' + VENV_PIP + ' install --user '
1127 1129 + options + ' ' + package_name)
1128 1130  
1129 1131  
... ... @@ -1196,7 +1198,7 @@ def install_packages():
1196 1198 print(Colors.LOG_BLUE + "-----------------------------Upgrade pip, wheel, and setuptools" +
1197 1199 "-----------------------------"+END_OF_LINE + Colors.END)
1198 1200 # Upgrade pip
1199   - os.system(VENV_PYTHON + ' -m pip install --upgrade pip')
  1201 + os.system(VENV_PYTHON + ' -m pip install --user --upgrade pip')
1200 1202 '''
1201 1203 if (platform.system() == "Windows"):
1202 1204 os.system(venv + '\Scripts\python -m pip install --upgrade pip')
... ... @@ -1209,7 +1211,7 @@ def install_packages():
1209 1211 #os.system(VENV_PIP+' install --upgrade wheel')
1210 1212 # Not working with python 3.8 (on 17/02/2022)
1211 1213 # venv_pip_install('setuptools', '--upgrade')
1212   - os.system(VENV_PIP+' install setuptools==58')
  1214 + os.system(VENV_PIP+' install --user setuptools==58')
1213 1215  
1214 1216 # Pip install required packages from REQUIREMENTS file
1215 1217 print()
... ...