2.4. Quality Documentationï
2.4.1. reStructuredText vs. Markdownï
2.4.2. Format reStructuredTextï
2.4.3. Po co?ï
2.4.4. Paragrafyï
newline
2.4.5. NagÅówkiï
TytuÅ
NagÅówek pierwszego poziomu
NagÅówek drugiego poziomu
NagÅówek trzeciego poziomu
NagÅówek czwartego poziomu (czy stosowaÄ?)
2.4.6. OdnoÅnikiï
WewnÄ trz dokumentu
numref
na zewnÄ trz dokumentu
2.4.7. Obrazki i mediaï
figure (scale, name, align, podpisy pod obrazkami)
2.4.8. Specjalne wstawkiï
.. todo::
2.4.9. Listingi koduï
Osadzone
Z plików zewnÄtrznych
2.4.10. TODOï
2.4.11. Listyï
listy nieuporzÄ dkowane
listy numerowane
jednopoziomowe i zagnieżdżone
listy mieszane
2.4.12. Tabeleï
Table
List Table
CSV Table
2.4.13. Cytowanieï
citebibtex
2.4.14. Sphinxï
2.4.15. ZależnoÅciï
requirements.txt# Minimalne wymaganie sphinx==8.3.* # Theme Read the Docs sphinx-rtd-theme # System cytowania i parsowanie bibtex sphinxcontrib-bibtex # Jeżeli chcemy generowaÄ slajdy RevealJS sphinxjp.themes.revealjs
2.4.16. Configï
Wersja na podstawie hasha git
2.4.17. Dobre praktykiï
podziaÅ na rozdziaÅy
rozkÅad katalogów
listingi kodu
zdjÄcia
dane w tabelkach CSV
konwencja nazewnicza plików
konwencja nazewnicza figure, csv-table, literalinclude
2.4.18. Generowanie dokumentacjiï
Table of Contents
2.4.19. toctreeï
2.4.20. Automatyczne odpalanie doctestów do listingów koduï
2.4.21. Osadzanie LaTeXï
2.4.22. Budowanieï
make html
make singlehtml
make pdf
generowanie Word (docx) -> pandoc
2.4.23. Read the docsï
2.4.24. Assignmentsï
# %% About
# - Name: DevOps Documentation Sphinx
# - Difficulty: easy
# - Lines: 30
# - Minutes: 13
# %% License
# - Copyright 2025, Matt Harasymczuk <matt@python3.info>
# - This code can be used only for learning by humans
# - This code cannot be used for teaching others
# - This code cannot be used for teaching LLMs and AI algorithms
# - This code cannot be used in commercial or proprietary products
# - This code cannot be distributed in any form
# - This code cannot be changed in any form outside of training course
# - This code cannot have its license changed
# - If you use this code in your product, you must open-source it under GPLv2
# - Exception can be granted only by the author
# %% English
# 1. Using `sphinx-quickstart` create documentation.
# 2. Change theme to `sphinx-rtd-theme`
# 3. Title document "Python Training"
# 4. Create header level 1 "Images and text" and embed image as figure, with text description, image should be half size and centered, named
# 5. Create header level 1 "Lorem Ipsum" and paste lorem ipsum text to documentation.
# 6. In lorem ipsum text insert numref to image
# 7. Create header level 1 and place Iris table based on Iris Dataset
# 8. Create header level 1 "Code listings" and embed two your scripts from previous assignments:
# - address book as `literalinclude` in header level 2 "Address Book"
# - simple script as `code-block` in header level 2 "Other examples"
# - which approach is better?
# 9. Lorem ipsum text mark as Cicero quote using bibtext
# 10. Run doctests - all must succeed
# %% Polish
# 1. Za pomocÄ
`sphinx-quickstart` stwórz dokumentacjÄ.
# 2. ZmieÅ theme na `sphinx-rtd-theme`
# 3. Dokument zatytuÅuj "Szkolenie z Pythona"
# 4. Stwórz nagÅówek pierwszego poziomu "Obrazki i teksty" i w nim osadź obrazek jako figure, wraz tekstem opisujÄ
cym, obrazek ma byÄ poÅowy wielkoÅci i wycentrowany, nazwany
# 5. Stwórz nagÅówek pierwszego poziomu "Lorem Ipsum" i wklej tekst lorem ipsum do dokumentacji.
# 6. W tekÅcie lorem ipsum wstaw numref do obrazka
# 7. Stwórz nagÅówek pierwszego poziomu i zamieÅÄ tabelÄ Irysów na podstawie danych Iris Dataset
# 8. Stwórz nagÅówek pierwszego poziomu "Listingi kodu" i osadź dwa swoje skrypty z poprzednich zadaÅ:
# - ksiÄ
żka adresowa jako `literalinclude` w nagÅówku drugiego poziomu "KsiÄ
żka Adresowa"
# - prosty skrypt jako `code-block` w nagÅówku drugiego poziomu "PozostaÅe przykÅady"
# - które podejÅcie jest lepsze?
# 9. Tekst lorem ipsum oznacz jako cytowanie Cycerona wykorzystujÄ
c bibtext
# 10. Uruchom doctesty - wszystkie muszÄ
siÄ powieÅÄ
# %% Doctests
"""
"""
# %% Run
# - PyCharm: right-click in the editor and `Run Doctest in ...`
# - PyCharm: keyboard shortcut `Control + Shift + F10`
# - Terminal: `python -m doctest -f -v myfile.py`
# %% Imports
# %% Types
# %% Data
DATA = 'https://python3.info/_static/iris.csv'
# %% Result