Vendredi 15 Février 2019 : démo Python 3.7, ipython sphinx, sympy, framagit pour Ethan

Plan

Utilisation de:

  • pipenv (installation des modules Python)

  • ipython (utilisation de la ligne de commande)

  • sympy (mathématiques)

  • sphinx (documentation des projets)

  • framagit (gestion de projet + production documentation)

ipython

pipenv install ipython

sympy

pipenv install sympy
projet_ethan)  pvergain@UC004 > ~/projects/projet_ethan > pipenv install sympy
Installing sympy…
Adding sympy to Pipfile's [packages]…
✔ Installation Succeeded
Pipfile.lock (57cde4) out of date, updating to (c8fa08)…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
✔ Success!
Updated Pipfile.lock (57cde4)!
Installing dependencies from Pipfile.lock (57cde4)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 16/16 —
(projet_ethan)  pvergain@UC004 ~/projects/projet_ethan > ipython
Python 3.7.2 (default, Jan 28 2019, 08:35:57)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from sympy.plotting import plot

In [2]: from sympy import Symbol


In [4]: x=Symbol('x')
In [6]: plot(2*x+3)
22.2727 |                                                    ...
        |                                                  ..
        |                                              ....
        |                                           ...
        |                                        ...
        |                                     ...
        |                                  ...
        |                               ...
2.63636 | ---------------------------...-------------------------
        |                          ..
        |                      ....
        |                   ...
        |                ...
        |              ..
        |          ....
        |        ..
        |     ...
    -17 | ....
          -10                    0                          10
Out[6]: <sympy.plotting.plot.Plot at 0x7f125ea42be0>

Module python test.py

1
2
3
4
5
 from sympy.plotting import plot
 from sympy import Symbol

 x=Symbol('x')
 plot(2*x+3)
(projet_ethan)  ✘ pvergain@UC004 > ~/projects/projet_ethan > python test.py
22.2727 |                                                    ...
        |                                                  ..
        |                                              ....
        |                                           ...
        |                                        ...
        |                                     ...
        |                                  ...
        |                               ...
2.63636 | ---------------------------...-------------------------
        |                          ..
        |                      ....
        |                   ...
        |                ...
        |              ..
        |          ....
        |        ..
        |     ...
    -17 | ....
          -10                    0                          10

gitlab

Production de la documentation

Après un git commit, la documentation est produite par le gitlab de framasoft pour produire la documentation ici: https://pvergain.frama.io/stages_python/index.html

---
# .gitlab-ci.yml
# ===============
#
# https://gitlab.com/help/user/project/pages/getting_started_part_four.md
# Creating and Tweaking GitLab CI/CD for GitLab Pages

# https://store.docker.com/images/python
image: python:3.7-alpine

pages:
  stage: deploy
  script:
  - pip install --upgrade pip
  - pip install -r requirements.txt
  - sphinx-build -d _build/doctrees . _build/html
  - mv _build/html public
  artifacts:
    paths:
    - public
  only:
  - master